Moving Average Crossover STRATEGY EA MT4/MT5 Settings/Inputs Guide

Moving Average Crossover STRATEGY EA MT4/MT5 Settings/Inputs Guide

20 June 2024, 09:15
Biswarup Banerjee
0
3 126

Complete User Documentation — MT4 & MT5

1. OVERVIEW

The Moving Average Strategy Multicurrency EA is a fully automated trading robot that scans multiple currency pairs from a single chart and executes trades based on customizable moving average crossover and price-relative strategies. It uses two moving averages (fast and slow) across any timeframe, with seven distinct entry and exit logics, plus optional ATR-based trailing stops, grid recovery, and trend filter gating. This EA solves the problem of manually monitoring multiple pairs for MA signals — it does the scanning, signal generation, and trade execution for you, all in one place.

Who Should Use It: Retail forex traders who want a systematic, multi-pair moving average strategy without having to sit in front of the screen all day. It's especially useful for those who trade breakouts or trend-following systems and need consistent execution across several instruments.

Main Benefit: Automates your MA-based trading across up to 28 currency pairs simultaneously, with flexible entry/exit logic, built-in risk controls, and a full suite of trailing stop and breakeven features — all configurable from a single 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 the EA's core behavior — how it displays virtual stop levels, manages group-level risk, includes swap in profit calculations, and records historical data for backtesting.

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 are placed. Useful for visual verification during live trading, but it's automatically disabled during optimization to avoid clutter and speed up runs. Set to true when you first run the EA to confirm your SL/TP levels are where you expect them, then switch back to false for normal operation.
Group Stoploss Amount double 0 Sets a maximum total loss in account currency for all open trades across all symbols. Once the combined floating loss hits this value, the EA closes all positions. This is a portfolio-level risk limit, not per-trade. Set to 500 if you want to cap total drawdown across all pairs at $500. Leave at 0 to disable.
Include Swap charges in Profit bool true When true, the EA factors in overnight swap fees when calculating total profit for breakeven and trailing stop activation. This gives a more accurate picture of real P&L, especially for long-held positions. Keep enabled (true) if you hold trades overnight regularly. Disable if you only scalp intraday and want to ignore swap effects.
Enable history for backtests or optimization bool false When enabled, the EA records trade history and performance metrics during backtests or optimization runs. This is essential for analyzing results but adds overhead, so it's turned off by default for live trading. Set to true before running an optimization in the Strategy Tester. Keep false during live trading to save resources.

Atr Trailingstop Settings

These settings configure an adaptive trailing stop based on the Average True Range indicator, which adjusts the stop distance automatically to market volatility.

Setting Name Type Default Value Description Example
Use ATR Trailing Stop bool false Master switch for the ATR-based trailing stop. When enabled, the EA will trail the stop loss using ATR values instead of a fixed pip distance. This adapts to changing volatility — wider stops in volatile markets, tighter in calm ones. Enable (true) if you trade pairs with varying volatility like GBP/JPY. Disable if you prefer a fixed pip trailing stop.
ATR Timeframe ENUM PERIOD_CURRENT Selects the timeframe used to calculate the ATR value. Using a higher timeframe (e.g., H1) gives a smoother, more stable trailing stop, while the current chart timeframe reacts faster to recent price action. Set to PERIOD_H1 for a medium-term trailing stop that ignores short-term noise. Use PERIOD_CURRENT for tighter, more responsive stops.
ATR Period int 14 The number of bars used to calculate the ATR. A lower period (e.g., 7) makes the trailing stop more sensitive to recent volatility spikes, while a higher period (e.g., 21) smooths out the ATR for a more consistent stop distance. Use 14 as a balanced default. Increase to 21 if you find the stop getting triggered too often by short-term volatility.
Activation (ATR multiplier) double 2.0 The profit level (in ATR units) that must be reached before the trailing stop kicks in. For example, a value of 2.0 means the trade must be 2 ATRs in profit before trailing begins. This prevents premature trailing on small moves. Set to 1.5 for earlier activation on trending pairs. Use 3.0 for a more conservative approach that lets profits run further before tightening.
Trail distance (ATR multiplier) double 1.0 The initial distance of the trailing stop behind the current price, measured in ATR units. A value of 1.0 means the stop is placed 1 ATR away from the price. Smaller values give a tighter stop but risk early exit. Use 0.8 for a tight trail on fast-moving pairs like USD/JPY. Use 1.5 for wider stops on slower pairs like EUR/CHF.
Trail increment (ATR multiplier) double 0.5 How much the trailing stop moves each time price advances in your favor, measured in ATR units. A value of 0.5 means the stop moves up by 0.5 ATR for every 1 ATR of favorable price movement. Higher values make the trail more aggressive. Set to 0.3 for a conservative trail that locks in profits slowly. Use 0.7 for a more aggressive trail that captures trends quickly.

Grid Settings

This setting controls a grid recovery feature that attempts to close all open trades on a symbol when the combined profit reaches a target.

Setting Name Type Default Value Description Example
Recover profit from all grid trades bool false When enabled, the EA monitors the total profit of all open trades on a symbol. If the combined profit reaches a positive level (defined elsewhere), it closes all trades on that symbol. This is useful for grid or martingale strategies where you want to exit all positions at once when in profit. Enable (true) if you run a grid strategy and want to close all EURUSD trades when the net profit hits $50. Leave disabled for standard single-trade strategies.

Safeguard Settings

These settings provide safety limits for drawdown, minimum performance thresholds, and inactivity checks — primarily useful for backtesting and optimization to filter out poor strategies.

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 equity drops below this level, the EA stops trading and closes all positions. This is a hard safety stop to protect your account from catastrophic losses. Set to 20 to stop trading if equity falls 20% below starting balance. Leave at 0 to disable this safeguard.
Minimum Profit Percent [backtesting only] [0: disable] double 0 During backtesting, this setting rejects any optimization run that doesn't achieve at least this percentage of profit. Useful for quickly filtering out underperforming parameter sets without manually reviewing each result. Set to 10 to only keep optimization results with at least 10% profit. Leave at 0 to accept all results.
Minimum Trades [backtesting only] [0: disable] double 0 During backtesting, this setting rejects any optimization run that doesn't execute at least this many trades. This helps avoid overfitting on a few lucky trades and ensures the strategy has enough sample size to be statistically meaningful. Set to 50 to only keep results with 50+ trades. Leave at 0 to accept all trade counts.
Max inactive days [backtesting only] [0: disable] int 0 During backtesting, this setting rejects optimization runs where the EA goes too long without opening a trade. This helps filter out strategies that only trade in specific market conditions and might not be robust enough for live trading. Set to 30 to reject any run where the EA doesn't trade for 30 consecutive days. Leave at 0 to disable.

Ma Settings

These settings define the first moving average used in the strategy — its timeframe, calculation method, period, shift, and applied price.

Setting Name Type Default Value Description Example
Ma 1 Timeframe ENUM PERIOD_CURRENT Selects the timeframe on which the first moving average is calculated. You can use a different timeframe than the chart's own, allowing multi-timeframe analysis. For example, you could trade on M15 but base your MA signals on H1. Set to PERIOD_H1 if you want the fast MA to react to hourly price action while trading on a lower timeframe chart.
Ma 1 Mode ENUM MODE_EMA Determines the calculation method for the first moving average. EMA gives more weight to recent prices and reacts faster, while SMA treats all prices equally and is smoother. Your choice affects how quickly signals are generated. Use MODE_EMA for a fast-moving average that catches trends early. Switch to MODE_SMA for a smoother line that filters out noise.
Ma 1 Period int 10 The number of price bars used to calculate the first moving average. A shorter period (e.g., 5) makes the MA more sensitive to recent price changes, generating earlier signals but with more false positives. Longer periods (e.g., 20) are smoother but lag more. Use 5 for a very fast MA on M1 scalping. Use 20 for a slower MA on H1 swing trading.
Ma

3. HOW IT WORKS

Core Calculation & Logic

This EA monitors up to 28 currency pairs simultaneously from a single chart, calculating two moving averages per symbol on the timeframes you select. It compares the fast MA (Ma 1) against the slow MA (Ma 2) to detect crossovers — the classic moving average crossover technique. When the fast MA crosses above the slow MA, the EA considers that a bullish condition; a cross below is bearish. The scanner then aggregates these signals across all symbols and timeframes you've enabled, displaying them on a color-coded dashboard so you can spot opportunities at a glance.

The mathematical basis is straightforward: each moving average is computed using the period, mode (SMA, EMA, SMMA, or LWMA), and applied price you specify. The EA uses the standard iMA() function internally, so the calculations match what you'd see on a regular chart. What makes this tool powerful is the multi-symbol, multi-timeframe scanning — it's like having 28 charts open at once, each running its own MA crossover check, with results consolidated into one screen.

Entry Strategies Explained

The EA offers three distinct entry strategies based on how the two moving averages interact. Each strategy detects a different market condition, so you can pick the one that matches your trading style.

Strategy 1 — Fast MA Cross Above/Below Slow MA (Standard Crossover)

BUY Signal: The fast MA (Ma 1) crosses above the slow MA (Ma 2) on the current bar. This indicates upward momentum is building — the shorter-term average is now higher than the longer-term average, suggesting buyers are in control.

