This strategy is an adaptive trading system based on the Stochastic Momentum Index (SMI). It predicts market trends by analyzing crossovers between the SMI indicator and its signal line, automatically generating buy and sell signals at key positions. The strategy employs double exponential moving averages (EMA) to smooth data and improve signal reliability. This system is particularly suitable for medium to long-term trading and effectively captures major market trend reversal points.
The core of the strategy lies in measuring price momentum through the SMI calculation. It first determines the highest and lowest price range within a specific period, then normalizes the closing price’s position relative to this range. By applying double EMA smoothing to both the relative range and price range, it generates more stable SMI values. Buy signals are triggered when the SMI line makes a golden cross with its signal line (SMI’s EMA), while death crosses trigger sell signals. Overbought and oversold zones (+40/-40) are set to confirm signal reliability.
This is a mature trading strategy based on the SMI indicator, generating trading signals through technical indicator crossovers with strong practicality. The strategy’s core advantages lie in its clear signals and strong noise resistance, though it does have some inherent lag. Through optimizations such as volume validation and trend filtering, the strategy’s stability and reliability can be further enhanced. This strategy is particularly suitable for tracking medium to long-term trends and serves as an excellent choice for investors looking to build systematic trading systems.
/*backtest start: 2024-12-19 00:00:00 end: 2024-12-26 00:00:00 period: 45m basePeriod: 45m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Iban_Boe //@version=6 strategy("SMI Strategy with Signals", "SMI Strategy", overlay=false) // Parámetros del SMI lengthK = input.int(14, "%K Length", minval=1, maxval=15000) lengthD = input.int(3, "%D Length", minval=1, maxval=4999) lengthEMA = input.int(3, "EMA Length", minval=1, maxval=4999) // Función de doble EMA emaEma(source, length) => ta.ema(ta.ema(source, length), length) // Cálculos del SMI highestHigh = ta.highest(lengthK) lowestLow = ta.lowest(lengthK) highestLowestRange = highestHigh - lowestLow relativeRange = close - (highestHigh + lowestLow) / 2 smi = 200 * (emaEma(relativeRange, lengthD) / emaEma(highestLowestRange, lengthD)) smiSignal = ta.ema(smi, lengthEMA) // Gráficos del SMI smiPlot = plot(smi, "SMI", color=color.blue) plot(smiSignal, "SMI-based EMA", color=color.orange) // Level lines hline(40, "Overbought Line", color=color.green) hline(-40, "Oversold Line", color=color.red) hline(0, "Middle Line", color=color.gray) midLinePlot = plot(0, color = na, editable = false, display = display.none) fill(smiPlot, midLinePlot, 120, 40, top_color = color.new(#4caf4f, 50), bottom_color = color.new(color.green, 100), title = "Overbought Gradient Fill") fill(smiPlot, midLinePlot, -40, -120, top_color = color.new(color.red, 100), bottom_color = color.new(color.red, 50), title = "Oversold Gradient Fill") // Señales de compra y venta buySignal = ta.crossover(smi, smiSignal) // Detect crossover sellSignal = ta.crossunder(smi, smiSignal) // Detect crossover // Graficar señales de compra/venta plotshape(series=buySignal, style=shape.labelup, location=location.belowbar, color=color.green, size=size.tiny, title="Señal de Compra") plotshape(series=sellSignal, style=shape.labeldown, location=location.abovebar, color=color.red, size=size.tiny, title="Señal de Venta") // Lógica de la estrategia if (buySignal) strategy.entry("Compra", strategy.long) if (sellSignal) strategy.entry("Venta", strategy.short) // Alertas alertcondition(buySignal, title="Alerta de Compra", message="¡Señal de Compra Detectada!") alertcondition(sellSignal, title="Alerta de Venta", message="¡Señal de Venta Detectada!")