Advertisement
Guest User

Untitled

a guest
Dec 5th, 2021
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.82 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. // © kaleboraciy
  3.  
  4. //@version=4
  5. study("RSI DIVER/COVER", max_bars_back = 1000)
  6.  
  7. len = input(14, title = "RSI length")
  8. look = input(25, title = "Lookback")
  9. high_value = input(85, title = "High line")
  10. low_value = input(15, title = "Low line")
  11. pog = input(0.1, title = "Inaccuracy")
  12. /////
  13. be = input(color.red, title = "BEAR line")
  14. bu = input(color.green, title = "BULL line")
  15.  
  16. bet = input(color.red, title = "BEAR text")
  17. but = input(color.green, title = "BULL text")
  18.  
  19. vr = input(color.yellow, title = "Crosses above")
  20. nr = input(color.blue, title = "Crosses below")
  21.  
  22. r = rsi(close, len)
  23.  
  24. hline(high_value, title = "High line")
  25. hline(low_value, title = "Low line")
  26. plot(r, title = "RSI line", color = color.yellow)
  27.  
  28. ph = pivothigh(r, look, look)
  29. pl = pivotlow(r, look, look)
  30.  
  31. var int xh = na
  32. xh := nz(xh[1])
  33.  
  34. var int xl = na
  35. xl := nz(xl[1])
  36.  
  37. var float yh = na
  38. yh := nz(yh[1])
  39.  
  40. var float yl = na
  41. yl := nz(yl[1])
  42.  
  43. if ph != nz(ph[1])
  44. if (r[look] > yh) and (high[bar_index - xh] > high[look])
  45. line.new(xh, yh, bar_index[look], r[look], color = be)
  46. label.new(bar_index[look], r[look], style = label.style_none, textcolor = bet, text = "BEAR 2")
  47. else if (r[look] < yh) and abs(high[bar_index - xh] - high[20]) <= pog
  48. line.new(xh, yh, bar_index[look], r[look], color = be)
  49. label.new(bar_index[look], r[look], style = label.style_none, textcolor = bet, text = "BEAR 3")
  50. else if (r[look] < yh) and (high[bar_index - xh] < high[20])
  51. line.new(xh, yh, bar_index[look], r[look], color = be)
  52. label.new(bar_index[look], r[look], style = label.style_none, textcolor = bet, text = "BEAR 1")
  53. xh := bar_index[look]
  54. yh := r[look]
  55.  
  56. if pl != nz(pl[1])
  57. if (r[look] > yl) and (low[bar_index - xl] > low[look])
  58. line.new(xl, yl, bar_index[look], r[look], color = bu)
  59. label.new(bar_index[look], r[look] - 10, style = label.style_none, textcolor = but, text = "BULL 2")
  60. if (r[look] > yl) and abs(low[bar_index - xl] - low[look]) <= pog
  61. line.new(xl, yl, bar_index[look], r[look], color = bu)
  62. label.new(bar_index[look], r[look] - 10, style = label.style_none, textcolor = but, text = "BULL 3")
  63. else if (r[look] < yl) and (low[bar_index - xl] < low[look])
  64. line.new(xl, yl, bar_index[look], r[look], color = bu)
  65. label.new(bar_index[look], r[look] - 10, style = label.style_none, textcolor = but, text = "BULL 1")
  66. xl := bar_index[look]
  67. yl := r[look]
  68.  
  69. if r[1] < high_value and r > high_value
  70. label.new(bar_index, r, color = vr, style = label.style_circle, size = size.tiny)
  71.  
  72. if r[1] > low_value and r < low_value
  73. label.new(bar_index, r, color = nr, style = label.style_circle, size = size.tiny)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement