-
-
Save chronossc/d8ec05c86c9986c1ecfc72e4852c7a3f to your computer and use it in GitHub Desktop.
slightly improved version of indicator with Stochastic RSI and RSI with alerts from autemox for use in trading view.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ver 1 alerts show significant stoch rsi crossovers as long as they arent in outermost bounds | |
// ver 2 fixed error with > to >= that caused some alerts to not appear | |
// ver 3 changed from symbols to columns to make it easier to set up real trading view alerts with it! | |
// BASED on https://www.tradingview.com/script/aUZVp1GC-Stochastic-RSI-with-Crossover-Alerts/ | |
// Author: autemox | |
study(title="Stochastic RSI with Crossover Alerts", shorttitle="Stoch RSI with Crossover Alerts") | |
smoothK = input(3, minval=1) | |
smoothD = input(3, minval=1) | |
lengthRSI = input(14, minval=1) | |
lengthStoch = input(14, minval=1) | |
src = input(close, title="RSI Source") | |
rsi1 = rsi(src, lengthRSI) | |
rsih0 = hline(70, title='RSI Up line') | |
rsih1 = hline(30, title='RSI Down line') | |
fill(rsih0, rsih1, color=#9915ff, transp=80, title='RSI Background') | |
plot(rsi1, color=#ff00ff, title="RSI", linewidth=2) | |
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK) | |
d = sma(k, smoothD) | |
plot(k, color=#0094ff, title="K", linewidth=2, transp=0) | |
plot(d, color=#ff6a00, title="D", linewidth=2, transp=0) | |
h0 = hline(80, title='Stochastic Up Line') | |
h1 = hline(20, title='Stochastic Down Line') | |
fill(h0, h1, color=#9915ff, transp=80, title='Stochastic Background') | |
linecol = k[0] >= d[0] and k[1] <= d[1] and k <= 60 and k >= 5 ? green : white | |
linecol2 = k[0] <= d[0] and k[1] >= d[1] and k >= 40 and k <= 95 ? red : linecol | |
data = (60-k[1])/2 | |
data2 = (k[1]-40)/2 | |
plot(k[1] >= d[1] and k[2] <= d[2] and k <= 60 and k >= 10 ? data : na , style=columns,color=green,title="Cross Up Confirmed") // show a green column higher if stoch is deeper | |
plot(k[1] <= d[1] and k[2] >= d[2] and k >= 40 and k <= 95 ? data2 : na , style=columns,color=red, title="Cross Down Confirmed") // show a red column higher if stoch is higher |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment