Traadence's Automated Forex Trading Program is a MetaTrader 5 Expert Advisor built specifically for XAUUSD. It turns a medium-risk ruleset into repeatable execution through volatility-qualified entries, equity-based lot sizing, broker-aware stop placement, and automatic shutdowns when spread or daily loss thresholds are breached.
A Gold EA should execute defined rules consistently, preserve state through terminal interruptions, and refuse trades when market or account conditions fall outside its limits.
XAUUSD Execution Without Manual Guesswork
A reliable Gold EA does not predict gold. It converts defined market conditions into orders and enforces risk limits consistently. This build checks trend direction, ATR regime, current spread, trading session, open exposure, and account drawdown before any entry is allowed. Every accepted order is submitted with a stop loss and take profit, while one-position logic prevents accidental stacking.
Gold can shift quickly between quiet consolidation and event-driven expansion. The World Gold Council's Gold Demand Trends documents changing participation across investment, central-bank, and consumer demand, while CME Gold market specifications show why tick value and contract details must be read precisely. The EA therefore uses live symbol properties instead of hard-coded pip assumptions.
Core Features
| Feature | Description |
|---|---|
| Volatility-qualified entries | False signals increase when XAUUSD changes regime. The entry engine combines trend direction, pullback structure, and ATR boundaries, then blocks signals during abnormal expansion or dead-market conditions. |
| Equity-based position sizing | Fixed lots create inconsistent account exposure. The risk module calculates volume from account equity, stop distance, tick value, and broker lot steps; the medium preset defaults to 0.50% planned risk per trade. |
| Daily equity loss governor | Unattended systems can keep firing after conditions deteriorate. New entries stop after a configurable daily equity decline, set to 2.00% in the supplied preset, and require the next session or manual re-arming. |
| Broker-aware order validation | Gold symbols vary by suffix, digits, minimum volume, and stop distance. Runtime checks normalize XAUUSD mapping, price precision, freeze levels, and permitted lot increments before an order reaches the server. |
| Spread, session, and cooldown gates | Rollover spreads and clustered re-entry can distort a strategy's intended behavior. The EA trades only inside configured hours, rejects excessive spread, and waits 30 minutes after a stopped position. |
| Restart-safe state recovery | Terminal restarts can create duplicate orders or forgotten limits. Magic-number tracking, terminal state variables, and persisted session counters reconstruct exposure and daily loss status before trading resumes. |
| Bracketed execution and audit logs | Missing protection or unclear execution history makes live diagnosis difficult. Each trade is submitted with protective levels, while decisions, rejections, fills, and parameter values are written to CSV logs. |
Trading Robot App Architecture
The delivered trading robot app runs inside MetaTrader rather than as a separate phone application. Its chart panel exposes ARM EA, PAUSE, current spread, session status, daily equity change, active risk, and the reason a signal was accepted or rejected.
The execution layer is written in MQL5 because its event model, symbol functions, and trade operations run directly in the terminal. Strategy, risk, execution, state, and interface modules are separated so a new entry model can be added without rewriting daily-loss protection or broker validation.
OTC currency feeds are decentralized, as reflected in the BIS Triennial Central Bank Survey. That market structure is why the adapter reads contract size, tick value, trading sessions, and stop constraints from the connected broker at startup instead of assuming one universal XAUUSD specification.
Medium-risk preset
RiskPercent=0.50
DailyEquityStopPercent=2.00
MaxOpenPositions=1
UseSessionFilter=true
CooldownMinutes=30
RequireProtectiveStops=true
Performance Benchmarks
Release testing measures execution correctness and risk behavior, not a promised return. Historical evaluation uses the MetaTrader 5 Strategy Tester with real-tick data where available, at least 36 months of history, a 70/30 development-to-out-of-sample split, and rolling walk-forward windows.
| Benchmark | Method | Release gate |
|---|---|---|
| Deterministic replay | Run the same symbol, tick set, preset, and date range 10 times. | Identical entry and exit timestamps across all runs. |
| Duplicate-order protection | Force 100 terminal restarts and connection interruptions around signal events. | Zero duplicate positions for the same magic number and signal ID. |
| Position-size accuracy | Test 1,000 combinations of equity, stop distance, tick value, and lot step. | Calculated exposure remains within 0.02 percentage points of the configured target after broker rounding. |
| Risk-gate enforcement | Inject spread spikes, session closures, daily-loss breaches, and existing exposure. | Every disallowed case is rejected and logged before order submission. |
| Forward observation | Run the release candidate on a broker demo feed for 20 trading days. | No unhandled trade errors, orphaned stops, or state mismatch after restart. |
Optimization is constrained to parameters that have a defensible trading purpose; broad brute-force searches are rejected when nearby settings collapse out of sample. Test reports retain trade lists, drawdown paths, rejected-signal counts, and parameter versions. The MetaTrader testing report provides the baseline statistics, while live logs explain what the tester cannot show about broker rejections and reconnects.
Use Cases
- Run a defined XAUUSD method during selected sessions without manually calculating volume, stop distance, or whether current spread exceeds the strategy's operating limit.
- Keep medium-risk behavior consistent across brokers by reading symbol suffixes, tick values, stop levels, and lot increments before each order.
- Validate a parameter revision on historical and untouched data before promoting the same versioned preset to demo and then live execution.
- Investigate a missed or rejected trade from CSV evidence showing the signal state, risk check, spread, session, and server response.
- Extend the entry logic while preserving tested order routing, daily-loss controls, state recovery, and chart-panel behavior.
Project Directory
gold-ea/
├── src/
│ ├── GoldEA.mq5
│ ├── core/
│ │ ├── Config.mqh
│ │ ├── Logger.mqh
│ │ ├── StateStore.mqh
│ │ └── SymbolAdapter.mqh
│ ├── strategy/
│ │ ├── TrendFilter.mqh
│ │ ├── VolatilityFilter.mqh
│ │ └── EntryEngine.mqh
│ ├── risk/
│ │ ├── PositionSizer.mqh
│ │ ├── DailyLossGuard.mqh
│ │ └── ExposureGuard.mqh
│ ├── execution/
│ │ ├── OrderRouter.mqh
│ │ ├── BracketManager.mqh
│ │ └── RetryPolicy.mqh
│ └── ui/
│ └── ControlPanel.mqh
├── presets/
│ ├── medium-risk.set
│ └── broker-template.set
├── tests/
│ ├── strategy-tester.ini
│ ├── walk-forward.csv
│ └── restart-recovery-cases.csv
├── docs/
│ ├── INSTALL.md
│ ├── OPERATIONS.md
│ ├── PARAMETER_REFERENCE.md
│ ├── TESTING_METHOD.md
│ └── CHANGELOG.md
├── reports/
│ └── sample-session.csv
└── build/
└── GoldEA.ex5
The package includes source, compiled release, one medium-risk preset, broker mapping template, tester configuration, operating notes, and sample logs. Teams needing broker-specific changes or a new signal module can use our trading robot app customization; deployment and monitoring are covered through ongoing EA support.
How to Automate XAUUSD Trades Using Traadence's Automated Forex Trading Program
Download & Set Up the Project
Download, set up, and install Traadence's Automated Forex Trading Program to get the project running. If you hit any difficulty, contact us here.
Open the Control Panel
Attach GoldEA.ex5 to the XAUUSD chart, enable Algo Trading, and confirm the panel shows broker symbol, spread, and session state.
Load Risk Controls
Choose the Medium preset, then set risk percent, daily equity stop, maximum spread, trading hours, cooldown, and allowed direction before saving.
Arm and Review Output
Press ARM EA; the panel validates conditions, submits protected orders, writes execution logs, and exports the session summary to reports/session.csv.
Automated execution cannot remove market risk. The CFTC forex advisory explains why users should verify broker status, understand leverage, and reject any software claim that implies certain returns.
Questions
What does an Expert Advisor do in forex trading?
An Expert Advisor is terminal-based software that evaluates market and account conditions, then manages orders according to coded rules. In this build, the EA handles XAUUSD entries, position sizing, protective stops, daily-loss limits, state recovery, and execution logging; it does not make discretionary judgments or guarantee an outcome.
How do I install and activate the Gold EA?
Place the compiled GoldEA.ex5 file in the terminal's Experts directory, restart or refresh the Navigator, attach it to an XAUUSD chart, and load medium-risk.set. Enable Algo Trading only after the panel confirms the mapped symbol, valid trading session, acceptable spread, and active protection settings.
How should I verify that the Gold EA works reliably?
Verify it with repeatable tests rather than a single equity curve. Review out-of-sample results, walk-forward stability, restart and reconnect cases, position-size calculations, rejected-order handling, and at least 20 trading days on a demo feed before considering live use.
How does forex volatility affect the Gold EA?
Volatility changes both signal quality and the stop distance needed to express the same risk. The EA uses ATR boundaries to reject unusually quiet or expanded conditions, recalculates volume from the resulting stop distance, and still blocks entries when spread exceeds the configured limit.
Should the Gold EA run on a forex VPS?
A VPS is useful when the terminal must remain online during the configured trading sessions and the local computer cannot provide stable power or connectivity. Choose a host near the broker's server, keep automatic terminal restarts enabled, and confirm the EA restores state before re-arming after maintenance.
