本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
indicator("SMT Trend Shift Pro", overlay = true)
// ==========================================
// 1. Inputs (Parameter Values Hidden)
// ==========================================
fast_param = input.int(10, title = "Fast Factor", display = display.none)
slow_param = input.int(20, title = "Slow Factor", display = display.none)
// ==========================================
// 2. EMA Calculations
// ==========================================
val_f = ta.ema(close, fast_param)
val_s = ta.ema(close, slow_param)
// Conditions
is_bullish = val_f > val_s
is_bearish = val_f < val_s
bull_cross = ta.crossover(val_f, val_s)
bear_cross = ta.crossunder(val_f, val_s)
// ==========================================
// 3. Normal Lines (10 & 20 EMA)
// ==========================================
plot(val_f, title = "Fast Line", color = color.blue, linewidth = 2)
plot(val_s, title = "Slow Line", color = color.orange, linewidth = 2)
// ==========================================
// 4. Candle Color Change based on Trend
// ==========================================
candle_color = is_bullish ? color.green : is_bearish ? color.red : color.gray
barcolor(candle_color)
// ==========================================
// 5. Watchlist Alert System
// ==========================================
if bull_cross
alert("🚀 BUY Trend Shift Alert!\nSymbol: " + syminfo.ticker + "\nTimeframe: " + timeframe.period + "\nPrice: " + str.tostring(close), alert.freq_once_per_bar)
if bear_cross
alert("🔻 SELL Trend Shift Alert!\nSymbol: " + syminfo.ticker + "\nTimeframe: " + timeframe.period + "\nPrice: " + str.tostring(close), alert.freq_once_per_bar)