OPEN-SOURCE SCRIPT

SLG's EMA+MACD Signal Trading Strategy M15

172
Trading Concept Overview

  • This strategy combines trend-following and momentum confirmation to identify high-probability entries in both long and short directions. It uses EMA-based trend filtering and MACD signal analysis, while managing risk dynamically using ATR-based stop loss and take profit.
  • 1. Trend Identification
  • The strategy calculates a Trend EMA (emaTrend) with a user-defined period (emaTrendLen) to determine the overall market direction:
  • Bullish Trend: Price closes above the Trend EMA → only long trades are considered.
  • Bearish Trend: Price closes below the Trend EMA → only short trades are considered.
  • This ensures trades are aligned with the larger trend, avoiding counter-trend signals.
  • 2. Momentum Signal with MACD
  • MACD Calculation:
  • fastEMA - slowEMA generates the MACD line.
  • Signal line is an EMA of the MACD line.
  • delta = MACD - Signal measures the momentum difference.
  • Entry Logic:
  • Long Signal: delta crosses above zero AND the price is above the Trend EMA.
  • Short Signal: delta crosses below zero AND the price is below the Trend EMA.
  • This ensures that entries occur only when momentum is aligned with the overall trend.
  • 3. Dynamic Risk Management (ATR-based SL/TP)
  • Uses Average True Range (ATR) to dynamically set stop loss and take profit:
  • Long Trade:
  • Stop Loss = Close - ATR * atrSLMult
  • Take Profit = Close + ATR * atrTPMult
  • Short Trade:
  • Stop Loss = Close + ATR * atrSLMult
  • Take Profit = Close - ATR * atrTPMult
  • This allows the strategy to adapt to market volatility, protecting capital in choppy conditions and scaling profit targets in trending markets.
  • 4. Visual and Alert Features
  • Plots:
  • Trend EMA for visual trend guidance.
  • MACD delta to observe momentum.
  • Long/Short signals as small triangles directly on the chart.
  • Alerts:
  • Generates notifications for long and short signals to trigger timely trades.
  • 5. Core Trading Philosophy
  • Trend-Following Bias: Only trade in the direction of the trend EMA.
  • Momentum Confirmation: Enter trades when the MACD delta confirms the move.
  • Volatility-Adjusted Risk: Use ATR to dynamically scale stops and targets.




Disclaimer / Risk Notice

Trading financial markets involves significant risk and may not be suitable for all investors. Past performance is not indicative of future results.
Market conditions can change rapidly and unpredictably, and no strategy can guarantee profits. Always use proper risk management and position sizing.
This strategy is for educational and informational purposes only. Users are responsible for their own trading decisions.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.