Backtest vs bot on the same minutes: do they make the same trades?

We ran backtest code over the days our public-strategy bots traded. Most entries matched; the mismatches taught more than the matches.

Written by: WICKVIPER Study ID: K179 / K180 / K191 / K254 (AI3 AUDYT C) Published: Updated:

Mixed result

Short answer

When a bot's forward results disappoint, does the bot still do what the backtest did?

Mostly yes. For two public gold scalpers, 22 of 24 account trades had a simulated twin, all 22 pairs ended with the same type of exit and the average gap was about 0.12 basis points. Checks of ten further strategies found record gaps, unaligned windows and a different Stochastic formula in the bot.

Data
Gold (XAUUSD), US500, US100, US30 and DE30 CFDs
Period
12–19 October 2026 (scalpers and ten strategies); 12–30 October 2026 (longer check of three strategies)
Sample
24 account trades of two scalpers, 31 closed account positions of the ten-strategy set, and a separate three-week entry check of three of those strategies
Costs
account side: execution prices plus commission and swap; simulator side: its own research cost model; 1 bp = 0.01% of price

Key numbers

Gold scalpers: account trades with a simulated twin
22 of 24
Same type of exit, paired scalper trades
22 of 22
Average gap per trade, account minus simulator
+0.11 bp and −0.12 bp
Ten popular strategies: positions with a backtest twin
29 of 31

Why this question matters

A backtest says one thing, the first weeks of forward trading say another. The usual suspects are the market, the costs and plain luck. There is a fourth one that is easy to miss: the bot may not be doing what the backtest did. The two are different programs, often written in different languages, reading different data files. If they disagree, comparing their results tells you nothing about the strategy.

The test for this is called a parity check. Take the research code, change nothing, run it over the same days the bot was trading, and put the two trade lists side by side. We did this on 20 October 2026 as part of a wider audit of our test engine (Were our backtests too strict?). Here is the detailed version, limited to publicly known strategies.

The strategies

We ran these rules on our MT5 account at the broker TegasFX, at minimum size, from 12 October 2026. They are no longer running: the two scalpers were switched off on 27 October after continued losses, and the ten other strategies on 10 November. The forward test we had planned to run until January 2027 was therefore not completed.

Two gold scalpers on 5-minute candles, each opening two halves of a position:

  • 5-Minute Momo (popularised by Kathy Lien): price crosses the 20-period EMA while the MACD histogram has recently turned its way; the bot then waits for price to reach a trigger level beyond the EMA. The histogram must have been on the right side for the last five candles, or have crossed to it within them.
  • EMA ribbon 8/13/21 with a one-hour trend filter: when the three averages line up in the trend direction, the trigger level sits beyond the high or low of the last five candles.

The trigger level is not a pending order at the broker. The bot watches the price and sends a market order when the level is crossed, so nothing triggers if the terminal is off. The stop-loss is then attached to the position. Both rules are our adaptation for gold: the published distances in EUR/USD pips were converted into multiples of the 14-candle average true range (ATR).

Their backtest on Dukascopy 5-minute bid data for gold, November 2020 to November 2025, was negative both before and after costs. We connected them anyway to see what forward trading would show. R is the net result of both halves divided by the risk of one half.

The strategies
Backtest, November 2020 – November 2025TradesBefore costs, per tradeAfter costs, per tradeProfit factor
5-Minute Momo1,768−0.060 R−0.132 R0.79
EMA ribbon2,758−0.028 R−0.157 R0.85

The second group is ten textbook strategies on gold and stock indices: Supertrend, Ichimoku, Stochastic, Connors RSI(2), opening range breakout, Parabolic SAR, EMA 9/21, pivot points, London breakout and a Fibonacci retracement.

How we compared

  • Account side: the trades recorded on the account. For the scalpers, the result comes from the execution prices, so spread and slippage are already inside, plus commission and swap.
  • Simulator side: the research code, unchanged, with its own cost model. For the scalpers it ran on 5-minute candles built from the broker's own 1-minute bid bars for the same days.
  • A pair means the same direction and an entry within a set time window: 10 minutes for the scalpers' price triggers and 75 minutes for the ten strategies.
  • For the scalpers we compared entries, exits and results. For the ten strategies we compared entries only, using one-hour candles built from the live 15-minute files.

This is a check of the software, not of profitability. A losing rule can have perfect parity.

Result 1: the two scalpers

Result 1: the two scalpers
12–19 October 20265-Minute MomoEMA ribbon
Account trades compared816
Simulator trades917
Pairs814
Only on the account02
Only in the simulator13
Same type of exits on the two halves8 of 814 of 14
Average entry delay of the bot against the simulator's time stamp1.7 min2.9 min
Entry price gap, median / largest0.14 / 0.81 bp0.23 / 2.46 bp
Account result per paired trade, after costs+2.16 bp−12.69 bp
Simulator result for the same pairs+2.05 bp−12.57 bp
Gap, account minus simulator (t-statistic)+0.11 bp (0.60)−0.12 bp (−0.54)

"Type of exit" means stop, target, or closed by the bot itself (indicator or end of day), taken for the two halves together. Exit times and exit prices were not compared one by one. From the simulator's side, 22 of its 26 trades had a twin on the account.

The result in basis points is the average of the two halves. Measured in R, the paired trades gave −0.047 R on the account against −0.052 R in the simulator for Momo, and −0.611 R against −0.629 R for the ribbon. Momo is positive in basis points and slightly negative in R because R weighs each trade by its stop distance.

Single trades differ more than the averages suggest. The gap per trade ranged from −0.63 to +0.60 bp for Momo and from −2.37 to +0.89 bp for the ribbon.

The delay is a time-stamp effect. The bot enters on the tick that crosses its trigger level, somewhere inside the candle. The simulator only knows the 5-minute candle and writes down its opening time. Every delay was under five minutes and the prices were close. If your parity check demands the same minute, it will report errors that are not there.

The single Momo trade missing on the account was not missing. The account history shows the bot entering at 05:56 server time, one minute after the simulator's 05:55 candle. The record of one half closing was absent, so the comparison dropped the whole trade. Our trade logger rebuilds only the current day's history when it starts, and can lose closing records.

The ribbon is not fully explained. One of the three simulator-only trades is stamped before the bot was switched on that evening: our comparison window started a few hours too early. The other two, and the two trades found only on the account, we have not traced. So parity here is good, not perfect.

In that week the ribbon lost, and we had suspected a bug. On the 14 paired trades the simulator lost about as much as the account, so the way the bot executes the rule does not explain that loss.

Result 2: ten textbook strategies, entries only

Of 31 closed positions with a complete account record, 29 had a backtest twin. 24 of those pairs were in the same minute and all 29 within the same clock hour. The entry price gap had a median of 0.61 bp and a largest value of 2.34 bp. The other direction looks much worse: the backtest listed 39 entries, so 10 had no partner. We went through them for this article:

Result 2: ten textbook strategies, entries only
Why a backtest entry had no partnerEntries
After the end of the account record, or the position was still open when the record was taken (our comparison drops those)5
The closing record is missing from the account history, so the trade was dropped1
The backtest used a different Stochastic formula from the bot (see Result 3)1
The bot entered one four-hour candle later than the backtest (Parabolic SAR), cause not traced1
No matching entry found, cause not traced2

Six of the ten came from the comparison or the account record. The two lists did not end at the same moment: the backtest ran into 20 October, the account record stopped on 19 October, and positions still open were not counted on the account side.

Of the two account entries without a backtest twin, one is the later Parabolic SAR entry above. The other is an opening range breakout trade on the first day: the bot was started after the morning breakout had already happened and bought late, which the rule does not allow. We excluded that trade from the forward comparison and changed the code so that a breakout already visible on a closed candle gives no entry.

Result 3: the same indicator name, two formulas

On 1 November 2026 we repeated the entry check for three of the strategies over three weeks, 12–30 October, on one-hour candles built from the broker's 1-minute data. Opening range breakout matched 14 of 14 entries (leaving out the late first-day entry described above) and EMA 9/21 matched 10 of 10.

The Stochastic 14/3/3 did not match at first. The reason is in the smoothing of the %K line:

  • The bot uses MetaTrader 5's built-in Stochastic. For a slowing value of 3, it adds up three distances from the close to the 14-candle low, adds up three 14-candle ranges (highest high minus lowest low), and divides one sum by the other.
  • Our backtest computed the raw %K for each candle and then took a simple average of three values.

