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/
- // © kaleboraciy
- //@version=4
- study("RSI DIVER/COVER", max_bars_back = 1000)
- len = input(14, title = "RSI length")
- look = input(25, title = "Lookback")
- high_value = input(85, title = "High line")
- low_value = input(15, title = "Low line")
- pog = input(0.1, title = "Inaccuracy")
- /////
- be = input(color.red, title = "BEAR line")
- bu = input(color.green, title = "BULL line")
- bet = input(color.red, title = "BEAR text")
- but = input(color.green, title = "BULL text")
- vr = input(color.yellow, title = "Crosses above")
- nr = input(color.blue, title = "Crosses below")
- r = rsi(close, len)
- hline(high_value, title = "High line")
- hline(low_value, title = "Low line")
- plot(r, title = "RSI line", color = color.yellow)
- ph = pivothigh(r, look, look)
- pl = pivotlow(r, look, look)
- var int xh = na
- xh := nz(xh[1])
- var int xl = na
- xl := nz(xl[1])
- var float yh = na
- yh := nz(yh[1])
- var float yl = na
- yl := nz(yl[1])
- if ph != nz(ph[1])
- if (r[look] > yh) and (high[bar_index - xh] > high[look])
- line.new(xh, yh, bar_index[look], r[look], color = be)
- label.new(bar_index[look], r[look], style = label.style_none, textcolor = bet, text = "BEAR 2")
- else if (r[look] < yh) and abs(high[bar_index - xh] - high[20]) <= pog
- line.new(xh, yh, bar_index[look], r[look], color = be)
- label.new(bar_index[look], r[look], style = label.style_none, textcolor = bet, text = "BEAR 3")
- else if (r[look] < yh) and (high[bar_index - xh] < high[20])
- line.new(xh, yh, bar_index[look], r[look], color = be)
- label.new(bar_index[look], r[look], style = label.style_none, textcolor = bet, text = "BEAR 1")
- xh := bar_index[look]
- yh := r[look]
- if pl != nz(pl[1])
- if (r[look] > yl) and (low[bar_index - xl] > low[look])
- line.new(xl, yl, bar_index[look], r[look], color = bu)
- label.new(bar_index[look], r[look] - 10, style = label.style_none, textcolor = but, text = "BULL 2")
- if (r[look] > yl) and abs(low[bar_index - xl] - low[look]) <= pog
- line.new(xl, yl, bar_index[look], r[look], color = bu)
- label.new(bar_index[look], r[look] - 10, style = label.style_none, textcolor = but, text = "BULL 3")
- else if (r[look] < yl) and (low[bar_index - xl] < low[look])
- line.new(xl, yl, bar_index[look], r[look], color = bu)
- label.new(bar_index[look], r[look] - 10, style = label.style_none, textcolor = but, text = "BULL 1")
- xl := bar_index[look]
- yl := r[look]
- if r[1] < high_value and r > high_value
- label.new(bar_index, r, color = vr, style = label.style_circle, size = size.tiny)
- if r[1] > low_value and r < low_value
- label.new(bar_index, r, color = nr, style = label.style_circle, size = size.tiny)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement