Rearview Download

Near the 52-week high

Stocks trading close to their 52-week high tend to keep rising: buy within a few percent of it, ranked by six-month momentum, and hold until the trend breaks or a trailing stop is hit.

Strategies · near_52w_high.rvw

language 1
strategy "Near the 52-week high" {
  universe   members("SYN500")
  proximity  close / highest(high, 252)
  enter long when proximity > 1 - gap * 1% and close > sma(close, 50)
  rank by    roc(close, 126)
  size       5% of equity, max 20 positions
  exit when  close < sma(close, 50)
  trail      15%
  param      gap = 5 in 2..10 step 1
}

Functions it uses

highest, sma, roc

Try it

File ▸ New Script from Example adds it to a project. The examples read the sample’s index label, SYN500, and market ETF, SYNSPY; when your data has neither, a sheet asks what to read instead, one of your index labels (or every stock and ETF) and a ticker, so the example runs on your data as it is.

Before you trust what it does on your data, see whether it’s luck: Is this result luck?