Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © tradeswithashish
- //@version=5
- indicator(title="RSI true swings indicator", shorttitle="RSI True swings", overlay=true)
- upthresh=input.int(title="RSI Upper threshhold", defval=60, minval=50, step=5, maxval=90)
- lwthresh=input.int(title="RSI Lower threshhold", defval=40, minval=10, step=5, maxval=50)
- //volume criteria checkup
- volcheck=volume>ta.sma(volume, 20)
- //Candle size must be above average
- bullbar_check= close>high[1] and (high-low)>1.2*ta.sma(high-low, 20)
- bearbar_check= close<low[1] and (high-low)>1.2*ta.sma(high-low, 20)
- //RSI crossover/crossunder must fulfilling following criteria
- 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]
- 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]
- //Plotting the signal confirming
- 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)
- 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