MACD TRADING STRATEGIES EA MT4/MT5 Settings/Inputs Guide

MACD TRADING STRATEGIES EA MT4/MT5 Settings/Inputs Guide

18 October 2024, 05:00
Biswarup Banerjee
0
2 090

Complete User Documentation — MT4 & MT5

1. OVERVIEW

The MACD Strategy Multicurrency EA automates trading across multiple currency pairs from a single chart, using the MACD indicator as its core signal engine. It doesn't just show you MACD crossovers — it lets you choose from six distinct entry strategies and seven exit strategies, plus divergence detection, all while managing risk with ATR-based trailing stops, breakeven, and group-level stop-losses. The real problem it solves is the hassle of manually monitoring MACD signals on a dozen pairs and trying to execute trades fast enough — this EA handles the scanning, signal filtering, and order placement for you.

Who Should Use It: Active retail forex traders who rely on MACD for entries and exits but want to automate multi-pair execution without writing a single line of code.

Main Benefit: You get a fully automated, multi-strategy MACD trading system that can run on up to 28 pairs simultaneously, with sophisticated risk controls and multiple exit methods — all configurable from one chart.


2. INPUT PARAMETERS & SETTINGS

This product shares a common set of general input settings with all Multi-Currency Scanner Dashboard products in this series. The following sections are covered in the common guide: General Settings (pairs list, dashboard colors, panel size), Timeframe Signal Settings (individual TF scan per symbol), Timeframe Confluence Settings (multi-TF confluence scan), and Alert Settings (popup, push notification, email). For full details refer to the Common Multi-Currency Scanner Dashboard Settings Guide. The sections below cover only the product-specific inputs unique to this product.

General Settings

These settings control how the EA displays virtual stop-loss and take-profit lines on the chart, how it handles group-level risk, whether swap costs are included in profit calculations, and whether historical trade data is recorded for backtesting analysis.

Setting Name Type Default Value Description Example
Chart lines for virtual SL/TP (never drawn during optimization) bool false When enabled, the EA draws horizontal lines on the chart showing where your hidden stop-loss and take-profit levels sit. Useful for visual confirmation during live trading, but it's automatically suppressed during optimization runs to avoid clutter. Most traders leave this off unless they're manually monitoring positions. true — Enable this only during live trading when you want to see your hidden SL/TP levels on the chart.
Group Stoploss Amount double 0 Sets a maximum total loss in account currency for all positions opened by this EA across all pairs. When the combined floating loss hits this amount, all trades are closed. This is your "circuit breaker" — critical for protecting your account during volatile conditions. Set to 0 to disable. 500 — Close all EA trades if total floating loss reaches $500 on a $10,000 account.
Include Swap charges in Profit bool true When true, the EA factors overnight swap fees into its profit calculations for features like breakeven and trailing stop activation. Leave it on for realistic profit tracking, especially if you hold trades overnight. Turn it off only if you want to ignore swap costs in your risk logic. true — Keep this enabled for accurate profit calculations on swing trades held for several days.
Enable history for backtests or optimization bool false When enabled, the EA records detailed trade history data that can be analyzed after backtesting or optimization runs. This is purely for analysis — it has no effect on live trading. Enable it during optimization to get richer data for comparing parameter sets. true — Turn this on when running optimization to capture detailed trade logs for later analysis.

Atr Trailingstop Settings

These settings configure an ATR-based trailing stop that dynamically adjusts your stop-loss based on market volatility, using the Average True Range indicator to set activation thresholds, trail distance, and increment steps.

Setting Name Type Default Value Description Example
Use ATR Trailing Stop bool false Master switch for the ATR-based trailing stop feature. When enabled, the EA will dynamically adjust your stop-loss based on market volatility rather than a fixed pip distance. This is particularly useful in volatile markets where a fixed stop might get hit by noise. true — Enable this on volatile pairs like GBP/JPY to let the stop adjust to market conditions.
ATR Timeframe ENUM PERIOD_CURRENT Selects the timeframe used to calculate the ATR value for the trailing stop. Using a higher timeframe like H4 gives a smoother, more stable ATR, while the current chart timeframe reacts faster. Choose based on your trading style — slower for swing, faster for scalping. PERIOD_H1 — Use H1 ATR for a balance between responsiveness and stability on a 15-minute chart.
ATR Period int 14 The number of bars used to calculate the ATR value. A period of 14 is standard and works well for most markets. Increase it (e.g., 20) for smoother ATR that's less sensitive to recent spikes, or decrease it (e.g., 7) for faster reaction to volatility changes. 14 — The default works for most pairs; try 20 on smoother pairs like EUR/USD.
Activation (ATR multiplier) double 2.0 The profit level (in ATR units) that must be reached before the trailing stop activates. A value of 2.0 means the trade must be 2 ATRs in profit before trailing begins. Higher values reduce whipsaw but may miss some profit — lower values activate sooner but risk premature trailing. 2.0 — Good starting point; increase to 3.0 for trend-following strategies on strong trends.
Trail distance (ATR multiplier) double 1.0 The fixed distance (in ATR units) that the stop-loss trails behind the current price once activated. A value of 1.0 means the stop is placed 1 ATR away from the current price. Smaller values lock in profit faster but risk being hit by normal pullbacks. 1.0 — Standard setting; use 0.8 for tighter trailing on fast-moving pairs.
Trail increment (ATR multiplier) double 0.5 The minimum price movement (in ATR units) required before the trailing stop is adjusted upward. A value of 0.5 means the stop only moves after price advances by 0.5 ATR. This prevents the stop from being adjusted on every tiny tick, reducing unnecessary updates. 0.5 — Good default; increase to 1.0 for less frequent adjustments on slower pairs.

Grid Settings

This single setting controls whether the EA attempts to recover losses from all grid trades by closing them as a group when total profit reaches a target.

Setting Name Type Default Value Description Example
Recover profit from all grid trades bool false When enabled, the EA calculates the total net profit across all open grid trades and closes the entire grid when that profit reaches a predefined target. This is useful for grid strategies where individual trades may be in loss but the overall grid is profitable. Leave disabled for standard single-trade management. true — Enable this if you're running a grid strategy and want to close all trades when the grid as a whole is profitable.

Safeguard Settings

These settings act as safety nets for your account, including maximum loss limits and backtesting-only filters for minimum profit, trade count, and inactivity periods.

Setting Name Type Default Value Description Example
Max Loss from initial balance [0: disable] double 0.0 Sets a maximum drawdown limit as a percentage of the initial account balance. If the floating loss reaches this percentage, all trades are closed and the EA stops trading. This is your emergency stop — critical for preventing catastrophic losses. Set to 0 to disable. 20 — Stop all trading if losses reach 20% of the starting balance on a $5,000 account.
Minimum Profit Percent [backtesting only] [0: disable] double 0 A backtesting filter that rejects any optimization result where total profit is below this percentage. Useful for quickly discarding underperforming parameter sets during optimization. Has no effect on live trading. Set to 0 to disable. 10 — Only consider optimization results with at least 10% total profit over the test period.
Minimum Trades [backtesting only] [0: disable] double 0 A backtesting filter that rejects optimization results with fewer than this many trades. Helps avoid overfitting by ensuring the strategy has been tested on a sufficient number of trades. Set to 0 to disable. 50 — Only accept results with at least 50 trades to ensure statistical significance.
Max inactive days [backtesting only] [0: disable] int 0 A backtesting filter that rejects optimization results where the EA was inactive (no trades) for more than this many consecutive days. Useful for ensuring the strategy remains active during the test period. Set to 0 to disable. 30 — Reject results where the EA didn't trade for more than 30 consecutive days.

Macd Settings

These are the core MACD parameters — timeframe, short/long periods, signal period, applied price, and the entry/exit strategy selection that defines how the EA interprets MACD signals for trade decisions.

Setting Name Type Default Value Description Example
Macd Timeframe ENUM PERIOD_CURRENT Selects the timeframe on which the MACD indicator is calculated. Using a higher timeframe (e.g., H4) gives more reliable signals but fewer opportunities, while the current chart timeframe reacts faster. Choose based on your trading horizon — higher for swing, lower for intraday. PERIOD_H1 — Use H1 MACD for swing trading on a 15-minute chart to filter out noise.
Macd Short Period int 12 The fast EMA period used in the MACD calculation. A shorter period (e.g., 8) makes the MACD line more responsive to recent price changes, generating earlier signals but with more false positives. The default 12 is a good balance for most forex pairs. 12 — Standard setting; try 8 for faster signals on volatile pairs like GBP/JPY.
Macd Long Period int 26 The slow EMA period used in the MACD calculation. A longer period (e.g., 30) smooths out the MACD line more, reducing false signals but also delaying entries. The default 26 works well for most strategies; increase it for stronger trend confirmation. 26 — Standard; increase to 30 for smoother signals on slower-moving pairs like EUR/USD.
3. HOW IT WORKS

Core Calculation & Logic

The EA calculates the MACD line, signal line, and histogram for every symbol in your list, on every tick. It compares the current MACD value against the signal line and the previous bar's values to detect crossovers, crossunders, and momentum shifts. The core math is the standard MACD formula — fast EMA minus slow EMA, with a signal SMA applied to that difference — but the EA applies it across multiple pairs from a single chart, which is where the real power lies.

What you're really getting here is a systematic scanner that checks each pair against your chosen entry strategy (see below) and opens a trade the moment conditions align. It doesn't just show you signals on a dashboard — it acts on them. The EA also supports divergence detection (strategy 7), which looks for price-MACD divergences over a configurable lookback window, a setup many traders overlook because it's tedious to spot manually across multiple pairs.

Entry Strategies Explained

The EA includes seven distinct entry strategies, selected via the Macd Entry Strategy parameter. Each one defines a different set of conditions for entering a trade. You'll want to pick the one that matches your trading style and the current market environment.

Strategy 1 — MACD Crossover (Standard)

BUY Signal: The MACD line crosses above the signal line on the current bar, and the MACD value is above zero (positive histogram).

SELL Signal: The MACD line crosses below the signal line on the current bar, and the MACD value is below zero (negative histogram).

Best For: Trending markets where you want to catch the early part of a move. This is the classic MACD crossover setup most traders learn first.

Strategy 2 — MACD Crossover (Zero-Line Filter)

BUY Signal: MACD line crosses above the signal line, but only when the MACD is above zero. This filters out weak crossovers that occur below the zero line.

SELL Signal: MACD line crosses below the signal line, but only when the MACD is below zero.

Best For: Strong trends where you want to avoid counter-trend signals. I prefer this one when I'm trading higher timeframes like H4 or daily.

Strategy 3 — MACD Histogram Reversal

BUY Signal: The histogram (MACD - signal) turns from negative to positive on the current bar.

SELL Signal: The histogram turns from positive to negative on the current bar.

Best For: Quick counter-trend moves or range-bound markets where crossovers are too slow. The histogram changes direction before the lines cross, so you get earlier entries — but also more false signals.

Strategy 4 — MACD Histogram Divergence (Simple)

BUY Signal: Price makes a lower low, but the histogram makes a higher low (bullish divergence).

SELL Signal: Price makes a higher high, but the histogram makes a lower high (bearish divergence).

Best For: Reversal spotting at the end of a trend. This is a simpler divergence check than strategy 7 — it only looks at the histogram, not the MACD line itself.

Strategy 5 — MACD Line Divergence

BUY Signal: Price makes a lower low, but the MACD line makes a higher low.

SELL Signal: Price makes a higher high, but the MACD line makes a lower high.

