xmd79

Multi Time RSI

Nov 22nd, 2021 (edited)
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. //@version=5
  2. indicator(title='Multi Time RSI', overlay=false)
  3.  
  4. avg1 = input(title='Slow Average :', defval=21)
  5. avg2 = input(title='Fast Average :', defval=11)
  6. rsi_avg_step = input(title='RSI Avg Step :', defval=1.0)
  7.  
  8. inp = input(close)
  9.  
  10.  
  11. //Plot RSI
  12. rsiCurrent = ta.rsi(inp, 11)
  13. rsi_current_plot = plot(rsiCurrent, color=color.new(color.black, 0), linewidth=2, style=plot.style_line, title='Current RSI Time Frame')
  14.  
  15. rsi_avg = ta.ema(ta.rsi(inp, 11), avg1)
  16. rsi_avg_plot = plot(rsi_avg, color=color.new(color.red, 0), linewidth=2, style=plot.style_line, title='Current AVG RSI Time Frame')
  17. rsi_avg_1 = ta.ema(ta.rsi(inp, 11), avg2)
  18. rp1 = plot(rsi_avg_1, color=color.new(color.blue, 50), linewidth=1, style=plot.style_line, title='Current AVG RSI Time Frame')
  19. fc1 = if rsi_avg_1 < rsi_avg
  20. color.new(color.red, 30)
  21. else
  22. color.new(color.green, 30)
  23. fill(rsi_avg_plot, rp1, color=fc1, transp=0)
  24.  
  25. fill_color = if rsi_avg > rsiCurrent and rsi_avg[1] - rsi_avg[0] > rsi_avg_step
  26. color.new(color.red, 50)
  27. else if rsi_avg < rsiCurrent and rsi_avg[0] - rsi_avg[1] > rsi_avg_step
  28. color.new(color.green, 50)
  29. fill(rsi_current_plot, rsi_avg_plot, color=fill_color, editable=true, title='RSI BAND', transp=50)
  30.  
  31. b1 = hline(70, color=color.new(color.green, 100), linestyle=hline.style_dotted, linewidth=1, title='Top Range')
  32. b = hline(60, color=color.new(color.green, 100), linestyle=hline.style_dotted, linewidth=1, title='High Range')
  33. s = hline(40, color=color.new(color.red, 100), linestyle=hline.style_dotted, linewidth=1, title='Low Range')
  34. s1 = hline(30, color=color.new(color.red, 100), linestyle=hline.style_dotted, linewidth=1, title='Bottom Range')
  35. m = hline(50, color=color.black, linestyle=hline.style_dotted, linewidth=1, title='Mid Range')
  36. fill(b1, b, color=color.new(color.green, 80))
  37. fill(s1, s, color=color.new(color.red, 80))
  38.  
  39. buy_zone = if rsi_avg[0] - rsi_avg[1] > 1
  40. true
  41. else
  42. false
  43. plotshape(buy_zone, style=shape.triangleup, location=location.bottom, color=color.new(color.green, 0), size=size.tiny, title='Bulish Symbol')
  44.  
  45. sell_zone = if rsi_avg[2] - rsi_avg[1] > 1
  46. true
  47. else
  48. false
  49. plotshape(sell_zone, style=shape.triangledown, location=location.top, color=color.new(color.red, 0), size=size.tiny, title='Bearish Symbol')
  50.  
  51.  
  52.  
Add Comment
Please, Sign In to add comment