Momentum-Trend Gold EA Chosen by Cost-Aware Backtest
An H1 momentum EA for a cent-denominated gold account, selected by a Python backtest with real cent costs and a strict in/out-of-sample split.
Bars pulled read-only from the live terminal, 2022 to 2024 in-sample and 2025 onward out-of-sample, PF 1.32 in versus 1.61 out at 1 percent risk, with the caveat that most profit came from the recent gold bull run and a four-week demo forward test required before live.

- Real cent-account costs modelled
- Strict IS/OOS split with OOS reported
- Caveat about regime dependence stated
- Forward-test gate before live attachment
A small cent-denominated gold account needed a strategy chosen on evidence. Historical bars were pulled read-only from the running live terminal through the MetaTrader5 Python package, and a Python engine with the account's real costs (spread, tick value, swaps) evaluated candidates with 2022 to 2024 as in-sample and 2025 onward as out-of-sample.
The selected rule is simple and stated fully: on the hourly chart, enter when the 24-bar close change exceeds one ATR in the direction of the daily EMA20/EMA50 trend, stop at two ATR, trail at three ATR, flip on an opposite signal, risk one percent per trade. Out-of-sample profit factor was higher than in-sample, maximum drawdown about 22 percent at that risk, and the longest losing streak 13 trades. The caveat is written next to the result: 2022 and 2023 were flat and nearly all profit came from the 2024 to 2026 bull run in gold, mostly on the long side.
The EA compiles clean. Because the live terminal cannot host a headless tester, the plan is a four-week forward test on a fresh demo before anything attaches to the live account.
Trading tool on a small live account; shared as engineering work, not financial advice.
How it works
- Pull H1 and D1 bars read-only from the terminal
- Backtest candidates with real costs on IS and OOS windows
- Select the rule with consistent OOS behaviour
- Compile the EA and forward-test on a demo
- Attach to live only after the forward test
Software and automation are infrastructure, not financial advice. No performance guarantees. Every live system needs staged testing, risk limits, and owner approval.