Best For: More reliable divergence signals compared to histogram divergence, since the MACD line is smoother. Use this when you want fewer but higher-probability reversal setups.

Strategy 6 — MACD Zero-Line Crossover

BUY Signal: The MACD line crosses above the zero line.

SELL Signal: The MACD line crosses below the zero line.

Best For: Trend confirmation. This is a lagging signal — you enter after the trend is already established — but it keeps you out of choppy sideways markets.

Strategy 7 — MACD Divergence (Advanced, with Lookback Control)

BUY Signal: Bullish divergence detected using the MACD line, with configurable lookback bars (default 50), minimum bar distance between divergence points (default 20), and a minimum price gap in pips (default 15).

SELL Signal: Bearish divergence detected using the same parameters.

Best For: Traders who want fine-grained control over divergence detection. The extra parameters let you filter out minor divergences that don't have enough price separation or are too close together. This is the most customizable strategy in the EA.

Step-by-Step Workflow

Step 1: Attach the EA to a chart. Any chart will do — the EA doesn't trade the chart's symbol unless you include it in the symbol list. Use a low-load pair like EURUSD to minimize CPU usage.

Step 2: Set your symbol list. In the SYMBOLS parameter, enter the pairs you want to trade, separated by commas. The default is EURUSD,GBPUSD,USDCHF — you'll probably want to expand that to 8-12 pairs for proper diversification.

Step 3: Choose your entry strategy. Set Macd Entry Strategy to one of the seven options above. Start with Strategy 1 (standard crossover) if you're new to the EA.

Step 4: Configure risk management. Set your lot size, stop loss, and take profit. If you're unsure, start with 0.01 lots and a 50-pip stop loss. You can always adjust later.

Step 5: Enable or disable hidden SL/TP. The HIDDEN_SL_TP parameter lets you hide stop loss and take profit from the broker (virtual SL/TP managed by the EA). This is useful if your broker doesn't allow stops within a certain distance of the market.

Step 6: Run a backtest first. Before going live, test the EA on at least 6 months of data with your chosen settings. Pay attention to drawdown and number of trades — you want enough trades to be statistically meaningful.

Step 7: Go live on a demo account. Run the EA on a demo for at least 2 weeks. Monitor how it behaves during news events and market opens. Only then consider moving to a live account.


4. RISK MANAGEMENT FEATURES

The EA includes several risk management options that go beyond basic stop loss and take profit. Here's what each one does and when you'd use it.

Feature Description
Stop Loss / Take Profit Mode Choose between Pips, Amount (fixed currency), Percent (of account), Group Amount, Group Percent, or No SL/TP. The Group modes apply a combined stop or target across all open positions from this EA — useful if you want to cap total portfolio risk rather than per-trade risk.
Hidden SL/TP When enabled, the EA manages stop loss and take profit internally without sending them to the broker. This keeps your levels hidden from other market participants. The EA closes the trade when price hits the virtual level. Note: chart lines for virtual SL/TP are never drawn during optimization to avoid slowing down backtests.
Risk-Reward Ratio Set a fixed risk-reward ratio (e.g., 1:2) and the EA will calculate the take profit based on your stop loss distance. If set to 0, the EA uses the manual take profit value instead. This is handy when you want consistent R:R across all trades without calculating each one manually.
Group Stop Loss / Take Profit Available in Amount and Percent variants. These set a combined loss or profit limit across all positions opened by the EA. For example, a Group Stop Loss Amount of $100 means the EA will close all trades if total floating loss reaches $100. This prevents any single bad run from blowing your account.
Lot Size Fixed lot size applied to every trade. The default is 0.01 — start there. If you're using a percentage-based money management approach, you'll need to calculate the equivalent lot size manually and enter it here. The EA doesn't include auto-lot sizing based on account balance.

5. IMPORTANT NOTES & WARNINGS

Known Limitations

