Stochastic RSI with Divergences

Took my other Log RSI script and plugged in Stochastic RSI to see how divergences play on an oscillator with two lines. Turns out divergences are good at predicting changes in the oscillator but that doesn't mean that the oscillator will always mimic price action.

Log vs. no log is virtually the same.

Credits to
@fskrypt for introducing geometric mean
Divergences by @RicardoSantos (@JustUncleL's edit)
Release Notes: Added toggle for using average of K and D or only K for divergences
Release Notes: Added toggle for (low strikerate) hidden divergences. Now off by default.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?
My published indicators:

Sorry if I haven't replied to your message yet, I'm a bit backlogged :)


is there any way to adjust the lookback period?
+4 Reply
Good job
+4 Reply
+3 Reply
Thank you, very useful!
+2 Reply
pplscom HeroWanted
@HeroWanted, how to use this
+3 Reply
Thanks :)
+2 Reply
how can I get the ALARM???
+1 Reply
NeoButane yanebaby3

alertcondition(regular_bearish_div, "Regular Bearish Stoch RSI", "Regular bearish div. on SRSI")
alertcondition(regular_bullish_div, "Regular Bullish Stoch RSI", "Regular bullish div. on SRSI")
alertcondition(hidden_bearish_div, "Hidden Bearish Stoch RSI", "Hidden bearish div. on SRSI")
alertcondition(hidden_bullish_div, "Hidden Bullish Stoch RSI", "Hidden bullish div. on SRSI")

Add that to the bottom. Just a FYI it will let you know two candles late
Redallica NeoButane
@NeoButane, Is there a way to make the alerts sent quicker than 2 days late ? let's say just one day ? What do we need to change in the code ?
NeoButane Redallica
@Redallica, it is impossible because the alerts requires two bars to confirm.

You can try setting alerts on a lower timeframe, such as using alerts on the 12H, which mean it will send it 1 day late; if on 4H, 8 hours late. But doing so will mean having different Stoch RSI values.