2023년 3월 19일
study("TDI - Traders Dynamic Index [Nueva versión]", shorttitle="TDINueva") rsiPeriod = input(14, minval = 1, title = "RSI Period") kPeriod = input(8, minval = 1, title = "K Period") smoothK = input(5, minval = 1, title = "Smooth K") smoothD = input(3, minval = 1, title = "Smooth D") src = input(hlc3, title="Source") rsi = rsi(src, rsiPeriod) rsiMax = highest(rsi, kPeriod) rsiMin = lowest(rsi, kPeriod) stochK = sma(sma((rsi - rsiMin) / (rsiMax - rsiMin) * 100, smoothK), smoothK) stochD = sma(stochK, smoothD) bandLength = input(31, minval = 1, title = "Band Length") lengthrsipl = input(1, minval = 0, title = "Fast MA on RSI") lengthtradesl = input(9, minval = 1, title = "Slow MA on RSI") ma = sma(stochD, bandLength) offs = (1.6185 * stdev(stochD, bandLength)) up = ma + offs dn = ma - offs mid = (up + dn) / 2 fastMA = sma(stochD, lengthrsipl) slowMA = sma(stochD, lengthtradesl) hline(30) hline(50) hline(70) upl = plot(up, "Upper Band", color = blue) dnl = plot(dn, "Lower Band", color = blue) midl = plot(mid, "Middle of Bands", color = orange, linewidth = 2) plot(slowMA, "Slow MA", color=green, linewidth=2) plot(fastMA, "Fast MA", color=red, linewidth=2) fill(upl, midl, purple, transp=90) fill(midl, dnl, green, transp=90)