Both are called "Stochastic 14/3/3". They give nearly the same line, but a rule that fires on crosses below 20 and above 80 is sensitive to small differences, and in those three weeks our formula produced two extra signals that the bot did not take. With the MT5 formula in the backtest too, all 21 account entries matched; the simulator had one more, at a time when the computer running the bot was off.

Does it change the published verdict? We re-ran the long history with both formulas:

Result 3: the same indicator name, two formulas
Stochastic on US500 one-hour, after costsBacktest formulaMT5 formula
September 2011 – December 2020−2.05 bp per trade (2,901 trades)−2.33 bp (2,933)
January 2021 – September 2026−1.48 bp (2,293)−1.72 bp (2,298)

No: the rule loses with either one. But our Stochastic study said the forward test ran with the same rules, and strictly it did not. We have added a correction there.

Other things that break parity

  • Data files. On the first day, the pivot-point levels in our check differed from the bot's by about 12 index points. The 15-minute file used by the check lacked Friday's last quarter-hour; the bot took the broker's daily close, which was the right one.
  • Known approximations. The opening range backtest on one-hour candles cannot close at 17:30 Frankfurt time and uses the 18:00 close instead. The bot closes at 17:30. Entries can match while results differ by design.
  • Column names. A column labelled as UTC in our trade log actually held the broker's server time. Comparing it with true UTC data would shift every trade by hours.
  • People. In the same weeks, two EMA 9/21 positions were closed by hand. Their exits cannot be compared with the rule, and one of them, closed against an opposite order, was invisible to our trade-pairing code.

Limits

  • The samples are small: 8 and 14 paired scalper trades over one week. An absolute t-statistic below 1 means we found no systematic gap, not that none exists.
  • The sizes were minimum sizes. Fills with larger sizes, or on a funded account, were not verified.
  • The bot triggers a buy on the ask price, while the simulator triggers it on the bid high. This is a known difference in the code.
  • The simulator fills a stop-loss at its exact level unless price gaps past it between candles. A real stop is an order, not a price guarantee, and in fast markets the gap can be much larger than what we saw.
  • The ten-strategy check covers entries only; their exits and results were not compared on 20 October.
  • The scalper backtest used a data file that is not part of our versioned dataset, so that long backtest cannot be fully reproduced today.
  • In the ten-strategy set, two backtest entries and the later Parabolic SAR entry remain unexplained, as do four ribbon trades.
  • The longer check included the European clock change of 25 October for the opening range breakout; the US change on 1 November was not covered.

Past results do not guarantee future ones.

What it means for a trader

  • Before judging a strategy by its forward results, check that the program trades what you tested. Compare trade by trade, not just totals.
  • Align the two windows first: same start (when the bot was really switched on), same end, same treatment of open positions.
  • Allow for time stamps. A price trigger fires inside a candle that the backtest labels by its opening time.
  • Check indicator formulas, not indicator names. Compare the actual values your platform shows with the values your code computes.
  • Keep a list of manual interventions and downtime. Each one is a hole in the comparison.
  • Write down what you could not explain. "Mostly matched" is a different statement from "matched".

Written and reviewed by AI agents (Claude and Gemini models) under rules set by the owner; no person reviews each text. Last AI review: 27 Nov 2026. Sources are listed at the end of the article.

Questions

What is a parity check between a backtest and a trading bot?

You run the unchanged research code over the same days the bot traded and pair the two trade lists by direction and entry time. Then you compare entry prices, exit reasons and results. It tests whether the software agrees, not whether the strategy makes money.

My bot enters a few minutes after the backtest. Is that a bug?

Not necessarily. When a bot waits for a price level, it enters on a tick inside the candle, while the backtest often records the candle's opening time. In our scalper pairs the delay averaged 1.7 and 2.9 minutes on 5-minute candles and every delay was under five minutes.

Why can the same indicator give different signals in two programs?

Names hide formulas. For the Stochastic with slowing 3, MetaTrader 5 divides a sum of three numerators by a sum of three ranges, while our backtest averaged three raw %K values. In our three-week check our version produced two extra signals.

Sources

  1. iStochastic, MQL5 Reference — MetaQuotes
  2. Stochastic oscillator — Wikipedia

Past results do not guarantee future results. This is research, not a recommendation to trade.

Read next