Gold Regime Gated Breakout EA
- エキスパート
- バージョン: 2.20
- アクティベーション: 20
# Gold Regime-Gated Breakout EA — XAUUSD M5
**A trend-harvesting Expert Advisor for Gold, built to survive every market regime.**
Most Gold EAs look great on a rising market — then bleed your account dry the moment Gold goes sideways or pulls back. We know because we tested dozens of popular approaches across **9 years of real tick-count data (2017–2026)**, covering sideways ranges, the COVID crash, multi-year consolidation, AND explosive rallies. The vast majority failed.
This EA is the one that survived.
---
## How It Works (Without Giving Away the Secret)
The core philosophy is simple: **harvest explosive trend moves, sleep through everything else.**
The EA combines a **proprietary multi-condition entry gate** — requiring several independent confirmations to align simultaneously before opening a trade — with an **adaptive trailing stop** that lets winners run as far as the market will take them. There is no fixed Take Profit; exits are entirely managed by the trailing mechanism, which is calibrated to the market's own volatility at the time of entry.
What we CAN tell you:
- **Entry timeframe:** M5 (5-minute chart)
- **Multi-timeframe analysis:** The EA reads the **Daily (D1) chart** internally to confirm the broader trend regime before allowing any trade on M5. You only need to attach the EA to an M5 chart — it handles the D1 analysis automatically.
- **Direction:** Long-only (Buy). Gold has a strong historical upward bias; short-selling Gold on breakouts consistently underperformed across all test periods due to violent short-squeeze reversals.
- **One trade at a time.** No grid, no martingale, no averaging down. Ever.
- **Every trade has a Stop Loss** from the moment it opens. No exceptions.
---
## Backtest Performance — 9 Years, All Market Conditions
Tested on XAUUSD M5 data from **February 2017 to June 2026** — a period that includes everything:
| Period | Market Character | Result |
|---|---|---|
| 2017 | Range / recovery | ✅ Profitable |
| 2018 | Downtrend / range | ❌ Small loss (only losing year, −0.07R per trade) |
| 2019 | Steady uptrend | ✅ Profitable |
| 2020 | COVID crash + rally | ✅ Profitable |
| 2021 | Choppy consolidation | ✅ Profitable |
| 2022 | Rate-hike drawdown | ⚖️ Breakeven (−0.001R) |
| 2023 | Breakout begins | ✅ Profitable |
| 2024 | Strong rally | ✅ Profitable |
| 2025 | Continuation | ✅ Profitable |
| 2026 (YTD) | Explosive rally | ✅ Profitable |
### Key Numbers (full 9-year period, after spread + commission)
- **1,019 trades** (~110 per year, ~2 per week — not overtrading)
- **Profit Factor: 1.42**
- **Average reward per unit of risk: +0.23R per trade** (positive expectancy)
- **Average win: $1,215 / Average loss: $414** per lot — reward-to-risk ratio of approximately **2.9 : 1**
- **Win rate: 32.7%** — low win rate, but winners are nearly 3× larger than losers. This is classic trend-following: many small losses, few large wins that more than compensate.
- **Profitable in 8 out of 10 years**
### Compounded Equity Growth (0.5% risk per trade)
Starting with **$10,000** and risking 0.5% of equity per trade:
- **Ending equity: $30,198** (3× growth over 9 years)
- **Maximum drawdown: only 13.1%** — the account never lost more than $1 out of every $8
- **Lowest point: $9,924** — the account barely dipped below starting capital, even through 2+ years of sideways Gold
This is not a get-rich-quick system. It is a **get-rich-slowly-and-keep-it** system.
---
## The Secret Sauce: Regime Gating
What makes this EA different from every other breakout system?
**It knows when NOT to trade.**
During sideways markets (which, as any experienced Gold trader knows, is MOST of the time), the EA simply sits on its hands. No trades, no losses, no bleeding. It activates only when multiple independent conditions — across different timeframes and different types of market data — confirm that a genuine trend move is underway.
This is why the equity curve goes **flat** during choppy years instead of diving. And when the trend finally arrives, the EA catches it and rides it with a wide trailing stop.
We tested a version WITHOUT regime gating (a plain breakout system). That version **lost 69% of its equity** during the sideways period 2017–2023. Same entry logic, same trailing stop — just without the filter. The regime gate is not a nice-to-have. It is the entire edge.
---
## Capital & Risk Recommendations
### Minimum Starting Capital
| Account Type | Minimum Recommended | Comfortable |
|---|---|---|
| Standard (1 lot = 100 oz) | $10,000 | $20,000+ |
| Mini (0.1 lot = 10 oz) | $1,000 | $2,000+ |
| Micro (0.01 lot = 1 oz) | $200 | $500+ |
### Risk Per Trade
The EA includes **built-in position sizing** based on your chosen risk percentage:
- **Conservative (recommended): 0.25–0.5% per trade.** Maximum historical drawdown stays under 15% of your account. You sleep well at night.
- **Moderate: 0.5–1.0% per trade.** Higher returns, but expect drawdowns up to 25–30% during rough patches. Only if you can handle watching your account drop and trusting the system.
- **Aggressive: above 1.0%.** We do not recommend this. Even a proven system can hit extended losing streaks; high risk per trade turns a recoverable drawdown into a margin call.
Set the `InpRiskPct` parameter to your chosen percentage. The EA automatically calculates the correct lot size for every trade based on your current equity and the distance to Stop Loss. **You never need to calculate lot sizes manually.**
You can also set a fixed lot size (`InpFixedLot`) if you prefer manual control.
---
## Account Type Recommendations
### Best: ECN / Raw Spread / Pro Accounts
- **Spread:** 5–15 points on XAUUSD (very tight)
- **Commission:** typically $3.5–$7 per lot per side ($7–$14 round-trip)
- **Total cost per trade:** ~$15–$24
- **This is what the EA was tested with.** The backtest assumes 100 points spread ($10) + $7 commission = $17 per lot. ECN accounts match this closely.
### Acceptable: Standard / Classic Accounts
- **Spread:** 20–35 points on XAUUSD (wider)
- **Commission:** usually zero
- **Total cost per trade:** ~$20–$35
- **The EA remains profitable.** We tested cost sensitivity up to $40 per trade and the system still produced positive results (Profit Factor 1.16+). However, tighter spreads = more profit. If your broker offers both account types, choose ECN/Raw/Pro.
### Avoid
- **Fixed-spread accounts with spreads above 40 points** — the cost eats too much of the edge.
- **Brokers with poor Gold execution** (frequent requotes, wide slippage during news). The EA uses market orders; clean execution matters.
---
## Safety Features
This EA was designed with **capital preservation as the first priority**:
✅ **Every trade has a Stop Loss from entry.** No trade ever exists without protection — not even for one tick.
✅ **No martingale, no grid, no averaging down.** Lot size is fixed or calculated per trade. A losing trade is simply closed at its Stop Loss. The EA never doubles down on a loss.
✅ **One position at a time.** No stacking, no hedging, no correlated multi-pair exposure.
✅ **Cooldown between trades.** After closing a trade, the EA waits a minimum number of bars before opening a new one — preventing impulsive re-entry after a stop-out.
✅ **Spread filter.** The EA monitors real-time spread and skips signals when spread is abnormally wide (e.g., during news spikes or low-liquidity hours). Configurable via `InpMaxSpreadPts`.
✅ **Crash-safe state recovery.** If your VPS reboots or MetaTrader restarts while a trade is open, the EA **automatically recovers its trailing state** — it reads the saved entry data and recalculates the correct trailing stop level. No manual intervention needed. Your trade continues to be managed correctly.
✅ **No external dependencies.** The EA does not connect to any remote server, does not require a DLL, and does not send your data anywhere. Everything runs locally on your MetaTrader 5 terminal.
---
## What to Expect (Honest Talk)
**This is a trend-following system.** That means:
- **Most months will have small losses or small gains.** The EA trades infrequently (~2 trades per week) and most breakouts fail. This is normal. Don't panic.
- **A few months per year will produce large gains** that make up for all the small losses and then some. These are the trend months. You cannot predict which months they will be — you just have to be in the market when they happen.
- **About 1 in 3 trades wins.** But the average winner is nearly 3× the average loser. The math works. Trust the math.
- **Some years will be flat.** 2022 was essentially breakeven. That's the system doing its job — protecting your capital during unfavorable conditions so it's there when the next trend arrives.
- **The EA only buys.** If Gold enters a prolonged multi-year bear market (which has happened historically, e.g., 2013–2015), the regime gate will keep the EA mostly inactive — preserving capital but not generating returns. This is by design. We are working on a future version with a controlled short-selling module for bear regimes.
**Past performance does not guarantee future results.** We strongly recommend running the EA on a **demo account for 2–4 weeks** before going live, to verify that execution on your specific broker matches expectations.
---
## Ongoing Development & Updates
This EA is **actively maintained and continuously tested**:
- **Regular stability audits:** We re-run the full 9-year backtest suite after every update to ensure no regression in performance, safety, or execution logic.
- **Backtest-to-live verification:** The backtest engine has been mathematically verified to produce **identical results** (same trades, same exits, same P&L to the cent) as the EA's actual execution logic. What you see in backtests is what you get in live trading — no "backtest magic."
- **Broker compatibility testing:** We monitor performance across different spread/commission structures and update default parameters if market microstructure changes.
- **Free updates for all buyers.** When we improve the regime detection, trailing logic, or add new features, you receive the update at no extra cost.
---
## Quick Setup
1. Attach the EA to any **XAUUSD M5** chart.
2. Set `InpRiskPct` to your desired risk percentage (we recommend **0.5** to start).
3. Leave all other parameters at default — they are already optimized across 9 years of data.
4. Make sure "Allow Algo Trading" is enabled in MetaTrader.
5. That's it. The EA handles everything else — D1 trend detection, entry timing, position sizing, trailing, and exit.
**Recommended**: Run on a **VPS** (Virtual Private Server) for uninterrupted 24/5 operation. The EA includes crash recovery, but continuous uptime is always better.
---
## Parameters Overview
| Parameter | Default | Description |
|---|---|---|
| InpRiskPct | 0.5 | Risk % of equity per trade |
| InpFixedLot | 0.0 | Fixed lot size (0 = use risk-based sizing) |
| InpMaxSpreadPts | 250 | Skip signals if spread exceeds this (points) |
| InpCooldownBars | 24 | Minimum bars between trades |
| InpMagic | 552027 | Magic number (change if running multiple instances) |
Advanced parameters (for experienced users) are available but not required. The defaults have been validated across 9 years of diverse market conditions.
---
**Questions? Message us anytime.** We're traders ourselves and happy to discuss strategy expectations, broker recommendations, or risk management in detail.
