Advertisement
NKactive

Untitled

Aug 20th, 2023
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 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. // © NKactive
  3.  
  4. //@version=5
  5. indicator("RSI Indicator NK v1.0", overlay=false)
  6. // Identifies a regions between boundaries when to stay in trend
  7. // The volatile rsi crosses the boundaries.
  8. // When between the boundaries cancel buy/sell to keep in position and remove whips
  9. // ****************************************************************************************************************************************************************
  10. rsiLenLowBoundary = input.int(defval=200, title="rsiLenLowBoundary")
  11. rsiLenHighBoundary = input.int(defval=100, title="rsiLenHighBoundary")
  12. rsiLenVolatile = input.int(defval=50, title="rsiLenVolatile")
  13.  
  14. rsiLowBoundary = ta.rsi(close, rsiLenLowBoundary)
  15. rsiHighBoundary = ta.rsi(close, rsiLenHighBoundary)
  16. rsiVolatile = ta.rsi(close, rsiLenVolatile)
  17.  
  18. plot(rsiLowBoundary, title="rsiLowBoundary", color=color.new(color.gray, 70), linewidth = 1)
  19. plot(rsiHighBoundary, title="rsiHighBoundary", color=color.new(color.gray, 70), linewidth = 1) //add this and see what happens...
  20. plot(rsiVolatile, title="rsiVolatile", color=color.new(color.gray, 10), linewidth = 2) //add this and see what happens...
  21.  
  22. cancelSignal = 50
  23. //if rsiVolatile >= rsiHighBoundary and rsiVolatile <= rsiLowBoundary
  24. // cancelSignal := 50
  25. if rsiVolatile > rsiHighBoundary*1.1
  26. cancelSignal := 80
  27. if rsiVolatile < rsiHighBoundary*1.1
  28. cancelSignal := 20
  29.  
  30.  
  31. plot(cancelSignal, style=plot.style_stepline)
  32.  
  33.  
  34. //buySignal = ta.crossover(rsiVolatile, rsiHighBoundary) //or ta.crossover(rsiMax, rsiMin)
  35. //sellSignal = ta.crossunder(rsiVolatile, rsiLowBoundary) //or ta.crossunder(rsiMax, rsiMin)
  36. //plotshape(buySignal ? close : na, title="Buy", style=shape.triangleup, color=color.new(color.green,40), location=location.belowbar, size = size.small)
  37. //plotshape(sellSignal ? close : na, title="Sell", style=shape.triangledown, color=color.new(color.red,40), location=location.abovebar, size = size.small)
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement