Gold (XAUUSD) Trading Bot: How to Build, Test and Run One Without Code
A gold trading bot runs fixed XAUUSD rules for you. How gold moves, which strategies suit it, red flags in gold EAs and where to run a bot without code.
By Hristo Skulev · Updated · 10 min read

A gold trading bot is software that trades XAUUSD (spot gold priced in US dollars) on fixed rules: when to enter, where the stop and target go, how much to risk and when to stay out. It can be an MT5 expert advisor (a "gold EA"), a cTrader cBot, an exchange bot on a gold perpetual, or a strategy built without code and run through a broker connection. The bot itself is just the engine. Whether it makes or loses money depends on the rules, the costs and how well they were tested.
Gold suits automation better than many markets because it tends to trend for long stretches and reacts in predictable places: the London and New York sessions, and US data releases. It also punishes careless bots. Spreads widen around news, moves of several dollars can happen in seconds, and a strategy tuned to one year of gold can fall apart in the next.
Backtests and paper results are not future results. Leveraged trading in forex, CFDs and crypto carries a high risk of loss. The strategy, settings and risk are yours.
Why gold behaves differently from forex pairs
Gold is quoted like a currency pair but does not trade like EURUSD. A bot built for a major pair usually needs different stops, filters and hours on XAUUSD.
- Volatility. Gold can move a long way in a day, and its range changes a lot from quiet weeks to busy ones. Stops in fixed pips or dollars that worked last year can be far too tight this year. Stops based on ATR (average true range) adjust to the current range.
- Sessions. XAUUSD trades from Sunday evening to Friday evening, but the volume sits in the London session and the New York session, with the overlap between them often the busiest stretch. The Asian hours are usually quieter. A bot that trades all 24 hours mixes very different conditions.
- News. Gold often makes sharp moves around US data: inflation (CPI), the jobs report (NFP) and Federal Reserve rate decisions (FOMC). Spreads can widen and stops can fill well past their level. Many traders pause bots around these releases, and some prop firms restrict trading near them. See prop firm news trading rules.
- Spreads and commission. Gold spreads vary by broker and by hour, and can widen in quiet hours and around the daily rollover. On a short timeframe, the spread can be a large share of the average trade.
- Swap. Holding a spot gold CFD overnight usually carries a financing charge or credit, set by your broker. It barely matters for an intraday bot and matters a lot for a daily strategy that holds for weeks. Perpetual futures on gold use funding instead, which also changes over time.
So test a gold bot with realistic spread, commission, slippage and swap, over years that include quiet and violent periods, and know which session it trades.
Gold strategy types that are commonly automated
Most gold bots fall into three families. Below each are real examples from the Tessera strategy library. Every figure is a hypothetical backtest result from Strategy Lab, starting with $10,000 at 1% risk per trade with costs included, not a live track record.
Breakouts
A breakout bot buys when price closes beyond a recent high or a volatility band, and sells short on the opposite break. Gold's tendency to keep running after a break suits this, but breakouts have long losing runs when price chops sideways.
| Strategy (hypothetical backtest) | Period | Trades | Return | Profit factor | Max drawdown |
|---|---|---|---|---|---|
| XAUUSD 4h Bollinger band breakout (long only, London session, higher-volatility filter) | Jan 2020 to Nov 2026 | 168 | +94.85% | 1.97 | 4.66% |
| XAUUSD 1h Bollinger band breakout (New York) (long and short, 5R target) | Jan 2020 to Nov 2026 | 352 | +190.9% | 1.37 | 17.1% |
| XAUUSD 1h Bollinger band breakout (long only, London session) | Jan 2020 to Nov 2026 | 1,273 | +489.33% | 1.24 | 57.83% |
The last row is a useful warning. The biggest return in the table came with a drawdown of more than half the account at 1% risk per trade, and a win rate of 31.6%. Few people could sit through that live, and it would break almost any prop firm's loss limit. The return figure alone says nothing about whether a gold bot is tradable.
Trend following
Trend-following bots buy new highs over a longer window and hold while the trend lasts. The classic version is the Donchian channel breakout used by the Turtle traders. On daily gold candles these trade rarely, so the tests can cover 20 years.
| Strategy (hypothetical backtest) | Period | Trades | Return | Profit factor | Max drawdown |
|---|---|---|---|---|---|
| XAUUSD daily Donchian breakout (55-day high, long only) | Nov 2006 to Nov 2026 | 173 | +70.28% | 2.04 | 5.09% |
| XAUUSD daily Donchian breakout (length 20) (20-day high, 200 EMA filter, long only) | Nov 2006 to Nov 2026 | 224 | +67.5% | 1.67 | 6.9% |
Both are long only, so they make money when gold trends up and sit out or lose in sell-offs. At about 9 to 11 trades a year, they are slow. More on the idea in our trend following strategy guide.
Pullbacks
A pullback bot waits for a trend, then enters when price dips back to a moving average and turns. It aims for a better entry than a breakout at the cost of missing moves that never pull back.
| Strategy (hypothetical backtest) | Period | Trades | Return | Profit factor | Max drawdown |
|---|---|---|---|---|---|
| XAUUSD daily pullback to moving average (10 EMA pullback, 200 EMA filter, long and short) | Nov 2006 to Nov 2026 | 190 | +43.38% | 1.36 | 4.9% |
Its locked final 12 months were thin: +1.84%, profit factor 1.34 on 10 trades. That is the kind of detail a sales page leaves out and a full backtest shows.
Each strategy page has the full rules, every trade, the stress tests and the prompt to rebuild it in Strategy Lab. The full strategy library also has backtested silver (XAGUSD) strategies if you want a second metal.
Red flags on gold EA sales pages
"Gold EA" and "XAUUSD EA" listings are everywhere. Some are honest tools; many are not. Be wary of:
- A smooth equity curve with no losing months. Gold does not produce that without hidden risk. It often means a grid or martingale that adds to losing positions and looks perfect until one move wipes the account.
- No stop loss, or a very wide one. Ask what happens on a CPI or FOMC day if price runs against the bot by a large amount.
- A short backtest. One or two years of a gold uptrend can make almost any long bot look good. Ask for many years, including falling and sideways periods.
- Backtests with no costs, or a fixed tiny spread. Gold spreads widen at rollover and around news.
- Rules you cannot see. If you cannot read the entry, stop, target and risk, you cannot judge whether the result is luck or overfitting. See is my backtest overfit?
- Drawdown hidden behind return. As the 57.83% drawdown example above shows, return without drawdown is half the picture.
Other ways to run a gold bot
- MT5 expert advisors. The most common gold bot format. You write MQL5 or buy an EA, backtest it in MT5's Strategy Tester and run it on a VPS. Flexible, but you own the code, the server and the bugs.
- cTrader cBots. cTrader's equivalent, written in C# or Python. Our guide to a cTrader trading bot without coding covers what cBots need.
- Chart alerts plus webhooks. A third-party tool turns chart alerts into broker orders. It works, with more moving parts between signal and fill.
How to build and run a gold bot with Tessera
Build and test it in Strategy Lab. In Strategy Lab, on the Free plan, you describe the strategy in plain English to TES, the AI strategy coach, or build it from setups, filters and exits. It backtests spot gold (XAUUSD) and silver (XAGUSD) on 1-minute to daily candles, with up to 20 years of daily history. Then it stress tests the result: an unseen period, Monte Carlo, price noise, costs (spread, commission, slippage and swap), other markets and prop firm rules. You can also start from one of the library strategies above and rebuild it with its prompt.
Run it with Launchpad. Launchpad runs the strategy with the same code as the backtest. Launchpad checks that your account lists the strategy's market before it starts.
| Venue | How gold appears | What you need | Good to know |
|---|---|---|---|
| cTrader | Spot gold, as your broker lists it (often XAUUSD) | A demo or live cTrader account connected with the trading permission | Account-only access is read-only; reconnect to add trading |
| Liquid Brokers | Spot gold, as your login's instrument list shows it | Your Liquid Charts login, which covers all its accounts | Liquid Charts is Liquid Brokers' platform |
| Binance Futures | XAUUSDT perpetual | A trading API key, futures in One-way or Hedge mode, and Binance's TradFi-Perps agreement signed on binance.com | Launchpad skips entries while the market's session is closed |
| Hyperliquid | xyz:GOLD perpetual on trade.xyz | Your wallet signs two approvals: Tessera's trading agent and builder fee | Your private key is never shared and the agent cannot withdraw |
Then pick a mode:
- Paper: live prices and the backtest's own costs, with no broker connected. Start here.
- Copilot: each signal arrives as a notification with a chart, and nothing is placed until you approve it in Telegram or the app. Signals expire after a set number of candles, so a stale gold breakout is not entered late.
- Autopilot: the bot trades for you, on every paid plan. Within seconds of each candle closing it checks the strategy's rules; when a setup appears it sizes the trade by your risk settings (% risk per trade, 0.5% by default and capped at 5%, maximum size, daily loss limit, maximum trades and trading hours) and sends it with its stop and target. Every order is checked against those limits when the signal fires and again right before it is sent.
Stop loss and take profit are attached at the broker with each entry, and every bot trade syncs back to the journal so you can compare live fills with the backtest. Launchpad does not run on MetaTrader, and it cannot start bots from TradingView alerts. If you want the exchange route in more depth, see our guides to a Binance futures trading bot and a Hyperliquid trading bot.
Paper first, then small
Gold's live behaviour around news and rollover is where backtests and real fills drift apart. Run the bot on paper, or a demo account, long enough to see a few US data days and a range of sessions. Check that it takes the same trades as the backtest and that the costs match. Our guides on how long to paper trade a strategy and slippage in algo trading cover what to look for. When you go live, start with lower risk per trade than the backtest used.
Frequently asked questions
- Is there a profitable gold trading bot?
- Some gold strategies have backtested well over many years, such as the daily Donchian breakout with a profit factor of 2.04 from 2006 to 2026 in the Tessera library. Those are hypothetical results. No bot is profitable in every market, and anyone promising steady profits from a gold EA is selling something.
- What is the best timeframe for a gold bot?
- There is no single best one. Daily strategies trade rarely and can be tested over 20 years; 1-hour and 4-hour strategies trade more and depend more on which session they trade. Shorter timeframes pay a larger share of each trade in spread and commission.
- Should a gold bot trade during news?
- Many traders pause bots around CPI, NFP and FOMC because spreads widen and stops can slip. Test both ways in Strategy Lab and check your prop firm's rules if you trade a funded account.
- Can I run a gold bot without MetaTrader?
- Yes. With Tessera you build and test the strategy in Strategy Lab, then run it with Launchpad on cTrader, Liquid Brokers, Binance Futures (XAUUSDT) or Hyperliquid (xyz:GOLD on trade.xyz). Launchpad does not run on MetaTrader.
- Is XAUUSD on Binance the same as spot gold?
- No. XAUUSDT on Binance Futures is a perpetual contract that tracks gold, settled in USDT, and it needs Binance's TradFi-Perps agreement. Spot gold at a cTrader broker or Liquid Brokers is usually a CFD with overnight swap. The price moves together, but costs and trading hours differ.
- Do I need to code to build a gold trading bot?
- No. You can describe the rules in plain English to TES in Strategy Lab, or build from setups, filters and exits, and get started for free. Our guide to creating a trading bot without coding walks through the whole route.
Backtested strategies that held up
Each one was searched from hundreds of variants, then tested once on a locked final year it was never tuned on. Full rules, every trade and a free prompt to rebuild it.
- ETHUSDT
+1,893.2%
Sep 2019 to Nov 2026
Profit factor
1.39
Win rate
35.2%
Max DD
−18.9%
Breakout · 4 hours
ETHUSDT 4h Bollinger band breakout
Enter when the candle closes above the upper Bollinger band(30, 2) for longs, below the lower band for shorts, with the 200 EMA trend. ETHUSDT 4-hour candles, long and short, 3R target.
See the rules and results - EURUSD
+1,339.5%
Nov 2006 to Nov 2026
Profit factor
1.66
Win rate
53.0%
Max DD
−16.0%
Momentum · Daily
EURUSD daily CCI cross
Enter when CCI(14) crosses above -100 for longs, below 100 for shorts. EURUSD daily candles, long and short, 1.5R target.
See the rules and results - ADAUSDT
+937.9%
Sep 2019 to Nov 2026
Profit factor
1.50
Win rate
34.5%
Max DD
−15.0%
Breakout · 4 hours
ADAUSDT 4h Bollinger band breakout
Enter when the candle closes above the upper Bollinger band(20, 2) for longs, below the lower band for shorts, with the 200 EMA trend. ADAUSDT 4-hour candles, long and short, 3R target.
See the rules and results
Keep reading
Algo tradingHow to Create a Trading Bot Without Coding (and Test It Before It Trades)
How to create a trading bot without coding: compare visual builders, AI builders and TradingView webhooks, then test it with this checklist before it trades.
Algo tradingHow to Build a cTrader Trading Bot Without Coding
Build a cTrader trading bot without coding: what cTrader Algo and cBots need, then a no-code route from strategy to backtest, demo account and live trading.
Prop firmsProp Firm News Trading Rules (2026): Which Firms Allow Trading the News
News trading rules at FTMO, The5ers, FundedNext, FundingPips, Topstep, Lucid, My Funded Futures, E8 and more: the window, which phase it applies to, and the penalty. Checked 13 November 2026.