Gold Trend Sniper AI
- Experts
- Versione: 1.0
- Attivazioni: 5
Gold Trend Sniper AI is an Expert Advisor for XAUUSD (gold) on the H4 timeframe built around a genuine deep-learning model — a PatchTST transformer trained on 10 years of gold data and embedded inside the EA as an ONNX neural network. On every closed H4 bar the network estimates the probability that a trend-aligned trade will win, and the EA trades only the setups the AI is confident about.
How it works
- Trend (direction): EMA50 vs EMA200 define the regime — longs only in an uptrend, shorts only in a downtrend. No counter-trend trades.
- AI decides the entries: on each closed H4 bar in a trend, the PatchTST network scores a win probability; the EA enters in the trend direction only when P(win) ≥ your threshold. This is where the edge comes from — the model filters out the low-quality moments.
- Scales into strong trends: it can hold up to N positions (default 5, one new per bar), so it presses winning trends while capping exposure.
- Risk first: every position has an ATR stop loss and ATR take profit, with risk-based position sizing (you set % risk per trade — default 0.5% — the EA computes the lots).
- Smart exits: optional breakeven after +1R, optional ATR trailing, a time-based exit, an opposite-signal exit, and optional flat-before-weekend.
- Clear dashboard: on-chart panel shows version, regime, signal, the AI win-probability, open positions, floating P/L, balance/equity and risk — at a glance.
Why it's different
- A real transformer model (PatchTST → ONNX), not a relabeled moving-average crossover. The neural net actually runs on every bar.
- Built on a sound principle: gold direction is hard to predict, but whether a trend trade will pay off is more learnable — so the AI is used as the trade selector, where it adds value.
- No martingale, no grid, no averaging-down. Fixed risk per trade, a hard stop on every position.
- Optional classic pullback mode ( InpRequirePullback=true ) if you prefer fewer, more selective entries; the default high-activity mode lets the AI pick every qualifying bar.
Real-tick backtest (MetaTrader 5 Strategy Tester, "Every tick based on real ticks", XAUUSD H4, $25,000 start, 0.5% risk, up to 5 positions, AI filter P(win) ≥ 0.50):
- Period: 2018-06 → 2026-06 (8 years)
- Net profit +524%, Profit Factor 1.37, Sharpe 1.82, Recovery Factor 4.31
- Max equity drawdown ~22%, 2,067 trades (~258/year), win rate 45.5% (longs 48.9%, shorts 36.3%), steadily rising equity curve
- Returns scale with the risk % and max positions you choose — lower both for a smoother, lower-drawdown profile.
Note: the 8-year run includes the model's 2018–2023 training period, so treat it as an optimistic upper bound — forward-test on a demo account for the honest read. Past performance does not guarantee future results. The included Colab notebook + MT5 tester reproduce every number.
Recommended settings
- Symbol XAUUSD, timeframe H4 (the EA trades H4 internally).
- InpRiskPercent 0.25–0.5%, InpMaxOrders 3–5, InpUseAI=true , InpPWinThreshold 0.50.
- Important: set InpServerGMTOffset to your broker server's GMT offset so the model's time-of-day features match training. Use a low-spread gold account (ECN/Raw) — gold's spread directly affects results.
Requirements
- MetaTrader 5 (build with ONNX support). The model is embedded — nothing extra to install.
- Works from modest accounts thanks to risk-based sizing; $1,000+ recommended so position sizing has room at current gold prices.
Support Questions and setup help are welcome — please contact me before leaving a review so I can help you configure it correctly for your broker.