SELL Signal: The fast MA crosses below the slow MA. This signals that sellers are gaining strength, and a downtrend may be starting.

Best For: Trending markets where price moves in clear directional swings. Avoid using this in choppy, sideways markets — you'll get whipsawed.

Strategy 2 — Price Close Relative to Fast and Slow MA

BUY Signal: The current bar's close price is above both the fast MA and the slow MA. This confirms that price is trading above both averages, indicating strong bullish momentum.

SELL Signal: The close price is below both MAs. This confirms bearish pressure — price has broken below both support levels.

Best For: Trend-following traders who want confirmation that price has already committed to a direction, not just a crossover that might reverse.

Strategy 3 — Fast MA Position Relative to Slow MA (No Crossover Required)

BUY Signal: The fast MA is currently above the slow MA, regardless of whether a crossover just happened. This is a "state" check rather than an "event" check — as long as the fast MA remains above, the signal stays bullish.

SELL Signal: The fast MA is below the slow MA. The signal persists until the relationship flips.

Best For: Traders who want to stay in a trend as long as the MA alignment holds, ignoring minor crossovers that might be noise.

Step-by-Step Workflow

Step 1: Attach the EA to a chart. Open any currency pair chart (EURUSD works fine), drag the EA onto it. You'll see the dashboard appear immediately. The EA doesn't need to be on a specific pair — it scans the symbols you list in the settings.

Step 2: Configure your symbol list. In the GENERAL SETTINGS section, find the SYMBOLS input. By default it's set to EURUSD,GBPUSD,USDCHF . Add or remove pairs as needed, separated by commas. You can include up to 28 symbols.

Step 3: Set your moving average parameters. Go to the Ma Settings and Ma 2 Settings sections. Choose the timeframe, mode (EMA, SMA, etc.), period, shift, and applied price for each MA. For a standard crossover system, try Ma 1 at 10 EMA on the current timeframe and Ma 2 at 30 EMA on the same timeframe.

Step 4: Select your entry strategy. Under Strategy Settings, pick Ma Entry Strategy — choose from the three options described above. Start with Strategy 1 (standard crossover) if you're new to this EA.

Step 5: Configure risk management. Set your lot size, stop loss, and take profit in the GENERAL SETTINGS section. If you're unsure, leave stop loss and take profit at 0 (no SL/TP) and just use a small lot size like 0.01 for testing.

Step 6: Enable or disable auto-trading. The dashboard shows signals, but the EA won't trade automatically unless you've enabled auto-trading in the EA settings (look for a parameter like Enable Auto Trading or similar). For manual trading, just use the signals as entry ideas.

Step 7: Monitor the dashboard. The color-coded cells tell you at a glance which pairs and timeframes have active signals. Green typically means bullish, red means bearish, and gray means no signal. Click on a cell to open a chart for that pair.


4. RISK MANAGEMENT FEATURES

This EA includes several risk control options to protect your account, from basic stop-loss placement to group-level loss limits. All settings are in the GENERAL SETTINGS section.

Feature Description
Stoploss and Takeprofit Mode Choose how SL/TP is calculated: in pips, as a fixed amount, as a percentage of account equity, or as a group-level amount/percentage. The default is Amount mode, which lets you set exact dollar values for SL and TP.
Hidden SL/TP When enabled (HIDDEN_SL_TP=true), the stop loss and take profit are not visible on the broker's server — they're managed internally by the EA. This prevents other traders from seeing your levels. You can still display virtual lines on the chart with SHOW_HIDDEN_SL_TP_LINES.
Group Stop Loss / Take Profit Set a maximum loss or profit target for the entire group of positions opened by the EA. For example, if GROUP_STOPLOSS_AMOUNT is 100, the EA will close all positions if the total loss across all pairs reaches $100. Useful for limiting portfolio risk.
Risk-Reward Ratio The RISK_REWARD_R parameter lets you set a fixed risk-reward ratio. For instance, a value of 2 means the take profit is twice the stop loss distance. This overrides individual TP settings if you prefer a consistent ratio across all trades.
Lot Size Fixed lot size applied to every trade. Start with 0.01 for testing. You can later scale up, but the EA does not include dynamic lot sizing based on account balance — that's a manual adjustment.

5. IMPORTANT NOTES & WARNINGS

Known Limitations

