Rearview Download

Momentum within a sector

Momentum within one sector: rank the sector's stocks by six-month return and hold the leaders while they trend. Sector labels are each stock's current one, not its history, which the run's assumptions point out.

Strategies · sector_momentum.rvw

language 1
strategy "Momentum within a sector" {
  universe   sector("Technology") and members("SYN500")
  mom        roc(close, 126)
  enter long when rank_pct(mom) > 80 and close > sma(close, 100)
  exit when  rank_pct(mom) < 50
  rank by    mom
  size       equal weight, max 8 positions
}

Functions it uses

roc, rank_pct, sma

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?