Halberd Gold
- Experts
- Version: 1.0
- Activations: 10
Swing-breakout Expert Advisor for XAUUSD. One position at a time, a stop loss and a take profit on every order, no grid, no martingale. Daily loss limit, drawdown stop and news filter are built in. Tested on 15 years of gold data, results and weak years disclosed.
Halberd Gold places a buy stop order above the most recent swing high on the H1 chart of XAUUSD. When gold breaks out of that level in the direction of the H4 and D1 trend, the order is filled with a fixed stop loss and take profit. If the breakout does not happen within a few hours, the order is cancelled.
Every order has a stop loss and a take profit. No grid, no martingale, no averaging. The EA holds at most one position of its own at a time.
How it trades
- Entry: a buy stop a small buffer above the last unbroken H1 swing high (a fractal of 5 bars on each side), only when the level is within 1.5 ATR of the price.
- Direction: buy only by default, and only when the closed H4 and D1 candles are above their 50-period EMA.
- Stop loss: below the opposite swing low, at most 1.5 ATR (H1).
- Take profit: 3.5 times the stop distance.
- Management: when the trade reaches 1R, the stop moves to break-even plus 0.1R. Positions still open after 72 hours, or on Friday evening, are closed.
- Trading hours: 07:00 to 20:00 GMT. The server time zone is detected automatically (GMT+2 / GMT+3 servers) or can be set manually.
Account protection
- Risk presets: Low (0.5% per trade), Medium (1%, default), High (2%), or Custom.
- Daily loss limit: new orders stop for the rest of the day when the daily loss reaches the limit (2% / 3% / 5% by preset).
- Maximum drawdown stop: trading stops when the account falls a set percentage below its peak (10% / 20% / 30% by preset). You resume it on purpose by changing one input.
- Minimum lot check: if the smallest possible lot would risk more than twice the target risk, the EA does not trade and writes the reason to the log. It never increases risk to fit a small balance.
- News filter: no new orders 30 minutes before and after high-impact USD events, from the MetaTrader economic calendar. No WebRequest settings are needed. In the Strategy Tester a built-in schedule (US employment report and FOMC) is used, because the calendar is not available there.
- Spread filter, Friday stop and weekend close.
Chart panel
A small panel shows the state (active, paused for news or the daily limit, stopped by drawdown, or not allowed to trade), the preset, today's result, the drawdown from the peak, the next news event, the spread and the open positions.
Backtest results
These are Strategy Tester backtests, not real trading results. Past results do not guarantee future results. Settings: default inputs (Medium preset, 1% risk per trade), initial deposit 10,000 USD.
- MetaQuotes-Demo, XAUUSD, real ticks, 15 January 2025 to 31 October 2026: 101 trades, profit factor 2.53, maximum equity drawdown 6.4%, net profit 8,727.84 USD.
- HistData.com M1 bid data imported as a custom symbol, 1-minute OHLC model, fixed spread 0.17 USD, March 2010 to December 2024: 625 trades, profit factor 1.33, maximum equity drawdown 17.5%, net profit 14,877.07 USD.
The default settings were chosen in 2025 to 2026 data. The 2010 to 2024 test is a check on data that was not used to choose them. It is weaker, and it is the more realistic reference for the long term. In R (1R = the amount risked on one trade, about 1% of the balance at Medium):
- 2010 +10.6, 2011 +15.3, 2012 -11.7, 2013 +5.2, 2014 +3.1, 2015 -0.6, 2016 +10.0, 2017 +16.2
- 2018 +3.8, 2019 +14.4, 2020 +0.6, 2021 +1.7, 2022 +16.7, 2023 +19.5, 2024 +1.9
Losing and flat years happen: 2012 lost 11.7R with a drawdown of about 16R, and 2020, 2021 and 2024 were close to flat. Gold's falling market of 2013 to 2015 was roughly flat, because the EA only buys when the trend filter allows it. The test reports are in the screenshots.
Requirements and recommendations
- Symbol: XAUUSD (gold against the US dollar) on any broker. Price digits and contract size are read from the symbol, so 2- and 3-digit quotes both work.
- Chart: attach to one XAUUSD chart, any timeframe. The EA reads H1, H4 and D1 data itself.
- Account: hedging or netting. On a netting account the EA does not place orders while any position is open on the symbol, so it does not change positions opened by you or by another EA.
- Minimum balance: 1,000 USD for the Medium preset, 2,000 USD for Low. With less, many signals are skipped by the minimum lot check.
- Low spread (ECN or raw spread) accounts and a VPS are recommended. Results depend on the broker's spreads and execution.
- Trading frequency: about 3 to 5 trades per month on average (3.5 in 2010 to 2024, 4.7 in 2025 to 2026). Some months have none.
Quick start
- Open an XAUUSD chart and attach Halberd Gold.
- Allow Algo Trading in the terminal.
- Choose a risk preset (Medium is the default). Leave the other inputs unchanged.
- Check the panel: the state should read "Active".
Test it first on a demo account or in the Strategy Tester with your broker's data.
Inputs
General: risk preset, lot mode (risk percent or fixed lot), risk percent and fixed lot (Custom preset), magic number base.
Direction and trend: allowed direction (buy only by default), trend filter (H4, D1 or both), trend EMA period.
Engine S (swing breakout): swing size, entry buffer, order life, maximum and minimum stop, maximum distance to the level, take profit multiple.
Engines R and V: two additional breakout engines (session range and volatility squeeze). They are off by default and are not part of the results above. In the 2010 to 2024 test, engine V had a profit factor of about 1.0.
Account protection: maximum positions, maximum lot, daily loss limit, closing positions at the daily limit, maximum drawdown stop, automatic resume, reset number.
Filters: maximum spread, trading hours (GMT), Friday stop and close hours, server time zone.
News filter: mode, minutes before and after, medium-impact events.
Trade management: break-even trigger and lock, maximum holding time.
Display: show the panel.
Notes
- The EA does not use DLLs or WebRequest and does not send any data outside the terminal.
- Price: the price rises by 20 USD after every 10 copies sold, up to a final price of 149 USD.
- Updates are free for buyers. Questions are answered in the product comments and by MQL5 private messages.
- Trading gold with leverage carries a high risk of loss. Use only money you can afford to lose, and choose the risk preset for your situation.
