Rearview Download

Stochastic pullback

Buy an oversold stochastic reading while both the stock and the market are in uptrends, and sell when it becomes overbought. A fixed stop caps the damage from the pullbacks that keep going.

Strategies · stochastic_pullback.rvw

language 1
strategy "Stochastic pullback" {
  universe   members("SYN500")
  regime     close("SYNSPY") > sma(close("SYNSPY"), 200)
  enter long when regime and close > sma(close, 100) and stoch_k(14) < oversold
  rank by    -stoch_k(14)
  size       10% of equity, max 10 positions
  exit when  stoch_k(14) > 80
  stop       8%
  max bars   10
  param      oversold = 20 in 10..30 step 5
}

Functions it uses

sma, stoch_k

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?