OPEN-SOURCE SCRIPT

Combined EMA, RSI, VI

//version=6
indicator("Combined EMA, RSI, VI", overlay=true)

// EMA calculations
ema9 = ta.ema(close, 9)
ema15 = ta.ema(close, 15)

// Plotting EMA
plot(ema9, color=color.blue, title="EMA 9")
plot(ema15, color=color.orange, title="EMA 15")

// RSI calculation
rsiPeriod = 14
rsi = ta.rsi(close, rsiPeriod)

// Plotting RSI in a separate pane
plot(rsi, color=color.purple, title="RSI")
hline(70, "Overbought", color=color.red, linestyle=hline.style_dotted)
hline(30, "Oversold", color=color.green, linestyle=hline.style_dotted)

// Volatility Index (VI) calculations
viLength = 14
highLow = high - low
highPrevClose = math.abs(high - close[1])
lowPrevClose = math.abs(low - close[1])

trueRange = math.max(highLow, math.max(highPrevClose, lowPrevClose))
smoothedTrueRange = ta.rma(trueRange, viLength)

viPlus = ta.rma(high - low, viLength) / smoothedTrueRange
viMinus = ta.rma(close[1] - low, viLength) / smoothedTrueRange

// Plotting VI in the same pane as RSI for demonstration
plot(viPlus, color=color.green, title="VI+")
plot(viMinus, color=color.red, title="VI-")
Bands and Channels

开源脚本

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

想在图表上使用此脚本?

免责声明