Advertisement
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/
- // © NKactive
- //@version=5
- indicator("RSI Indicator NK v1.0", overlay=false)
- // Identifies a regions between boundaries when to stay in trend
- // The volatile rsi crosses the boundaries.
- // When between the boundaries cancel buy/sell to keep in position and remove whips
- // ****************************************************************************************************************************************************************
- rsiLenLowBoundary = input.int(defval=200, title="rsiLenLowBoundary")
- rsiLenHighBoundary = input.int(defval=100, title="rsiLenHighBoundary")
- rsiLenVolatile = input.int(defval=50, title="rsiLenVolatile")
- rsiLowBoundary = ta.rsi(close, rsiLenLowBoundary)
- rsiHighBoundary = ta.rsi(close, rsiLenHighBoundary)
- rsiVolatile = ta.rsi(close, rsiLenVolatile)
- plot(rsiLowBoundary, title="rsiLowBoundary", color=color.new(color.gray, 70), linewidth = 1)
- plot(rsiHighBoundary, title="rsiHighBoundary", color=color.new(color.gray, 70), linewidth = 1) //add this and see what happens...
- plot(rsiVolatile, title="rsiVolatile", color=color.new(color.gray, 10), linewidth = 2) //add this and see what happens...
- cancelSignal = 50
- //if rsiVolatile >= rsiHighBoundary and rsiVolatile <= rsiLowBoundary
- // cancelSignal := 50
- if rsiVolatile > rsiHighBoundary*1.1
- cancelSignal := 80
- if rsiVolatile < rsiHighBoundary*1.1
- cancelSignal := 20
- plot(cancelSignal, style=plot.style_stepline)
- //buySignal = ta.crossover(rsiVolatile, rsiHighBoundary) //or ta.crossover(rsiMax, rsiMin)
- //sellSignal = ta.crossunder(rsiVolatile, rsiLowBoundary) //or ta.crossunder(rsiMax, rsiMin)
- //plotshape(buySignal ? close : na, title="Buy", style=shape.triangleup, color=color.new(color.green,40), location=location.belowbar, size = size.small)
- //plotshape(sellSignal ? close : na, title="Sell", style=shape.triangledown, color=color.new(color.red,40), location=location.abovebar, size = size.small)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement