Advertisement
Guest User

Pikachuventures RSI

a guest
Oct 11th, 2019
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. // Created by Matthew J. Slabosz
  2. // www.zenandtheartoftrading.com
  3. // @version=3
  4. study(title="Pikachuventures RSI Indicator", shorttitle="RSI+", overlay=true)
  5.  
  6. // Get user input
  7. rsiLength = input(14, title="RSI Length:", type=integer, minval=1)
  8. rsiOverbought = input(70, title="RSI Overbought:", type=integer, minval=1)
  9. rsiOversold = input(30, title="RSI Oversold:", type=integer, minval=1)
  10. lookback = input(0, title="Signal Lookback Period:", type=integer)
  11. drawOnRT = input(title="Draw On Candles Yet To Close:", type=bool, defval=true)
  12.  
  13. // Check to see if RSI has crossed our threshold
  14. rsi = rsi(close, rsiLength)
  15. rsiOB = rsi >= rsiOverbought
  16. rsiOS = rsi <= rsiOversold
  17.  
  18. // Check to see if a signal has been generated within our lookback period
  19. for i = 1 to lookback + 1
  20. if(rsiOB[i])
  21. rsiOB := false
  22. if(rsiOS[i])
  23. rsiOS := false
  24.  
  25. // Plot signals and trigger any alerts
  26. plotshape(rsiOS and (barstate.ishistory or drawOnRT), title= "Oversold", location=location.belowbar, color=green, transp=0, style=shape.triangleup, text="")
  27. plotshape(rsiOB and (barstate.ishistory or drawOnRT), title= "Overbought", color=red, transp=0, style=shape.triangledown, text="")
  28. alertcondition(rsiOB or rsiOS, title="RSI+ Alert!", message="RSI Alert for ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement