Down days in an uptrend
A run of lower closes inside an uptrend is a short pullback that often reverses. Enter after the run, exit on the first up close. Watch how the result changes with the length of the run: a strong spike at one length and nothing at its neighbours is probably luck.
Strategies · three_down_days.rvw
language 1
strategy "Down days in an uptrend" {
universe members("SYN500")
enter long when close > sma(close, 200) and count(close < close[1], run) == run
rank by -roc(close, run)
size 10% of equity, max 10 positions
exit when close > close[1]
max bars 10
param run = 3 in 2..5 step 1
}
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?