xmd79

RSI true swings indicator

Jan 18th, 2022
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © tradeswithashish
  3.  
  4. //@version=5
  5. indicator(title="RSI true swings indicator", shorttitle="RSI True swings", overlay=true)
  6. upthresh=input.int(title="RSI Upper threshhold", defval=60, minval=50, step=5, maxval=90)
  7. lwthresh=input.int(title="RSI Lower threshhold", defval=40, minval=10, step=5, maxval=50)
  8. //volume criteria checkup
  9. volcheck=volume>ta.sma(volume, 20)
  10.  
  11. //Candle size must be above average
  12. bullbar_check= close>high[1] and (high-low)>1.2*ta.sma(high-low, 20)
  13. bearbar_check= close<low[1] and (high-low)>1.2*ta.sma(high-low, 20)
  14.  
  15. //RSI crossover/crossunder must fulfilling following criteria
  16. rsicrossover=ta.crossover(ta.rsi(close, 14), lwthresh) and volcheck and bullbar_check and volume>volume[1] and close>high[1] and open<close and close>high[2]
  17. rsicrossunder=ta.crossunder(ta.rsi(close, 14), upthresh) and volcheck and close<low[1] and bearbar_check and volume>volume[1] and open>close and close<low[2]
  18.  
  19.  
  20. //Plotting the signal confirming
  21. plotshape(rsicrossover, title="Short exit or Buy Entry", style= shape.labelup, location=location.belowbar, color=color.blue, size=size.tiny, text="BUY", textcolor=color.white)
  22. plotshape(rsicrossunder, title="Bull exit or Short entry", style= shape.labeldown, location=location.abovebar, color=color.black, size=size.tiny, text="SELL", textcolor=color.white)
Advertisement
Add Comment
Please, Sign In to add comment