rsit3
EBTURK
plain_text
a year ago
2.1 kB
20
Indexable
Never
// // RSI&T3 // study("RSI Bands-T3", shorttitle="RSIT3", overlay=true) obLevel = input(70, title="RSI Overbought") osLevel = input(30, title="RSI Oversold") length = input(14, title="RSI Length") src=close ep = 2 * length - 1 auc = ema( max( src - src[1], 0 ), ep ) adc = ema( max( src[1] - src, 0 ), ep ) x1 = (length - 1) * ( adc * obLevel / (100-obLevel) - auc) ub = iff( x1 >= 0, src + x1, src + x1 * (100-obLevel)/obLevel ) x2 = (length - 1) * ( adc * osLevel / (100-osLevel) - auc) lb = iff( x2 >= 0, src + x2, src + x2 * (100-osLevel)/osLevel ) plot( ub, title="Resistance", color=red, linewidth=2) plot( lb, title="Support", color=green, linewidth=2) plot( avg(ub, lb), title="RSI Midline", color=gray, linewidth=1) heikin_ashi_close = ((open + high + low + close)/4) heikin_ashi_open = na(heikin_ashi_open[1]) ? (open + close)/2 : (heikin_ashi_open[1] + heikin_ashi_close[1]) / 2 Lengthx = input(9, title="Lenght of T3") //For best results use 0.7 or 0.618 Vfactx = input(1, minval=0.01,step=0.01, title="Volume Factor of T3 with HA source") Source_of_T3_HA = input(false, title="Use Heikin-ashi source for T3?") Source_of_T3_Normal = input(close, title="Source of T3") Source_of_T3 = Source_of_T3_HA == false ? Source_of_T3_Normal : (ema(heikin_ashi_close, Lengthx) + ema(heikin_ashi_open, Lengthx))/2 FirstEMAx = ema(Source_of_T3, Lengthx) SecondEMAx = ema(FirstEMAx, Lengthx) ThirdEMAx = ema(SecondEMAx, Lengthx) FourthEMAx = ema(ThirdEMAx, Lengthx) FifthEMAx = ema(FourthEMAx, Lengthx) SixthEMAx = ema(FifthEMAx, Lengthx) //Doing all the calculations which are from c1x = -Vfactx*Vfactx*Vfactx c2x = 3*Vfactx*Vfactx + 3*Vfactx*Vfactx*Vfactx c3x = -6*Vfactx*Vfactx -3*Vfactx -3*Vfactx*Vfactx*Vfactx c4x = 1 + 3*Vfactx + Vfactx*Vfactx*Vfactx + 3*Vfactx*Vfactx //Assigning EMAS to T3 Moving average T3MAx = c1x * SixthEMAx + c2x * FifthEMAx + c3x * FourthEMAx + c4x * ThirdEMAx color_of_Tilson_Moving_Average = T3MAx > T3MAx[1] ? lime : red plot(T3MAx, title="Tilson Moving Average(ema)", color=color_of_Tilson_Moving_Average)