Gold BB Trend
- 专家
- 版本: 1.0
- 激活: 10
XAUUSD BB Trend EA — Bollinger Band Momentum for Gold (MT5)
This Expert Advisor trades momentum breakouts on XAUUSD (Gold vs USD) using a Bollinger Band + EMA trend filter strategy on the M1 timeframe. It is designed to catch high-probability breakout moves during the London–New York session overlap, where Gold is most volatile and directional.
The EA runs exclusively during a defined session window (default 16:30–18:00 broker time, GMT+3). Only one trade is opened per session. If the trade closes via TP or SL, the EA can re-enter if conditions are met again within the same session window.
---
HOW IT WORKS
Entry Logic:
- BUY: The previous candle closes ABOVE the upper Bollinger Band and ABOVE the 200 EMA. This signals a bullish momentum breakout with trend confirmation.
- SELL: The previous candle closes BELOW the lower Bollinger Band and BELOW the 200 EMA. This signals a bearish momentum breakout with trend confirmation.
- An optional candle body filter (RangeCandleMomentum) can require a minimum body-to-range ratio to avoid doji or indecisive candles.
Indicator Settings (defaults):
- EMA Period: 200 (trend filter)
- Bollinger Bands: Period 30, Deviation 3.0, Shift 0
Stop Loss:
- BUY: SL placed at the lower BB minus a spread buffer (SpreadDown)
- SELL: SL placed at the upper BB plus a spread buffer (SpreadUp)
Take Profit:
- Calculated as a multiple of the SL distance. Default multiplier: 10x (TPValue = 10)
- This gives a theoretical Risk:Reward of 1:10 per trade
Trailing Stop:
- SL is dynamically trailed to the opposite BB band as price moves in favor of the trade. This locks in profit as the BB bands shift.
Lot Sizing:
- Risk-based lot calculation. Risk per trade is fixed in currency (default $1,000 per trade).
- Lot size is computed from the SL distance and tick value so that a full SL hit equals exactly the RiskAmount.
- Respects SYMBOL_VOLUME_MIN and SYMBOL_VOLUME_MAX constraints.
Session Control:
- Trades only between SessionStart and SessionEnd (default: 16:30–18:00).
- One active position at a time per magic number.
- Daily state resets automatically at midnight.
---
BACKTEST RESULTS
Tested on: XAUUSD (Gold vs USD)
Timeframe: M1
Period: January 2019 – February 2026 (~7 years)
Broker / Data: 99% history quality, 10,447,568 ticks processed
Initial Deposit: $100,000
Default Parameters used (results are fully reproducible)
GMT Offset: GMT+3 (standard for most ECN brokers)
Key Metrics:
- Total Net Profit: $90,413.62 (+90.4%)
- Gross Profit: $389,934.91
- Gross Loss: -$299,521.29
- Profit Factor: 1.30
- Recovery Factor: 7.55
- Sharpe Ratio: 5.81
- LR Correlation: 0.98 (equity curve is highly linear — consistent growth)
- Expected Payoff: $87.44 per trade
- Max Balance Drawdown: $10,819.97 (10.08%)
- Max Equity Drawdown: $11,970.45 (11.08%)
- Margin Level: 26,404%
Trade Statistics:
- Total Trades: 1,034
- Total Deals: 2,068
- Winning Trades: 431 (41.68%)
- Losing Trades: 603 (58.32%)
- Short trades won: 42.21%
- Long trades won: 41.01%
- Largest profit: $9,978.85
- Largest loss: -$1,034.88
- Average profit: $904.72
- Average loss: -$488.76
- Max consecutive wins: 8 trades ($4,154.91)
- Max consecutive losses: 11 trades (-$5,942.08)
Note: Win rate is below 50%, but the high Risk:Reward ratio (1:10 TP multiplier) ensures that fewer wins still generate positive expectancy. The average profit is nearly 2x the average loss.
Session & Time Analysis:
- All entries occur in hours 16–18 (London–New York overlap) — as designed
- Entries are distributed evenly across weekdays (Mon–Fri, no weekend trading)
- Monthly performance is positive across all 12 months, with strongest results in Jan and Mar
---
EQUITY CURVE
The equity curve shows steady, consistent growth from 2019 to 2026. The curve is nearly linear with an LR Correlation of 0.98, indicating the strategy performs consistently across different market conditions including the COVID crash period (March 2020). There is a brief shallow dip visible in early 2020 followed by a strong recovery and continued uptrend.
Deposit load remains below 1% throughout the entire backtest, reflecting conservative lot sizing.
---
SESSION & GMT NOTES
Default session hours are 16:30–18:00 broker time at GMT+3.
This corresponds to 13:30–15:00 UTC, which is the London–New York overlap window — the highest-liquidity period for Gold.
If your broker uses a different GMT offset, you MUST adjust SessionStart and SessionEnd accordingly:
- GMT+2 broker: use 15:30–17:00
- GMT+0 broker: use 13:30–15:00
Failure to adjust for GMT offset will result in the EA trading at the wrong time.
Broker tested: Standard ECN broker with GMT+3 server time.
---
IMPORTANT NOTES & DISCLAIMER
- This EA is optimized for XAUUSD (Gold) on M1 timeframe. Results on other symbols are not guaranteed.
- Past backtest performance does not guarantee future results.
- Forex and Gold trading involves significant risk of loss. Only trade with capital you can afford to lose.
- Always test on a demo account before deploying on a live account.
- Adjust RiskAmount to match your account balance. The default $1,000 risk per trade suits a $100,000 account. For a $10,000 account, use $100.
- The EA does NOT use martingale, grid, or averaging strategies. Each trade is independent with a fixed SL.
- Requires a broker with low spread on XAUUSD for best performance. Recommended max spread: 30 points.
---
SUPPORT
Questions about parameters, setup, or GMT adjustment? Contact the seller via MQL5 messages. Response within 24 hours.