Issue Explanation
No hedging or netting logic The EA opens trades based on signals without checking if you already have an opposite position on the same pair. In a hedging account this could open conflicting trades; in a netting account it may partially close your existing position. Always check your broker's position management type.
Dashboard refresh delay The dashboard updates on every new tick, but if you're scanning many pairs (e.g., 28) across multiple timeframes, there can be a noticeable lag — especially on slower VPS or older machines. Reduce the number of symbols or timeframes if the interface feels sluggish.
No trade filtering by day or time The EA will generate signals 24/5 based purely on MA crossovers. There's no built-in filter to avoid trading during news events, low liquidity periods, or specific session times. You'll need to manually disable the EA or use external tools for that.
Hidden SL/TP not supported by all brokers Some brokers do not allow hidden stop orders or may have restrictions on virtual SL/TP. Test this feature on a demo account first. If the EA fails to close a position at your hidden level, check the journal for error messages.

Settings Beginners Should NOT Change

Setting Why to Leave Default
SLTP_MODE The default AMOUNT mode is the most intuitive — you set exact dollar values for SL and TP. Switching to PIPS or PERCENT without understanding the math can lead to unintended risk levels, especially if you're trading multiple pairs with different pip values.
HIDDEN_SL_TP Setting this to false exposes your SL/TP levels to the broker and other market participants. For beginners, it's safer to keep them hidden — you avoid giving away your strategy and prevent potential stop-hunting by market makers.
GROUP_STOPLOSS_AMOUNT The default is 0, meaning no group-level stop loss. If you set this too low (e.g., $10), the EA might close all your positions prematurely during normal drawdown. Leave it at 0 until you understand how your strategy performs across multiple pairs.
RISK_REWARD_R This overrides your individual TP setting. If you set it to 3 but your stop loss is 20 pips, the EA will target 60 pips — which might be unrealistic for the timeframe you're trading. Stick with manual SL/TP until you've backtested a specific ratio.

Dashboard Usage Tips

  1. Use the color coding to prioritize: Green cells indicate bullish signals, red for bearish. If you see multiple green cells across different timeframes for the same pair, that's a strong confluence signal — consider it a higher-probability trade.
  2. Click cells to jump to charts: The dashboard is interactive. Clicking on any cell opens a new chart for that symbol and timeframe. This saves you from manually searching for pairs in the Market Watch.
  3. Reduce timeframes for speed: If you're scanning 28 pairs on 9 timeframes, that's 252 calculations per tick. For live trading, limit timeframes to 3-4 (e.g., M15, H1, H4, D1) to keep the dashboard responsive.
  4. Ignore signals during low liquidity: The EA doesn't filter by session. Be cautious of signals generated during the Asian session overlap or just before major news — crossovers during low volume are more likely to be false.
  5. Use the dashboard as a screener, not a signal generator: The EA is excellent for identifying which pairs are showing MA crossovers, but don't blindly enter every signal. Check the overall trend on a higher timeframe first. A bullish crossover on M15 means little if the daily chart is in a strong downtrend.
  6. Reset the dashboard if it freezes: Occasionally, after many hours of running, the dashboard may stop updating. Simply remove and re-attach the EA to the chart. This clears the objects and refreshes the display.

Quick Start Guide

Follow these steps to get started in under 5 minutes:

  1. Attach the EA to any chart: Open EURUSD M15, drag the EA from the Navigator onto the chart. A dashboard will appear — don't worry if it looks empty at first.
  2. Set your symbol list: Go to EA properties (F7), find SYMBOLS under GENERAL SETTINGS. Type the pairs you trade, separated by commas: EURUSD,GBPUSD,USDJPY,AUDUSD . Click OK.
  3. Choose your moving averages: In the same properties window, scroll to Ma Settings. Set Ma 1 Period to 10, Ma 1 Mode to EMA. Then in Ma 2 Settings, set Ma 2 Period to 30, Ma 2 Mode to EMA. Leave everything else default.
  4. Select an entry strategy: Under Strategy Settings, set Ma Entry Strategy to ENTRY_STRATEGY1 (standard crossover). This is the most straightforward option for beginners.
  5. Set a small lot size: In GENERAL SETTINGS, change LOTS to 0.01. Set STOPLOSS and TAKEPROFIT to 0 for now — you'll add them later once you're comfortable.
  6. Enable auto-trading (optional): If you want the EA to trade automatically, look for an Enable Auto Trading parameter (may be named differently in your version). Set it to true. Otherwise, just use the dashboard for manual signals.
  7. Monitor and adjust: Watch the dashboard for 10-15 minutes. You'll see cells turn green or red as crossovers occur. Click on a green cell to open that pair's chart and decide if you want to take the trade manually.
  8. Run a backtest first: Before going live, test the EA in the Strategy Tester with your chosen settings. Use "Every tick" mode for accuracy. Pay attention to drawdown — if it's more than 20%, reduce your lot size or tighten your stop loss.


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