Untitled
EBTURK
plain_text
a year ago
4.0 kB
15
Indexable
//@version=5 indicator(title='RSI Bands', shorttitle='RSIB', overlay=true,timeframe="", timeframe_gaps=true) rsismoothlength = input(3, title='Smoothing EMA Length') donchianmode = input(true, title='Donchian RSI Mode?') channellength = input(20, title='Donchian Channel Length') showbasis = input(true, title='Show Basis Line?') obLevel1 = input(70, title='Fast RSI Overbought') osLevel1 = input(30, title='Fast RSI Oversold') length1 = input(5, title='Fast RSI Length') src1 = input(high, title='Fast RSI Upper Source') src1_2 = input(low, title='Fast RSI Lower Source') ep = 2 * length1 - 1 auc1 = ta.ema(math.max(src1 - src1[1], 0), ep) adc1 = ta.ema(math.max(src1[1] - src1, 0), ep) auc1_2 = ta.ema(math.max(src1_2 - src1_2[1], 0), ep) adc1_2 = ta.ema(math.max(src1_2[1] - src1_2, 0), ep) x1 = (length1 - 1) * (adc1 * obLevel1 / (100 - obLevel1) - auc1) ub1 = ta.ema(x1 >= 0 ? src1 + x1 : src1 + x1 * (100 - obLevel1) / obLevel1, rsismoothlength) x2 = (length1 - 1) * (adc1_2 * osLevel1 / (100 - osLevel1) - auc1_2) lb1 = ta.ema(x2 >= 0 ? src1_2 + x2 : src1_2 + x2 * (100 - osLevel1) / osLevel1, rsismoothlength) obLevel2 = input(70, title='Mid RSI Overbought') osLevel2 = input(30, title='Mid RSI Oversold') length2 = input(8, title='Mid RSI Length') src2 = input(high, title='Mid RSI Upper Source') src2_2 = input(low, title='Mid RSI Lower Source') ep_2 = 2 * length2 - 1 auc2 = ta.ema(math.max(src2 - src2[1], 0), ep_2) adc2 = ta.ema(math.max(src2[1] - src2, 0), ep_2) auc2_2 = ta.ema(math.max(src2_2 - src2_2[1], 0), ep_2) adc2_2 = ta.ema(math.max(src2_2[1] - src2_2, 0), ep_2) x1_2 = (length2 - 1) * (adc2 * obLevel2 / (100 - obLevel2) - auc2) ub2 = ta.ema(x1_2 >= 0 ? src2 + x1_2 : src2 + x1_2 * (100 - obLevel2) / obLevel2, rsismoothlength) x2_2 = (length2 - 1) * (adc2_2 * osLevel2 / (100 - osLevel2) - auc2_2) lb2 = ta.ema(x2_2 >= 0 ? src2_2 + x2_2 : src2_2 + x2_2 * (100 - osLevel2) / osLevel2, rsismoothlength) obLevel3 = input(70, title='Slow RSI Overbought') osLevel3 = input(30, title='Slow RSI Oversold') length3 = input(13, title='Slow RSI Length') src3 = input(high, title='Slow RSI Upper Source') src3_2 = input(low, title='Slow RSI Lower Source') ep_3 = 2 * length3 - 1 auc3 = ta.ema(math.max(src3 - src3[1], 0), ep_3) adc3 = ta.ema(math.max(src3[1] - src3, 0), ep_3) auc3_2 = ta.ema(math.max(src3_2 - src3_2[1], 0), ep_3) adc3_2 = ta.ema(math.max(src3_2[1] - src3_2, 0), ep_3) x1_3 = (length3 - 1) * (adc3 * obLevel3 / (100 - obLevel3) - auc3) ub3 = ta.ema(x1_3 >= 0 ? src3 + x1_3 : src3 + x1_3 * (100 - obLevel3) / obLevel3, rsismoothlength) x2_3 = (length3 - 1) * (adc3_2 * osLevel3 / (100 - osLevel3) - auc3_2) lb3 = ta.ema(x2_3 >= 0 ? src3_2 + x2_3 : src3_2 + x2_3 * (100 - osLevel3) / osLevel3, rsismoothlength) midb = ta.ema(math.avg(ub3, lb3), rsismoothlength) plot(showbasis ? midb : na, color=color.new(color.white, 0), title='basis') highest_1 = ta.highest(ub1, channellength) lxplot = plot(donchianmode ? highest_1 : ub1, color=color.new(color.black, 0), linewidth=1) highest_2 = ta.highest(ub2, channellength) l0plot = plot(donchianmode ? highest_2 : ub2, color=color.new(color.black, 0), linewidth=1) highest_3 = ta.highest(ub3, channellength) l1plot = plot(donchianmode ? highest_3 : ub3, color=color.new(color.black, 0), linewidth=1) lowest_1 = ta.lowest(lb1, channellength) l3plot = plot(donchianmode ? lowest_1 : lb1, color=color.new(color.black, 0), linewidth=1) lowest_2 = ta.lowest(lb2, channellength) l4plot = plot(donchianmode ? lowest_2 : lb2, color=color.new(color.black, 0), linewidth=1) lowest_3 = ta.lowest(lb3, channellength) l5plot = plot(donchianmode ? lowest_3 : lb3, color=color.new(color.black, 0), linewidth=1) fill(lxplot, l0plot, title='Upper Zone 1', color=color.new(#313947, 25)) fill(l0plot, l1plot, title='Upper Zone 2', color=color.new(#313947, 50)) fill(l3plot, l4plot, title='Lower Zone 1', color=color.new(#000066, 25)) fill(l4plot, l5plot, title='Lower Zone 2', color=color.new(#000066, 50))
Editor is loading...
Leave a Comment