MACD Cross Trader
- Experts
- Versione: 1.0
- Attivazioni: 5
MACD Cross Trader is an Expert Advisor for MetaTrader 5 that combines a classic MACD crossover signal with a long-term EMA trend filter, aiming to trade in the direction of the prevailing trend while filtering out weaker counter-trend crossovers.
How it works:
The EA monitors the MACD indicator (fast EMA, slow EMA and signal SMA, all configurable) for a bullish or bearish crossover between the MACD line and the signal line. A signal is only acted on when price is on the correct side of a long-term EMA trend filter: a bullish crossover is considered only when price trades above the trend EMA, and a bearish crossover only when price trades below it. This combination is intended to align entries with the broader market direction rather than trading every crossover in isolation.
Stop Loss and Take Profit are calculated dynamically from the current ATR value, so trade management adapts to the volatility of the traded symbol and timeframe rather than using fixed point distances.
Risk management features:
- Free margin check with a safety buffer before every trade, helping to avoid broker "not enough money" rejections
- Maximum spread filter so trades are not opened during periods of abnormally wide spreads
- Only one position at a time per chart, with entry signals evaluated once per new bar rather than on every tick
- Optional ATR-based trailing stop that respects the broker's minimum stop distance and checks that Take Profit is not too close to price before modifying Stop Loss, reducing "Invalid stops" errors
- Magic number filtering so the EA only manages its own trades
Main inputs:
- InpMagicNumber: magic number for trade identification
- InpTimeFrame: timeframe used for signal calculation
- InpMaxSpreadPoints: maximum allowed spread, in points
- InpFastEMA / InpSlowEMA / InpSignalSMA: MACD calculation settings
- InpEMATrendPeriod: period of the long-term EMA trend filter
- InpStopLoss_ATR / InpTakeProfit_ATR: Stop Loss and Take Profit as ATR multiples
- InpLotSize: fixed lot size used for new trades
- Trailing stop settings: enable/disable, ATR multiple and step
As with any automated trading strategy, past behavior in testing does not guarantee future results. Every market and broker environment is different, so please test MACD Cross Trader thoroughly in the Strategy Tester and on a demo account, and adjust the inputs to match the characteristics of the symbol and account you intend to trade, before considering live use.
