Volatility-targeted weights
Volatility-targeted weights: hold up to 20 uptrending stocks, each weighted so that it adds about the same risk. With the default risk unit, a stock with 20% annual volatility gets a 5% weight, a jumpier one less and a calmer one more, up to 10%. The weights are reset on the first trading day of each month; a 25% band skips resizes too small to pay their commission.
Strategies · volatility_targeted_weights.rvw
language 1
strategy "Volatility-targeted weights" {
universe members("SYN500")
vol volatility(60)
enter long when close > sma(close, 100)
rank by roc(close, 63)
size weight risk_unit / vol, max 20 positions
max position 10%
rebalance monthly, band 25%
param risk_unit = 0.01 in 0.005..0.02 step 0.005
}
Functions it uses
volatility, 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?