Long top decile, short bottom decile
Cross-sectional long/short: long the top decile of 60-day momentum scaled by volatility, short the bottom decile. One rank serves both sides, so it measures how extreme a name is.
Strategies · long_short_decile.rvw
language 1
strategy "Long top decile, short bottom decile" {
universe members("SYN500")
score roc(close, 60) / volatility(60)
decile bucket(score, 10)
enter long when decile == 10
enter short when decile == 1
rank by abs(cs_zscore(score))
size equal weight, max 6 positions
exit long when decile <= 7
exit short when decile >= 4
max bars 40
fill next_open
}
Functions it uses
roc, volatility, bucket, abs, cs_zscore
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?