Differences from the MetaTrader 5 Strategy Tester
Topic by topic, every difference from the MetaTrader 5 Strategy Tester that can change a result, with the rule on each side.
This page goes topic by topic through the ways a backtest here differs from the MetaTrader 5 Strategy Tester (MT5) that can change a result, with the exact rule on each side. Where the two agree, it says what the agreement rests on. Measure any comparison in tick mode: it is the mode that has been compared with MT5 trade by trade (Why you can trust the engine → compared with MetaTrader 5). How to set up your own comparison and how to port an Expert Advisor (EA) are on the second page, Comparing a run with MetaTrader 5.
At a glance
| Topic | MetaTrader 5 Strategy Tester | AlgoTradingHub |
|---|---|---|
| Price history | Your broker's history: its real ticks, or ticks generated from its 1-minute bars | Dukascopy ticks, the same for every user and every run |
| Modelling | Every tick · Every tick based on real ticks · 1 minute OHLC · Open prices only · Math calculations | Tick by tick (recorded ticks) · Bar by bar (one step per finished 1-minute bar) |
| Clock | Broker server time | Data in UTC; rules run in the strategy's time zone (new strategies: Europe/Bucharest) |
| Trading sessions | The symbol's quote and trade sessions | None: the data defines when trading happens |
| Spread | Real ticks: each tick's own; generated ticks: the bar's | Tick mode: each tick's own; bar mode: the minute's average; both can be overridden |
| Slippage, delays | No slippage setting; optional execution delays | Slippage in points on every fill, stops and targets included; no delays |
| Commission, swap | From the symbol and the account | Only from a virtual symbol you attach; none otherwise |
| Margin | The symbol's calculation mode, margin rates, hedged margin | Lots × contract size × price ÷ leverage; per-symbol leverage; no margin rate |
| Stop-out | Margin call and stop out levels you set | Only when equity falls below zero |
| Stops and freeze level | Applied from the symbol | The stops level when a virtual symbol states one (broker presets do); no freeze level |
| A bar that reaches both stop and target | Follows its generated price path | Bar mode books the stop, always |
| Indicators | Built-in indicators, plus custom ones | Every built-in has a counterpart in the catalog, plus VWAP; no custom indicators |
| ATR | iATR: simple average of true range | Wilder preselected; the "Sma" smoothing is MT5's |
| ADX | iADX: per-bar ratios, exponential smoothing; iADXWilder: Wilder smoothing | Wilder preselected (the "ADX Wilder" formula); the "Exponential" smoothing is iADX's |
| Parabolic SAR | MT5's own rule | Wilder preselected (this platform's own rule); the "MetaTrader" method is MT5's rule |
| Computed price on an exact half tick | NormalizeDouble: away from zero | Away from zero, the same rule |
| Optimization | Complete, genetic, all symbols; forward period; eight criteria incl. custom | Complete grid only; rolling walk-forward folds instead of one forward period; ranked on the metric you pick |
| Report | History quality; minimal margin level; profit factor = DBL_MAX without losses | No history quality; minimal margin level; profit factor shown as "—" (no losing trade) without losses |
| Watching a run | Visual mode re-runs the test on a chart | A recorded replay of what the strategy read and did |
| Live trading | MT5 accounts | cTrader accounts |
1. Data and bars
What price history does a backtest replay?
Every run, for every user, replays one source: Dukascopy tick history. A tick is a UTC timestamp, a bid, an ask, and the provider's bid and ask volumes. You cannot replace it with your broker's history.
History starts on 2003-01-01 at the earliest; newer instruments start later. The instruments are the catalog's 70 (instruments).
MT5's "Every tick based on real ticks" replays your broker's own ticks and, for a minute with no ticks, generates them as in "Every tick". Its other modes generate prices from your broker's 1-minute bars.
Your broker's history and Dukascopy's are not the same, so results differ for that reason alone. Every "matches MT5" statement in these docs means MT5 running on the same Dukascopy ticks, imported into MT5 custom symbols.
How is a 1-minute bar built, and what does Volume mean?
A 1-minute bar covers [t, t + 60 s) and is built from bids: open = the first tick's bid, high and low = the highest and lowest bid, close = the last tick's bid. MT5 builds its bars from bid prices too.
Where they were checked (147 one-minute bars around the differing trades of one EURUSD comparison), the bars equalled MT5's to the last digit.
A bar's spread is the average (ask − bid) of the minute's ticks. MT5 gives a bar the smallest spread seen in the minute. This matters only in bar mode (spread in bar mode).
Volume is the bar's tick count: the number of ticks in the minute, each counted once whatever its price, which is how MT5 counts its tick volume. A stored bar's volume equals MT5's tick volume on every bar compared: EURUSD M1 (December 2022 to May 2023, 185,908 bars), H1 (24,955 bars) and D1 (1,250 bars) over 2020 to 2023; XAUUSD H1 (65,131 bars) and D1 (3,420 bars) over 2015 to 2025. MT5 built those bars itself from the same Dukascopy ticks imported into custom symbols, so its tick volume is its own count; the bars line up one for one and their prices are identical (the record). The bar still forming carries its volume so far.
In a backtest, a rule that reads Volume (Candle Data, an indicator with Volume as its applied price, or a volume indicator such as OBV or VWAP) therefore sees the numbers MT5 computes from the same Dukascopy ticks. Live it reads your broker's count, another number (volume).
How are higher timeframes built, and where does a day or a week begin?
Every timeframe above M1 is built from the 1-minute bars in the strategy's time zone: a D1 bar starts at midnight in that zone, a W1 bar on Monday 00:00 in that zone, an MN1 bar on the 1st; H2 to H12 boundaries follow the zone too. A bar's spread is the mean of its minutes' spreads; its volume is their sum.
MT5 builds bars on broker server time. To get an MT5 broker's D1 and W1 bars, set the strategy's time zone to New York close, the clock most MT5 brokers' servers keep, or to your broker server's own zone (Time).
The timeframes are MT5's 21, M1 to MN1, and each can be a candle-close event.
Is there a trading-session calendar?
No. A run trades whatever the data holds: the Sunday reopen, early-close days and daily breaks are whatever the feed printed.
MT5 executes stops and targets only inside the symbol's trade sessions, and a custom symbol cloned from a broker keeps that broker's sessions. Recorded effects: a session template that cut the Sunday reopen and 00:00–01:00 made MT5 miss 10 of 280 trades; a symbol tradable from 01:01 made MT5 fill a target at 01:01:02 that the backtest filled at the crossing tick at 00:06:24.
Your live broker's sessions still apply when you trade live; the backtest does not model them.
Which dates does a run cover?
Whole UTC days: from 00:00:00 UTC on the start date to 23:59:59 UTC on the end date.
In the MT5 reports we compared, the period's end date was not included: an MT5 run "2021.06.01 – 2023.06.01" ends on 2023-05-31 here. MT5's dates are server time.
The start dialog offers only the dates covered by every instrument the strategy reads.
Every plan you can buy reads the full history, in both modes; only a Starter plan from before the base plan starts no earlier than 10 years before today (plans → backtests).
Is there a "History Quality" figure?
- No. MT5's report states History Quality ("a percentage ratio of correct and incorrect one-minute data"). The result page here has no such figure; the start dialog shows the dates each instrument covers.
2. Modes and timing
Which modes are there, and which MT5 mode does each correspond to?
| MT5 mode | Here |
|---|---|
| Every tick based on real ticks | Tick by tick: every recorded tick of every instrument the run loads (traded, read by a rule, or used for currency conversion), in time order |
| Every tick (ticks generated from 1-minute bars) | none |
| 1 minute OHLC (four prices per minute) | Bar by bar (M1) is the nearest, and coarser: one step per finished minute |
| Open prices only | none |
| Math calculations | none |
Compare with MT5 in tick mode only. Bar mode and MT5's "1 minute OHLC" guess the path inside a minute differently and cannot agree trade for trade. On one stop-heavy EURUSD strategy MT5's OHLC mode made 21,466 trades and bar mode 16,980; MT5's own OHLC run ended at 2,418 with the account alive while its real-tick run blew the account.
The start dialog preselects Bar by bar.
What happens on one tick, and in what order?
In tick mode, on each tick of an instrument, its resting pending orders are filled or removed first — before any rule runs — then status holders and record sets update, candle-close rules run, stops and targets are checked and trailing stops move, and on-tick and on-timer rules run; the full order is on the execution model → order of operations.
A position opened by a candle-close rule is checked against its stop and target on that same tick.
Filling resting orders before the strategy's handler is what MT5 does as well: a delete sent on the same tick acts on an order already filled. The comparisons needed this order.
Bar mode runs once per minute (bar-mode order).
When does a decision taken at a candle close fill?
Tick mode: on the first tick of the new bar, at that tick's ask (buy) or bid (sell). MT5 fills a new-bar decision at the same instant, on the new bar's first tick, in its tick modes and in "1 minute OHLC". In an H1 comparison all 280 entries paired with MT5's at the same price.
Bar mode: decided at the close of the 1-minute bar that ends the candle (an H1 close on the 10:59 bar, at 11:00 — the instant tick mode decides it), filled at the next 1-minute bar's open — the open bid for a sell, the open bid plus the bar's spread for a buy. This applies to market opens, closes, partial closes, changes to an open position, and placing, deleting or repricing a pending order, in the order the actions ran. On the same H1 strategy all 280 bar-mode entries opened at the same time as MT5's; their prices still follow bar mode's own rules (the bar's open and spread), so they are not compared trade by trade.
Does an On Tick rule behave the same in bar mode?
- No. In bar mode an on-tick (or on-timer) rule runs once per minute, at the bar's close. Its shift-0 read of a timeframe above M1 sees the bar still forming, built from the minutes closed so far, the one just decided included; in tick mode it also includes the current bid. Because bar mode decides at the minute's close and fills at the next minute's open, it can act up to 2 minutes after tick mode. MT5 runs OnTick up to four times per minute in "1 minute OHLC" (once per generated price) and on every tick in the tick modes.
Strategies with several symbols: which symbol drives which rule?
On-tick rules run on the ticks of the instrument named in their trade levels, as MT5 calls OnTick only "upon receiving a new tick for a symbol of the chart the EA is attached to". A rule without trade levels (a close of every position, for example) runs on every instrument's ticks.
Candle-close rules fire on the bar closes of one traded instrument only, the primary symbol; another traded instrument's closes never fire them. In tick mode the close is detected on the first tick of any loaded instrument after the boundary, and the rule then uses the primary symbol's latest price, which can still be the previous minute's (candle closes).
Another instrument's 1-minute candles, read in a candle-close rule, lag one bar: you get the bar before the one MT5's
iClose(other, PERIOD_M1, 1)returns. Its higher timeframes are current.In bar mode every traded instrument runs on its own 1-minute bars: each position's stop, target and trailing stop, and each pending order, is tested on its own instrument's bar, and a deferred fill uses that instrument's next open (details). Rules still decide only at the primary symbol's bar closes.
How does the On Timer event compare with OnTimer?
The timer fires on the clock's whole minutes and the interval cannot be changed; after a gap in the data it fires once and resumes, as MT5 does not replay missed timer events either (On Timer). New strategies cannot pick it until its interval can be set.
In MQL5 the EA chooses the interval (
EventSetTimer,EventSetMillisecondTimer), and the tester calls OnTimer for every interval of modelled time — with a one-second timer, 14,400 times per H4 bar.
What does a shift mean, compared with MT5's bar index?
| What the rule reads | In a candle-close rule | In an on-tick or on-timer rule (tick mode) |
|---|---|---|
| Candle data and indicators, any timeframe | shift 0 = the bar that just closed = MT5 index 1; shift k = MT5 index k + 1 | shift 0 = the bar still forming = MT5 index 0; shift k = MT5 index k |
| Price Range (highest, lowest or height over N bars) | shift s = MT5's iHighest / iLowest start index s, so shift 1 includes the bar that just closed | shift 0 includes the forming bar (MT5 start 0); shift 1 = closed bars only |
Breakout trap. In a candle-close rule, "Close (shift 0) > Highest of N (shift 1)" can never be true: the window contains the bar whose close is compared (Price Range). Use shift 2 — the equivalent of MT5's
Close[1] > High[iHighest(…, N, 2)]. The editor does not warn about it: the numbering is MT5's own, so a rule ported from an EA keeps its start index.A higher-timeframe bar that closes exactly at the decision instant counts as just closed (a D1 bar closing at the 00:00 decision is shift 0).
Does bar mode have other delays against tick mode?
None of these is a look-ahead; each is a delay or an ordering (what bar mode assumes):
- A drawdown window with a timeframe rolls at the bar's open in bar mode and on the first tick in tick mode, so a loss on a window's first bar counts in that window in both. Bar mode decides a bar before the limit measures it, so an entry decided on the breaching bar fills at the next bar's open and is closed there by the pause.
Is a run deterministic?
- Yes. The same strategy, settings and data give the same result, trade for trade; nothing random or clock-dependent enters a run (same inputs, same result). MT5 is deterministic too, unless you choose its random-delay execution.
3. Prices and costs
Where does the spread come from in tick mode?
From the tick: fills, stops, targets, pending triggers and the equity mark all use that tick's recorded bid and ask.
With a virtual symbol on the instrument, a spread override — or a spread session covering the tick's time — replaces the ask with bid + points × tick size. A spread markup is then added to the ask, on top of the override or of the recorded ask. The bid is never changed.
MT5 with real ticks also uses each tick's spread; with generated ticks it uses the bar's spread.
Where does the spread come from in bar mode?
The bid is the bar's price (its close; for a deferred fill, the next bar's open). The ask is that bid plus the spread in force at the bar's open: a spread session, else the override, else the bar's recorded spread (the minute's average), plus any markup.
MT5's bar spread is the minute's smallest, ours the minute's average, so bar-mode buys, short exits and short stop and target checks pay a little more spread than MT5's OHLC mode. Measured on a GBPJPY strategy over two years on a 10,000 account: up to 5.39 per trade and −1,026 in total, always against the backtest. Tick mode is not affected.
Is slippage applied, and on which fills?
Slippage is a run setting in points (default 0), applied against you on every fill, closes included, and a virtual symbol can set its own value per instrument (slippage).
In tick mode a stop already fills at the breaching tick's price, so the gap and the slippage add up.
MT5's tester has no slippage setting. With "No delay", "all orders are executed at requested prices without requotes"; its random and fixed delays move the fill to a later price. To compare with MT5, leave slippage at 0.
How are commissions charged, and when?
Only through a virtual symbol attached to the instrument for the run; without one there is no commission. It is charged on each leg, opening and closing, per lot, flat or as a percent of notional (commission).
When it is booked: the opening commission is not taken from the balance when the position opens. It stays on the position and reaches the balance with the closing deal. Equity counts it from the open, so the drawdown, the drawdown limits, free margin and the stop-out see it while the position is open. In MT5's deal list every deal, the opening one included, carries its own commission.
On a netting account, one close that takes several fills is one deal: its closing commission is charged once and split across the fills by volume.
There is no minimum commission.
How are swaps charged?
- Only through a virtual symbol: rates per direction, in points or in percent per year, charged at the first step at or after the rollover minute (UTC, or a time zone you set, such as 17:00 New York), with one weekday charged three times, and booked either on the position (inside the closing deal, the way MT5 shows swap on the deal) or straight to the balance (swap).
- MT5 applies the swap settings of the symbol's specification. A custom symbol cloned from a broker keeps the broker's swaps until you disable them: in one comparison MT5 credited 1.77 per night and charged 12.84 across a weekend until swap mode was set to disabled.
What is a point worth?
Profit = (close − open) × contract size × lots, signed by direction, in the quote currency, then converted. There is no separate tick value.
The contract size is the catalog's — the reference broker's lot (silver: 5,000 oz) — unless a virtual symbol sets your broker's contract size and digits; they then apply to the whole run, and a point becomes 10^−digits.
MT5 symbols also carry a tick value. On the index custom symbol we compared (US100), the tick value gave 100 per index point per lot while the tester settled deals at a contract size of 1 (1 per point): an EA sizing from the tick value and the tester's profit disagreed by a factor of 100. Check which of the two your tester uses.
How is profit converted into the account currency?
Each quote currency that differs from the account currency converts through one catalog pair, direct or inverted, at that pair's bid: no third currency is used, and a run with an instrument whose currency has no such pair is refused when you start it (conversion).
Risk-based sizing converts the loss at the stop at the stop price when the conversion pair is the traded pair, as MQL5's
OrderCalcProfitdoes.MT5 converts with its own conversion price at the deal. Measured on a GBPJPY strategy with a USD account: at most 0.10 USD per trade, zero on average.
What does a run cost if I attach nothing?
- Fills at the feed's recorded bid and ask (the real Dukascopy spread); no commission; no swap; slippage = the run's setting; the catalog's lot limits (minimum 0.01 lots, step 0.01, no maximum), contract size and digits; the run's leverage for every instrument. The report's Broker costs panel shows commission and swap as "not simulated" and the spread as the recorded market spread (report). A sweep applies the virtual symbols attached when it starts to every combination (broker costs in a sweep).
How do I make a run behave like my broker's symbol?
Attach a virtual symbol to each instrument: commission, swaps, spread, slippage, leverage, hedged margin, lot limits, contract size and digits (virtual symbols).
It can also state the broker's stops level (broker presets carry it). It cannot set: a margin rate or margin calculation mode, a freeze level, trading sessions, a tick value separate from the contract size, or a minimum commission.
Presets built from cTrader brokers' own symbol data (their commission, swaps, lot, price grid and leverage) can be attached as well.
4. Margin and stop-out
How is margin computed?
- Used margin = lots × contract size × price × the conversion rate ÷ leverage, per position (or per larger side, if a virtual symbol says so), with the leverage of the instrument's virtual symbol or else the run's (margin).
- For Forex this is MT5's lots × contract size ÷ leverage, converted to the account currency. MT5 also has calculation modes and margin rates per symbol. There is no margin rate here, so an index your broker margins at 1:20 is margined at the run's leverage unless a virtual symbol sets the leverage. In one comparison MT5 refused, for lack of free margin, 9 of the 71 entries the backtest took.
Is an order refused for lack of free margin?
- Yes, before a market open and again when a pending order triggers; a triggered order the account cannot margin is cancelled, as in MT5. No margin is reserved while a pending order rests, and on a netting account an order that reduces or closes the position is never refused (margin).
Is there a margin call or a stop-out level?
There is no margin call and no stop-out level. Positions are liquidated only when equity falls below zero, and then every open position is closed, worst loss first, marked "Stop out", and the run ends; the balance ends below zero (stop-out).
MT5's tester has margin call and stop out levels you set, in money or in percent; at the stop out level "all orders are canceled and all trading positions are closed".
The equity-below-zero rule was derived from MT5's own run: at a 92.7% margin level MT5 did not liquidate the open position; it stopped opening new ones, which the free-margin check reproduces. A broker's or a prop firm's stop-out level (50%, for example) is not modelled.
Are margin level and deposit load reported?
- Each point of the equity curve carries the used margin and the deposit load (the highest used margin ÷ equity since the previous point). The report's "Margin level" is MT5's "minimal level of margin in percentage terms registered during testing": the lowest equity ÷ used margin × 100 the run reached. "OnTester result" shows "—".
5. Orders
At what price does a market order fill? Are there requotes or delays?
- Buy at the ask, sell at the bid, then slippage: the current tick in tick mode, the next minute's open in bar mode (market orders). There are no requotes, no delays and no partial fills; the only refusals are an unusable number, the lot limits, free margin, a stop or target on the wrong side, and one inside the stops level when the run's virtual symbol states one (every reason an order is refused).
- MT5 with "No delay" also executes at the requested price without requotes; its order checks also cover the freeze level (below).
When does a pending order trigger, and at what price does it fill?
- It triggers when the price touches the level and fills at the triggering tick's own price in tick mode, or at the order price in bar mode (a stop order whose bar opens beyond it fills at that open); orders triggered by the same tick fill newest first, and an order a rule places is first tested on the next tick or bar (pending orders). There are no stop-limit, OCO or trailing pending orders.
- On MT5's real ticks pending orders behaved the same: in the grid comparison, 2,100 of 2,106 orders matched on placement time, trigger price and volume, and every paired order ended the same way.
Can a pending order rest on the wrong side of the market?
- No. A buy stop at or below the ask, a buy limit at or above it, a sell stop at or above the bid, or a sell limit at or below it is refused when placed, as MT5 refuses it; in the comparisons both sides refused the same orders. An order price of 0 or an unusable number is refused too.
What if a market order's stop or target is already on the wrong side?
It is refused and nothing opens, as in MT5, in a backtest and live. The stop is measured on the closing side — a buy's stop against the bid — so a buy whose stop sits inside the spread is refused too (wrong-side stops). A pending order whose stop or target is on the wrong side of its own price is refused as well, as MT5 refuses it.
A change that would move a stop or a target to the wrong side of an open position is refused, in the backtest and live.
Are computed prices rounded the way NormalizeDouble rounds them?
- Yes. Every computed stop, target and pending price, and every trailed stop, is rounded to the instrument's digits; a
value exactly halfway rounds away from zero, as MQL5's
NormalizeDoubledoes, in a backtest and live. Where the data provider records more decimals than the instrument's digits, a backtest also reads the recorded prices rounded to the digits, as a broker quotes them (two precisions). - Before the rule matched, halves went to the even digit, and one comparison showed the cost: a target computed as 25240.685 became 25240.69 in MT5 and filled on the touch, while ours sat half a tick lower and filled on the next tick (one trade in 477; 0.34 USD). It now rounds to 25240.69 too.
Are the stops level and freeze level enforced?
The stops level is, when your virtual symbol states one (broker presets carry the broker's): an order whose stop or target is nearer the closing price than the stops level is refused, and a trailed or modified stop is kept that far away, as live keeps it at the broker's own distance. Without one a stop may sit one tick from the price. The freeze level is not modelled.
MT5 applies the symbol's stops level and freeze level; our comparisons set both to 0.
Is there an "end of day" pending order?
- No. There is no time-in-force setting: an order is good till cancelled unless its expiration time expires it, in a backtest and live (expiry).
- In MQL5,
ORDER_TIME_DAYis a "good till current trade day order" andORDER_TIME_SPECIFIED_DAYis "effective till 23:59:59 of the specified day". To port one, set the expiration to the end of the day you mean.
How are positions closed on a hedging account?
- A close rule closes every open position of its direction on every instrument, or only the positions its opening rule opened, or exactly one, the n-th by placement, when it names one; a partial close takes its volume from each matching position (closing positions).
- MT5's close-by (closing a position against an opposite one) does not exist here.
How does a netting account behave, and which account type does a run use?
One net position per instrument: same-direction orders add to it, opposite orders reduce it oldest fill first and flip it with any surplus (hedged and netting accounts). Each closed fill is a trade row; one close that takes several fills is one deal, and a reversal is one deal, as MT5 counts them.
A run uses the account type the strategy declares; there is no run setting for it (a sweep's combinations too), and a deployment refuses a broker account of the other type. All MT5 comparisons so far used hedging accounts.
What happens at the end of the run?
- At the end every resting order is cancelled and every open position is closed, marked "Forced close" — in tick mode at the last tick's time, as MT5 stamps its end-of-test deals (the end of a run). MT5 also closes open positions at the end of the test; its deals carry the comment "end of test".
6. Stops, targets and trailing
Which price triggers a stop or a target, and at what price does it fill?
A long is tested on the bid (bid ≤ stop, bid ≥ target), a short on the ask (ask ≥ stop, ask ≤ target); touching the level counts.
Tick mode fills at the breaching tick's own close-side price: a stop pays the gap, a target gets it. In the comparison this rule came from, every stop and target close of MT5's checked equalled an actual tick's price; before it, the backtest was 344.50 richer than MT5 over 15,855 trades.
Bar mode tests the bar's extremes (a short's on the bid extremes plus the spread) and fills at the level, except a stop the bar opens beyond, which fills at the bar's open (stops and targets).
What happens when the price gaps through a level?
- Tick mode fills at the first tick beyond the level, at its own price. Bar mode fills a stop loss or a stop order at the bar's open when the bar opens beyond it, so the gap is paid there too; a take profit or a limit order fills at its level (gaps).
When one bar reaches both the stop and the target, which wins?
- In bar mode the stop, always: the stop is checked before the target on every position, whatever the bar's direction, so a bar whose range covers both is booked as a loss. MT5's "1 minute OHLC" follows the order of its generated price points, so on some such bars it books the target.
- In tick mode the real tick sequence decides; a single tick beyond both levels books the stop.
Does a stop fill when the price only touches the level?
- Yes: equality fills, for stops, targets and pending orders. MT5 behaved differently once: a short's stop at 20423.67 met an ask of exactly 20423.67 at 08:08:37.483; the backtest filled there, MT5 waited for the next tick beyond the level (6 s later, 10.90 USD on 20 lots). One trade in 534.
How do trailing stops and break-even work, and how are their exits labelled?
They are part of the trade levels and run inside the engine, the same way in a backtest and live: three distances from the fill price, checked after each stop and target check, so a stop moved on one tick can be hit from the next (trailing stop and break-even).
A trailed or break-even stop that is hit is reported as Stop loss, as MT5 labels it
sl.Compared with MT5 EAs that trail in their own code: 905 of 905 and 782 of 783 trailing exits at the same price; a break-even-then-trail strategy matched on 15,855 trades.
Can several positions close on the same tick?
- Yes. Every open position is checked on every tick of its instrument, and all whose level the tick reaches close on that tick. On a strategy that stacks positions, all 280 exits matched MT5's.
7. Indicators
Which indicators have been compared with MT5's?
- Every MT5 built-in indicator has a counterpart in the catalog, with the same parameters in the same order (MT5's two ADX indicators are the Wilder and the Exponential smoothing of one, ADX); VWAP is the catalog's own. There are no custom indicators.
- Every one was compared value by value with MetaTrader's own values, exported from the terminal and fed MetaTrader's own bars, so the comparison checks the formula and its arithmetic. Each indicator's entry says where it stands: identical to the last digit where the test allows no tolerance, otherwise within a stated bound, with every row not judged named and explained (the record). The questions below explain each kind of difference.
- Parabolic SAR's preselected Wilder method is this platform's own rule and differs from MT5's on some bars after a reversal; its MetaTrader method is MT5's rule (Bollinger Bands and Parabolic SAR).
Is ATR the same as iATR?
Only with the Sma smoothing. MT5's
iATRaverages true range over a simple N-bar window. The editor preselects Wilder ((previous × (N − 1) + TR) ÷ N); with Wilder an ATR(14) was about 26% off MT5's on the record.In both smoothings the first value is the simple average of the first N true ranges, true range uses the previous closed bar's close, and the first bar's true range is high − low.
Is ADX the same as iADX?
With the Exponential smoothing it is
iADX's formula: each bar's directional movement is divided by that bar's true range and the ratios are smoothed with an EMA (k = 2 ÷ (N + 1)), then DX is smoothed the same way. The editor preselects Wilder, which isiADXWilder's formula ("ADX Wilder" in MT5's indicator list): true range and directional movement are smoothed first, by (previous × (N − 1) + value) ÷ N, and the DI lines are their ratios.The directional-movement rule is MT5's: a negative move counts as 0, the larger of the up and down moves wins, and equal moves count as 0 on both sides; a bar whose true range is 0 gives 0, and DX is 0 when both DI lines are 0.
The buffers are in MT5's order, so a port needs no remapping: 0 = ADX, 1 = +DI, 2 = −DI, as
CopyBuffernumbers them for both indicators.The starting values differ. MT5 starts its smoothings from 0; here each starts from the plain average of its first N inputs, so the DI lines have a value from bar N and the ADX line from bar 2N − 1. The difference fades by (N − 1) ÷ N a bar with Wilder and by 1 − 2 ÷ (N + 1) with Exponential, so the two agree only after a lead-in (recursive indicators). Measured: after a one-year lead-in (five years on D1), ADX(14) matched MT5's on every bar of two years of EURUSD on M1, H1 and D1, to 1e-6 and in fact within half a unit of MT5's last printed decimal (the record).
Moving averages: methods, applied price and shift
The methods are MT5's four: SMA; EMA (k = 2 ÷ (N + 1), starting from the SMA of the first N prices); SMMA (starting from that SMA, then (previous × (N − 1) + price) ÷ N); LWMA (weights N … 1). Against MT5's moving average from its first bar, SMA and SMMA agree within 1e-12 of the value from their first value (the SMMA starts from the SMA of the first N prices on both sides), the LWMA within 1e-12 on the exports checked on every test run and within 1e-7 over longer histories; the EMA starts differently (MT5's from the first price) and agrees within 1e-12 once that start has faded. After a one-year lead-in EMA(8) and EMA(21) were also within 1e-6 of MT5's on two years of EURUSD (the Moving Average).
The averages inside the other indicators (MACD, TRIX, DEMA, TEMA, Envelopes, the Alligator …) are computed as MT5's built-in moving average computes them, its exponential start from the first price included.
Applied prices use MT5's formulas: Open, High, Low, Close, Median (H + L) ÷ 2, Typical (H + L + C) ÷ 3, Weighted (H + L + 2C) ÷ 4. The editor preselects Close. Volume is also offered (what Volume means).
The Moving Average and Bollinger Bands editors show a Shift field (bars, default 0, at most 1,000). It works as MT5's
ma_shiftandbands_shift: the line is drawn that many bars to the right, so a read at shift s returns the value computed s + Shift bars back. With a Shift above 0, shift 0 is always a closed bar's value, never the forming bar's. The warm-up loads the extra bars, in a backtest and live.
RSI
- Wilder's RSI: the first value comes at bar N from the simple averages of the first N gains and losses, then average = (previous × (N − 1) + new) ÷ N; with no losses RSI = 100, with no gains 0. Started on the same bar as MT5's it is within 1e-12 of the value from its first value. It depends on all prior history, so a run that starts later agrees with an MT5 chart only after a long lead-in: H1 RSI(14) was within 0.05 after one year (RSI).
Bollinger Bands and Parabolic SAR
Bollinger Bands: middle = SMA(N) of the applied price; standard deviation over the N prices dividing by N; bands = middle ± deviation × standard deviation. Measured equal to MT5's to 1e-6. Buffer numbers differ: here 0 = upper, 1 = middle, 2 = lower; in MT5's
iBands0 = base (middle), 1 = upper, 2 = lower.Bollinger Bands' upper and lower bands are computed from running sums and lose a few digits to cancellation: against MT5's they are within 1e-10 of the value on the exports from MT5's first bar and within 1e-6 on the one-minute export; the middle line within 1e-12 (Bollinger Bands).
Parabolic SAR has two methods. Wilder, preselected, is this platform's own rule and differs from MT5's on some bars after a reversal: when the bar after a reversal crosses the reversal level but not the reversal bar's extreme, MT5 reverses again at once and Wilder does not. MetaTrader is MT5's rule and was compared with no tolerance. Both warm up over at least 64 bars (Parabolic SAR).
Do indicators see the forming bar, like MT5's index 0?
- In an on-tick or on-timer rule, shift 0 of an indicator on a timeframe above M1 is a provisional value: the committed
values plus one step on the bar still forming, as MT5 recomputes
[0]on each tick. In a candle-close rule it is the value of the bar that just closed. - The bar in progress carries its volume so far here, as MT5's does, so a volume indicator's
[0]counts the bar's ticks so far (indicators that read volume); in the minute a run starts in, the count starts at the run's start (volume). - One difference at the forming bar: it never confirms a fractal here, where MT5's built-in fractals test the bar two back against its newest bar, so on a live MT5 chart a fractal at shift 2 can appear and vanish while the bar forms (Fractals).
Where does a line start, compared with MT5?
- Each indicator's first value is on MT5's first valued bar. Where MT5 writes values on the warm-up bars (an exponential average started from the first price on bar 0, a zero), the line here has no value until it has taken its period, then equals MT5's from there: Bears and Bulls Power, the exponential methods of the Force Index, the Chaikin Oscillator, Envelopes and the Alligator are such lines.
- Each indicator starts its calculation as MT5's built-in does, so on an export that starts on MT5's first bar the two agree from the first value. Two exceptions: ADX (MT5 starts from 0, this platform from the average of the first N) and the Moving Average's EMA (above). Both fade bar by bar.
- A run here starts its indicators on the first bar of its warm-up, not on MT5's first bar of history, so a recursive line agrees with an MT5 chart only once its start has faded (recursive indicators); a running total (A/D, OBV) differs from an MT5 chart by a constant for good.
Lines drawn forward or back
- A read returns the line as MT5 draws it:
x[s]here is MT5's buffer at shift s, the cloud of Ichimoku and the Alligator's lines drawn forward, the Chikou span and the fractals back. The Gator's four lines are drawn as MT5's built-in draws them, five bars forward whatever the shifts, which is not what its example source does. - The part of a line MT5 draws ahead of the newest bar cannot be read here, and a read of a line drawn back nearer than its smallest readable position is refused (lines drawn forward or back).
Colour lines
- The colours of the Awesome and Accelerator Oscillators, the Gator Oscillator, the Market Facilitation Index and Volumes are read as numbers, compared with MT5's as whole numbers. They follow MT5's built-ins, which keep the previous colour on an unchanged value where the example sources write a fixed colour.
- Where MT5's line has no value, its colour buffer still holds something (0, or memory the built-in never wrote); here a colour line has no value there.
Where MT5's built-in writes a value that is not copied
- CCI and DeMarker on a window that did not move. MT5 carries its averages from bar to bar, and on a window of equal prices (CCI) or without a move (DeMarker) it divides one rounding residue by another, writing ±66.67 on CCI and a number between 0.13 and 0.85 on DeMarker. Here both read 0, MT5's own value for such a window without the residue. Seen on the one-minute export only, around the daily rollover.
- FrAMA on a window without range. MT5 takes the logarithm of zero and its line stays empty from then on; here the line takes the price and carries on (FrAMA).
- The Market Facilitation Index on a bar without volume. MT5 multiplies the previous index by 10 to the power of the symbol's digits, again on each such bar; here the bar carries the previous index, as MT5's example source does.
- In the comparison these rows are named and not judged; nothing else is excluded.
How much history warms the indicators up?
Before the start date the engine loads as many bars as the strategy's longest look-back needs; if an instrument's history starts too late, the first bars inside your range finish the warm-up and the first decision comes after your start date (warm-up).
An MT5 EA's indicators already have values at its first tick, so the first one or two trades of a run can differ.
Why can a trade still differ when the bars and the indicators agree?
- Ties. At a moving-average cross the two averages can be equal to the 8th decimal on both platforms, and which one is "above" then depends on the 15th or 16th digit, where each platform's additions round differently. The entry or the exit moves by one bar: 31 of 8,738 trades on an M1 SMA 20/50 cross. Changing every price by one part in a billion moved 55 to 78 of about 3,700 trades of another strategy in the backtest itself. No platform can match another on every such trade; the comparisons name and cap these cases.
8. Time
Which clock do the rules run on?
Every bar and tick is in UTC. The strategy names a time zone (an IANA zone, with daylight saving), and the time-based rules are decided in that zone: hour, minute and weekday values, session ranges, session profit periods, the bar boundaries and candle closes (your strategy's clock). A strategy's D1, W1 and MN1 drawdown windows follow that zone's calendar too, the shorter ones roll from the moment they open, and account drawdown limits follow UTC or the day start set on them (windows). Backtest and live convert the same UTC instant through the same zone.
In MT5 every time is broker server time, and in the tester "the local time TimeLocal() is always equal to the server time TimeTradeServer() … always equal to … TimeGMT()".
The New York close zone is the broker clock of "New York + 7 hours" (UTC+2/+3 switching on the US dates) that MT5 brokers' servers keep: choose it to get your broker's D1 and W1 bars and hours exactly. Europe/Bucharest equals it except in the weeks between the US and the European daylight-saving changes, when it is one hour off (your strategy's clock).
Which time zone does a new strategy get?
- Europe/Bucharest (EET/EEST), chosen for MT5 brokers' server clocks; a strategy created without a zone gets UTC (your strategy's clock). Hour rules mean Bucharest hours unless you change the zone; data and result timestamps stay in UTC. The zone is on the strategy's header line and in each report's Setup row.
9. The report
Which report figures are defined as in MT5, and which are not?
Defined as in MT5: total net profit; gross profit and gross loss (loss negative); profit factor (gross profit ÷ |gross loss|); expected payoff (net ÷ trades); recovery factor (net profit ÷ equity drawdown maximal); balance drawdown absolute (deposit − lowest balance), maximal (largest money drop, with its percent) and relative (largest percent drop, with its money); equity drawdown absolute, maximal and relative, measured on every tick; AHPR, GHPR; LR correlation and LR standard error; Z-score with its probability; largest and average winning and losing trades; consecutive wins and losses (count and money).
Different:
- Profit factor with no losing trade shows "—" with "no losing trade", and ranks as the best value. MQL5's value is DBL_MAX.
- Sharpe ratio = mean ÷ standard deviation of day-to-day returns of each UTC day's last equity, × √252, risk-free 0; days without data are skipped, and with fewer than three days it reads "—". MT5 states only "(Return − Risk-Free Rate) / Standard Deviation of Return" with a zero risk-free rate, so the two figures need not agree.
- OnTester result and History quality are not computed. Margin level is MT5's minimal margin level (margin level).
- On a netting account each closed fill is its own trade with its own ticket; total deals still counts deals as MT5 does (below).
- Swap booked to the balance is a balance operation, outside every trade; AHPR, GHPR and the LR figures still read the balance with it.
Every figure is defined on The report's numbers. The MT5 comparisons check the trade-by-trade list and the running balance. On every real-tick comparison that pairs trade by trade they also assert five figures of MT5's Results block — gross profit, gross loss, profit factor, expected payoff and balance drawdown maximal — within that comparison's measured difference (on p10's short slice, to the cent; on p01, within 5 in money and 0.006 on the ratios); p05 and every bar-mode comparison record them without asserting. On all 22 MT5 reports, MT5's recovery factor equals its net profit ÷ its equity drawdown maximal, and every comparison that pairs trade by trade asserts it. The Sharpe ratio is read but not compared.
How is drawdown sampled?
- The maximal equity drawdown is updated on every simulated step: every tick in tick mode; in bar mode every bar's close plus the bar's worst case (longs at the bar's low, shorts at its high plus the spread). MT5 computes equity on the ticks it models. Balance drawdown walks closed trades in close order, with balance-booked swaps in between.
How are "Total deals" counted?
- As MT5 counts them: one deal for each execution that opens a position and one for each execution that closes some or all of it. A position closed in three parts is three trades and four deals (one opening, three closing), as in MT5. On a netting account one close that takes several fills is one deal, and a reversal is one deal. On one comparison the opening-deal count equalled MT5's own (838).
In which clock are the entries-by-hour, weekday and month charts?
- In the strategy's time zone, which each chart names: a trade is binned by its open hour, weekday and month on that clock, each position once (distribution charts). MT5 bins by server time, so a strategy on the New York close zone bins as an MT5 broker's report does.
Are MFE and MAE kept per trade, like MT5's charts?
- Yes, in account money: each open position's floating profit updates its best and worst value on every step — every tick, or in bar mode each bar's favourable and adverse extremes — and the trade list and the report's charts use them. A partial close carries the whole position's values.
10. Optimization
What does the optimizer offer compared with MT5's?
A complete grid only: each swept setting is a numeric range from start to end by step, both ends included, or a list of choices; every combination is one backtest with the same dates, deposit, leverage, currency and virtual symbols, on the strategy's own account type.
There is no genetic algorithm, no "all symbols" sweep and no optimization criterion to choose: there is no Result or Custom column. Where MT5's forward period is one split — the end of the period held back and tested once — a walk-forward here cuts the period into rolling folds, each swept on its in-sample months and its winner tested on the out-of-sample months that follow. Each result shows net profit, profit factor, Sharpe ratio, maximal equity drawdown %, trades, expected payoff and recovery factor (net profit ÷ maximal equity drawdown), and the table sorts and the chart ranks on whichever of them you pick. A sweep runs at most 2,000 combinations in bar mode and 200 in tick mode, and a tick-mode sweep covers at most 20 years (limits).
MT5 offers slow complete, fast genetic and all-symbols optimization; eight criteria (Balance, Profit Factor, Expected Payoff, Drawdown, Recovery Factor, Sharpe Ratio, Custom via OnTester, and Complex Criterion); and a forward period (1/2, 1/3, 1/4 or a custom start).
11. Sizing and risk controls
How is a computed lot size rounded? Can it exceed the risk I set?
- A computed size is rounded down to the lot step, then kept inside the symbol's lot limits: a size below the minimum lot becomes the minimum lot — more risk than you set — and a size above the maximum is cut; a fixed lot is used as typed and refused if it is off the step or outside the limits (volume, sizing modes).
- MT5 only checks an order against the symbol's lot limits; rounding is the EA's job.
Are there built-in drawdown limits?
- Yes; MT5 has none (an EA codes its own). A strategy's Overall limit (from the highest realised balance) and Static overall limit (from the starting balance) halt the run, and a timed limit closes every position and pauses the rules until its window passes. D1, W1 and MN1 windows follow the calendar of the strategy's time zone (from midnight, Monday, the 1st); the shorter windows roll from the moment they open. A broker's or a prop firm's day that starts at another hour is followed by an account limit's day start, not by a strategy limit (strategy limits). The opening commission of an open position counts in the equity they watch.
Do balance and equity mean what they mean in MT5?
- Yes. The one difference is when the opening commission reaches the balance: here with the closing deal, in MT5 at the opening deal; equity counts it from the open on both (balance, equity and free margin).
12. Limits MT5 does not have
- A run fails — it is never cut short silently — when it exceeds the completed-trade cap, the cap on positions open at once, or its time budget, which grows with the simulated years (limits that can stop a run). A strategy is capped in size and in per-tick work (hard limits, complexity). MT5's tester has no such caps.
13. Replay compared with MT5's visual mode
- MT5's visual mode runs the test again, drawing the chart as it goes. The replay here is a recording the run makes when you ask for it: candles as they arrived, every fill, change, refusal and close, stop and target levels as they moved, each condition's result with the values it compared, and every value the strategy read, on the strategy's clock. You can play it forward and back. Recording does not change the result. It is kept for a limited time, and in tick mode a window can be recorded at full tick resolution (Replay).
14. Can I trade it on my MT5 account?
No. Live trading runs on cTrader accounts; there is no MetaTrader connection. An MT5 strategy is tied to MT5 brokers; a strategy here refers to canonical instruments (EURUSD, XAUUSD, …) that are mapped to each broker's own symbols, so it is built to run unchanged on any supported broker — cTrader today. See Live execution → one engine, built for many brokers.
Live, the broker's own symbol specification applies (contract size, digits, lot limits); in a backtest the catalog's, unless a virtual symbol sets your broker's. Attach a virtual symbol with your broker's specification to the backtest to see the numbers you will trade.
Not yet documented
- Where MT5 starts a weekly bar. Here a W1 bar starts on Monday 00:00 in the strategy's zone; whether your MT5 terminal starts it on Sunday or Monday has not been checked.
- MT5 and a price exactly at a stop. One case in 534 trades showed MT5 waiting for a strict breach; whether that is MT5's rule for every stop has not been established.
- The order of MT5's four "1 minute OHLC" prices on a bar — and therefore exactly which bars that reach both levels MT5 books as wins — is not stated on the MetaQuotes page we checked.
- MT5's Sharpe ratio: the return series it uses is not published, so the two Sharpe ratios cannot be reconciled.
Questions?support@algotradinghub.io