//@version=3 study("RSI Levels, 15-30 & 70-85 with 50", shorttitle="RSI Levels with 50", overlay=true) length = input(14, title="RSI Length") eightyfive = 85 eightytwo = 82 seventynine = 79 seventysix = 76 seventythree = 73 seventy = 70 fifty = 50 thirty = 30 twentyseven = 27 twentyfour = 24 twentyone = 21 eightteen = 18 fifteen = 15 ep = 2 * length - 1 auc = ema( max( close - close[1], 0 ), ep ) adc = ema( max( close[1] - close, 0 ), ep ) x1 = (length - 1) * ( adc * thirty / (100-thirty) - auc) thirtyrsi = iff( x1 >= 0, close + x1, close + x1 * (100-thirty)/thirty ) x2 = (length - 1) * ( adc * twentyseven / (100-twentyseven) - auc) twentysevenrsi = iff( x2 >= 0, close + x2, close + x2 * (100-twentyseven)/twentyseven ) x3 = (length - 1) * ( adc * twentyfour / (100-twentyfour) - auc) twentyfourrsi = iff( x3 >= 0, close + x3, close + x3 * (100-twentyfour)/twentyfour ) x4 = (length - 1) * ( adc * twentyone / (100-twentyone) - auc) twentyonersi = iff( x4 >= 0, close + x4, close + x4 * (100-twentyone)/twentyone ) x5 = (length - 1) * ( adc * eightteen / (100-eightteen) - auc) eightteenrsi = iff( x5 >= 0, close + x5, close + x5 * (100-eightteen)/eightteen ) x6 = (length - 1) * ( adc * fifteen / (100-fifteen) - auc) fifteenrsi = iff( x6 >= 0, close + x6, close + x6 * (100-fifteen)/fifteen ) x7 = (length - 1) * ( adc * seventy / (100-seventy) - auc) seventyrsi = iff( x7 >= 0, close + x7, close + x7 * (100-seventy)/seventy ) x8 = (length - 1) * ( adc * seventythree / (100-seventythree) - auc) seventythreersi = iff( x8 >= 0, close + x8, close + x8 * (100-seventythree)/seventythree ) x9 = (length - 1) * ( adc * seventysix / (100-seventysix) - auc) seventysixrsi = iff( x9 >= 0, close + x9, close + x9 * (100-seventysix)/seventysix ) x10 = (length - 1) * ( adc * seventynine / (100-seventynine) - auc) seventyninersi = iff( x10 >= 0, close + x10, close + x10 * (100-seventynine)/seventynine ) x11 = (length - 1) * ( adc * eightytwo / (100-eightytwo) - auc) eightytworsi = iff( x11 >= 0, close + x11, close + x11 * (100-eightytwo)/eightytwo ) x12 = (length - 1) * ( adc * eightyfive / (100-eightyfive) - auc) eightyfiversi = iff( x12 >= 0, close + x12, close + x12 * (100-eightyfive)/eightyfive ) x13 = (length - 1) * ( adc * fifty / (100-fifty) - auc) fiftyrsi = iff( x13 >= 0, close + x13, close + x13 * (100-fifty)/fifty ) thirtyrsiplot = plot( thirtyrsi, title="30", color=#F6F9C2, linewidth=1) plot( twentysevenrsi, title="27", color=#EEEE00, linewidth=2) plot( twentyfourrsi, title="24", color=#EABB35, linewidth=3) plot( twentyonersi, title="21", color=#FF6700, linewidth=4) plot( eightteenrsi, title="18", color=#FE0301, linewidth=5) fifteenrsiplot = plot( fifteenrsi, title="15", color=#7F0100, linewidth=6) fiftyrsiplot = plot( fiftyrsi, title="50", color=#00FF00, linewidth=2) seventyrsiplot = plot( seventyrsi, title="70", color=#F6F9C2, linewidth=1) plot( seventythreersi, title="73", color=#EEEE00, linewidth=2) plot( seventysixrsi, title="76", color=#EABB35, linewidth=3) plot( seventyninersi, title="79", color=#FF6700, linewidth=4) plot( eightytworsi, title="82", color=#FE0301, linewidth=5) eightyfiversiplot = plot( eightyfiversi, title="85", color=#7F0100, linewidth=6) fill(thirtyrsiplot,fifteenrsiplot,color=#6E1979,transp=90) fill(seventyrsiplot,eightyfiversiplot,color=#6E1979,transp=90)