OPEN-SOURCE SCRIPT

Non-Lagging Indicator: EMA + TSI BY UTTAM PARAMANIK

//version=5
indicator("Non-Lagging Indicator: EMA + TSI", overlay=true)

// Parameters for the EMA
fastLength = input.int(9, title="Fast EMA Period", minval=1)
slowLength = input.int(21, title="Slow EMA Period", minval=1)

// Parameters for the TSI
tsiFastLength = input.int(13, title="TSI Fast Length", minval=1)
tsiSlowLength = input.int(25, title="TSI Slow Length", minval=1)
tsiSignalLength = input.int(7, title="TSI Signal Length", minval=1)

// EMA Calculation
fastEMA = ta.ema(close, fastLength)
slowEMA = ta.ema(close, slowLength)

// TSI Calculation
delta = close - close[1]
doubleSmoothDelta = ta.ema(ta.ema(delta, tsiFastLength), tsiSlowLength)
doubleSmoothAbsDelta = ta.ema(ta.ema(math.abs(delta), tsiFastLength), tsiSlowLength)
tsi = 100 * doubleSmoothDelta / doubleSmoothAbsDelta
tsiSignal = ta.ema(tsi, tsiSignalLength)

// Plot EMAs
plot(fastEMA, color=color.blue, title="Fast EMA")
plot(slowEMA, color=color.orange, title="Slow EMA")

// Plot TSI and Signal
plot(tsi, color=color.green, title="True Strength Indicator")
plot(tsiSignal, color=color.red, title="TSI Signal")

// Buy and Sell Conditions
buyCondition = ta.crossover(fastEMA, slowEMA) and ta.crossover(tsi, tsiSignal)
sellCondition = ta.crossunder(fastEMA, slowEMA) and ta.crossunder(tsi, tsiSignal)

// Plot Buy and Sell Signals
plotshape(buyCondition, color=color.green, style=shape.labelup, location=location.belowbar, text="BUY")
plotshape(sellCondition, color=color.red, style=shape.labeldown, location=location.abovebar, text="SELL")
Bands and ChannelsCandlestick analysisChart patterns

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明