From trading idea to running Expert Advisor — the proven 5-step path on MT5
Click any block to expand details
Automating a XAUUSD trading strategy is one of the most valuable decisions a systematic trader can make — and one of the most underestimated in complexity. Most traders who attempt it from scratch discover that the hard part is not the code; it is the strategy definition. You cannot automate a vague idea. Every rule — entry, exit, stop loss, position size, session window — must be expressed in precise, programmable terms before a single line of MQL5 is written.
This guide covers the full 5-step path: strategy definition, MQL5 coding, MT5 backtesting, VPS deployment, and live monitoring. It also covers the alternative — purchasing a proven EA with a verified live track record — and when that alternative is the smarter choice for most traders.
If you are specifically considering hiring someone to build your EA, our dedicated guide covers the 6-section brief, what to pay, and how to evaluate developer quality. If you already have a running EA and want to know how to track it from anywhere, our remote monitoring guide is the next logical read.
On a standard lot (100 oz), 1 pip = $10. On a 0.01 lot (1 oz), 1 pip = $0.10. XAUUSD moves 100–300 pips per day, meaning position sizing errors have larger absolute consequence than on EUR/USD.
XAUUSD's tradeable range is concentrated in London (07:00–11:00 UTC) and NY (13:00–17:00 UTC) sessions. An EA without a session filter will enter trades during the low-volume Asian session when spreads widen and false breakouts dominate.
USD-denominated news events — NFP, FOMC, CPI — cause XAUUSD spike moves of 30–120 pips in under 5 minutes. An EA without a spread filter or news filter will enter during these spikes at widened spreads and unfavourable fills.
These three factors mean that a XAUUSD EA requires additional logic layers beyond what works for major forex pairs: a session window filter, a spread threshold filter (pause trading if spread exceeds X), and ideally a news event filter (pause 15 minutes before and after high-impact USD events). Whether XAUUSD is good for automated trading overall is addressed in detail in our assessment guide — the short answer is yes, with these filters in place.
The most common reason XAUUSD automation projects fail is not the code — it is the strategy definition. A strategy described as "buy gold when it looks like it is going up based on momentum and the trend" cannot be coded. A developer cannot translate "looks like" into machine logic. Before engaging any developer or writing any MQL5, you must define all four of the following:
An exact, unambiguous condition. Example: "Open a buy when the closing price of the M15 candle crosses above the 20-period EMA and the H4 200 EMA slope is positive." The entry must reference specific indicators with specific periods on specific timeframes. A concept ("buy on breakout") is not enough; you need the trigger condition ("buy when price closes above the high of the previous 4-hour candle").
How the trade closes in profit — not just "when it looks good." Options: fixed pip TP (e.g. 40 pips), ATR multiple TP (e.g. 2× the 14-period H1 ATR at entry), time-based exit (close at 16:00 UTC regardless of P&L), or trailing stop exit (activate trailing at 20 pips profit, trail by 10 pips). All four can work; none can be left vague.
Fixed (e.g. 20 pips), ATR-based (e.g. 1.5× ATR), or structure-based (e.g. below the swing low of the last 5 candles). The choice affects position sizing calculations — your risk per trade in $ must remain constant regardless of SL size, which means lot size must be calculated dynamically when using ATR-based stops.
When is the EA allowed to open new trades? Minimum: specify UTC time range (e.g. 07:00–16:00 UTC). Better: separate London window (07:00–11:00) and NY window (13:00–16:00) with an overlap gap (11:00–13:00 excluded due to lower volume). This is the single most effective risk management tool for XAUUSD automation — more impactful than SL size adjustment.
The Readiness Test
Write your strategy in one paragraph, including all four parameters above, without using the words "looks like," "seems," "appears," "momentum," or "usually." If you can do this, your strategy is ready to code. If you cannot, spend more time on strategy definition before engaging a developer or starting MQL5 work — it will save you weeks of revision cycles.
Once your strategy is defined, you have three coding paths. Each has a different time, cost, and quality profile:
Cost
$0 + your time
Time
30–90 days
Best for: Traders with programming background
Tip: MQL5.com has free EA templates and a community forum. Start with a simple version (entry + fixed SL/TP only) and add complexity after the base logic is tested.
Cost
$200–$2,000
Time
2–6 weeks
Best for: Traders with defined strategy and limited coding time
Tip: Post a detailed brief (the 4 parameters plus any special logic). Budget $400–$800 for a solid XAUUSD EA with full risk management, spread filter, and session filter.
Cost
Fixed one-time fee
Time
Hours after purchase
Best for: Traders who want live edge now, not after 6 months
Tip: The Pro-Scalper EA range covers session breakout (Goldie Sniper), H1 breakout (Goldie Razor V2), M15 breakout with H4 filter (Goldie Razor V2.8.4), low-frequency sniper (Blind Sniper X PRO), and semi-manual (Hybrid Scalper).
MT5 Strategy Tester is one of the most powerful backtesting environments available to retail traders — and one of the most abused. The two critical settings are mode ("Every tick based on real ticks" — not modelled ticks) and test period (minimum 5 years, 2020–2025 for XAUUSD to capture both trending and ranging market conditions).
Walk-forward testing is non-negotiable for any XAUUSD EA you intend to trade with real money. Optimize parameters on the first 60–70% of your test period (e.g. 2020–2023). Then run the strategy with those locked parameters on the remaining 30–40% (e.g. 2024–2025) — data the strategy has never seen. If performance drops by more than 30%, the strategy is overoptimized.
A VPS (Virtual Private Server) is a remote Windows computer that runs your MT5 and EA continuously, even when your own PC is off. This is the infrastructure layer that makes automated trading genuinely passive.
Choose a VPS provider
Contabo, Vultr, or AWS Lightsail. Select London or New York location for lowest latency to gold ECN brokers. Minimum spec: 2 vCPU, 4GB RAM, Windows Server 2019.
Install MT5
Download the MT5 installer from your broker's website. Install on the VPS via Remote Desktop Connection. Log in with your live account credentials.
Deploy your EA
Copy your .ex5 file to the VPS via Remote Desktop file transfer (drag and drop into the MQL5/Experts folder). Restart MT5 and the EA will appear in the Navigator panel.
Attach and configure
Drag the EA onto the XAUUSD chart at the correct timeframe. In properties, confirm AutoTrading is enabled globally (the AutoTrading button is green). Set your input parameters.
Mobile alerts
In MT5 settings, enter your MetaQuotes ID (from the MT5 mobile app) to receive push notifications on your phone when trades open, close, or when an alert fires.
⚠ Run on demo first
Always run your EA on a demo account for a full 30 days after VPS deployment before switching to live. This catches timing issues, settings errors, and environment differences (broker latency, requote behavior) before they cost real money.
Automation does not mean zero attention. It means dramatically less attention — structured around specific checks at specific intervals, rather than continuous screen-watching. Our overnight EA monitoring guide covers the full system for hands-off monitoring; below is the essential structure.
When to pause your EA
Pause immediately (before investigating) if: live profit factor drops more than 30% below the backtest value, live drawdown exceeds the maximum backtest drawdown by more than 50%, or the EA has produced more than 5 consecutive losses in a period where the backtest shows fewer than 2 average consecutive losses. Pausing is not failure — it is correct protocol. Investigate the cause before resuming.
For most traders, purchasing a proven EA with a verified live track record is faster, cheaper, and less risky than building from scratch. Here is the honest comparison with numbers:
Automation is widely misunderstood. The EA does not replace your role as a trader — it replaces the repetitive, real-time execution component of trading. You still make the high-level decisions that matter:
Automation removes the worst aspects of trading (emotional decisions, fatigue, discipline lapses) while preserving the parts that require human judgment (strategy selection, risk settings, periodic review). That is why EAs are genuinely good for trading for the right trader profile — not because they guarantee profits, but because they enforce the rules you set more consistently than any human can maintain.
Hiring a developer
The 6-section brief and what to pay
XAUUSD automation suitability
Whether XAUUSD suits automated strategies before you build one
The case for EA trading
The evidence for EA trading before you invest in automation
Remote EA monitoring
Remote monitoring setup for when your EA goes live
Overnight EA watch system
The overnight watch system for your live automated strategy
Detecting overoptimization
Detecting overoptimization before you go live
Goldie Sniper, Goldie Razor V2 and V2.8.4, Blind Sniper, and Hybrid Scalper. Full suite for every market condition.
Not sure which EA fits your account size or trading style? Email us and we will help you choose.
Pro-Scalper EA Range
Session breakout · M1 · London & NY
High-frequency session breakout capturing London open and NY session momentum on the M1 timeframe.
Range breakout · M15 · H4 EMA filter
M15 range breakout with H4 200 EMA trend filter, 6-level trailing stop, and failed-breakout recovery.
H1 range breakout · proven track record
The original Goldie Razor — H1 breakout strategy with a long live track record on XAUUSD.
Triple-confirmation · low frequency
Low-frequency sniper requiring triple signal confirmation — fewer trades, higher per-trade selectivity.
Manual entry · automated exits
You control entries; the EA manages exits, trailing stops, and position management automatically.
Full Pro-Scalper suite
All five Expert Advisors at a bundle price — cover every market condition and trading style.
Goldie Razor V2.8.4
M15 breakout + H4 EMA filter — built for XAUUSD on MT5