Issue Explanation
No Martingale or Grid Logic This EA opens one trade per signal and does not average into losing positions. That's a feature, not a bug — but if you're used to martingale EAs, you'll need to adjust your expectations. Drawdowns are limited to the stop loss on each individual trade.
Single Chart Dependency All trading happens from one chart. If you close the chart or remove the EA, all open positions remain but no new trades will be opened. Make sure your terminal stays running if you want continuous monitoring.
No Time Filter The EA doesn't include a built-in time filter to avoid trading during low liquidity periods or news events. If you want to restrict trading hours, you'll need to manage that externally — either by only attaching the EA during certain hours or by using a VPS with scheduled start/stop.
Backtest Speed with Many Pairs If you include 20+ pairs in the symbol list, backtests will be noticeably slower because the EA loads and processes data for each symbol on every tick. For faster testing, limit your symbol list to 5-10 pairs and use the "Every tick" mode only when necessary.
Divergence Strategy Requires Sufficient Bars Strategy 7 (divergence) needs enough historical bars to calculate lookback and distance parameters. On very short timeframes like M1, you might not get reliable divergence signals. Stick to M15 and above for divergence trading.

Settings Beginners Should NOT Change

Setting Why to Leave Default
Fast EMA Period (12) This is the standard MACD fast period. Changing it alters the sensitivity of the entire MACD calculation. Unless you have a specific reason (e.g., you're trading very short timeframes and want faster signals), leave it at 12.
Slow EMA Period (26) Together with the fast period, this defines the MACD's trend-following character. Changing it without adjusting the fast period can produce erratic signals. Stick with 26 until you've logged at least 100 trades with the default.
Signal SMA Period (9) This controls the smoothness of the signal line. A lower value gives more signals but more false ones; a higher value reduces signals but may miss entries. The 9-period default is a well-tested compromise.
Macd Applied Price (PRICE_CLOSE) Using anything other than close price introduces complexity in backtesting because open/high/low are less consistent across different brokers. Close price is the most reliable and widely used.
Divergence Lookback Bars (50) This is a sensible default for most timeframes. Reducing it too much (e.g., to 10) will catch tiny, insignificant divergences. Increasing it too much (e.g., to 200) will make the EA look too far back and miss recent setups.

Dashboard Usage Tips

  1. Start with a small symbol list: Don't add 20 pairs right away. Begin with 5-6 major pairs (EURUSD, GBPUSD, USDJPY, AUDUSD, USDCAD, NZDUSD) and add more once you're comfortable with the EA's behavior.
  2. Use the same timeframe on the chart as your strategy: If you're using an H1 strategy, attach the EA to an H1 chart. The EA reads the current chart timeframe for its calculations, so mismatched timeframes will produce unexpected signals.
  3. Monitor the Experts tab: The EA prints trade details and errors to the Experts tab in the terminal. Check it regularly, especially during the first few days of live trading, to catch any configuration issues early.
  4. Don't mix strategies mid-test: When backtesting, stick with one entry strategy for the entire test period. Switching strategies halfway through invalidates your results because you're comparing apples to oranges.
  5. Use hidden SL/TP with caution on volatile pairs: Pairs like GBPJPY or USDZAR can gap through your hidden stop loss, resulting in a larger loss than expected. Consider using broker-side stops (HIDDEN_SL_TP = false) for these pairs.
  6. Log your trades manually for the first month: Even though the EA tracks everything, keep a separate journal of why each trade was taken. This helps you identify which strategies work best for your personality and schedule.

Quick Start Guide

Follow these steps to get started in under 5 minutes:

  1. Download and install: Purchase the EA from the MQL5 Market and install it via the Tools menu in MetaTrader. Restart your terminal after installation.
  2. Attach to a chart:

    Installation Guide for MQL Products | Updating Purchased MQL Products on MT4/MT5 | General Troubleshooting Guide | Backtest and Set Files

    Check all my products: https://www.mql5.com/en/users/biswait50/seller

    Contact me for support: https://www.mql5.com/en/users/biswait50