BullBearXinsights Simple SMI [Phil Vo]

BullBearInsights · study · 29 行 · 点赞 36 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

//@version=6
indicator("BullBearXinsights Simple SMI [Phil Vo]", shorttitle="SMI by BullBearXinsights", overlay=false, precision=2)
 
rangeLength  = input.int(10, "Range Length", minval=1)
smoothLength = input.int(3, "Double EMA Smoothing", minval=1)
signalLength = input.int(3, "Signal EMA Length", minval=1)
upperLevel   = input.float(40.0, "Overbought", minval=0, maxval=100)
lowerLevel   = input.float(-40.0, "Oversold", minval=-100, maxval=0)
 
// Standard SMI: double-smoothed distance from the range midpoint.
highestHigh = ta.highest(high, rangeLength)
lowestLow   = ta.lowest(low, rangeLength)
distance    = close - (highestHigh + lowestLow) / 2.0
priceRange  = highestHigh - lowestLow
 
smoothDistance = ta.ema(ta.ema(distance, smoothLength), smoothLength)
smoothRange    = ta.ema(ta.ema(priceRange, smoothLength), smoothLength)
 
smi    = smoothRange > 0 ? 200.0 * smoothDistance / smoothRange : 0.0
signal = ta.ema(smi, signalLength)
 
plot(smi, "SMI", color=color.aqua, linewidth=2)
plot(signal, "Signal EMA", color=color.orange, linewidth=1)
upper = hline(upperLevel, "Overbought", color=color.red)
lower = hline(lowerLevel, "Oversold", color=color.lime)
hline(0, "Zero", color=color.gray, linestyle=hline.style_dotted)
fill(upper, lower, color=color.new(color.blue, 94))
 
// Lines update during the open candle; use closed bars for confirmation.

← 返回列表