Bollinger band reversion
Reversion to the mean: buy a stock in a long-term uptrend after it closes below its lower Bollinger band, and sell when it gets back to its 20-day average. The 200-day filter keeps out stocks in free fall; losses still bunch up in sharp market sell-offs.
Strategies · bollinger_reversion.rvw
language 1
strategy "Bollinger band reversion" {
universe members("SYN500")
enter long when close > sma(close, 200) and close < bollinger_lower(close, 20, width)
rank by -zscore(close, 20)
size 10% of equity, max 10 positions
exit when close > sma(close, 20)
max bars 15
param width = 2 in 1.5..3 step 0.5
}
Functions it uses
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?