Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Created by Matthew J. Slabosz
- // www.zenandtheartoftrading.com
- // @version=3
- study(title="Pikachuventures RSI Indicator", shorttitle="RSI+", overlay=true)
- // Get user input
- rsiLength = input(14, title="RSI Length:", type=integer, minval=1)
- rsiOverbought = input(70, title="RSI Overbought:", type=integer, minval=1)
- rsiOversold = input(30, title="RSI Oversold:", type=integer, minval=1)
- lookback = input(0, title="Signal Lookback Period:", type=integer)
- drawOnRT = input(title="Draw On Candles Yet To Close:", type=bool, defval=true)
- // Check to see if RSI has crossed our threshold
- rsi = rsi(close, rsiLength)
- rsiOB = rsi >= rsiOverbought
- rsiOS = rsi <= rsiOversold
- // Check to see if a signal has been generated within our lookback period
- for i = 1 to lookback + 1
- if(rsiOB[i])
- rsiOB := false
- if(rsiOS[i])
- rsiOS := false
- // Plot signals and trigger any alerts
- plotshape(rsiOS and (barstate.ishistory or drawOnRT), title= "Oversold", location=location.belowbar, color=green, transp=0, style=shape.triangleup, text="")
- plotshape(rsiOB and (barstate.ishistory or drawOnRT), title= "Overbought", color=red, transp=0, style=shape.triangledown, text="")
- alertcondition(rsiOB or rsiOS, title="RSI+ Alert!", message="RSI Alert for ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement