Articles ·
Backtest audit, part 1: the simulator, the indicators and the warm-up
The backtest is the core of Metrand: it is what a strategy is judged by before it trades money, and soon it will be open to your own tools and agents through the API. So we went through it brick by brick, with one standard: the exchange, not our own live code, decides what is right. Where a rule flattered a strategy, we replaced it with the one that costs it; where the engine guessed in silence, it now says so in the report or refuses the request.
This is the first part. It covers the simulator, the indicators and rules, and the warm-up.
The simulator
Full rules: How a Metrand backtest fills orders inside a bar.
- Each bar is walked both ways (open → low → high → close and open → high → low → close), and the path that leaves the account worse at the close is kept. Trades whose result depends on the order are marked "either way".
- Drawdown is the worse of the two paths.
- A stop between two rungs of a ladder fires before the deeper rung fills.
- A resting limit order fills only when the price trades through it, not on a touch.
- A post-only order that would cross the book at the open is rejected, as the exchange rejects it.
- A resting entry is cancelled after the strategy's bar, as a live run cancels it.
- Liquidation takes the whole balance, settled at the bankruptcy price.
- Funding inside a bar: charges fall on the position held at the open; payments only on a position still held at the close.
- Finer candles can be sent under the bars, so the account is marked on, say, every minute of a 15-minute bar. They are checked strictly: in time order, dividing the bars evenly, covering every traded bar.
What it did to results: on the martingale ladder we measured across ten coins, yearly returns moved by between −2 and +4 percentage points.
| Martingale basket | Before | After |
|---|---|---|
| 2021 | +8.4% | +12.1% |
| 2022 | +36.6% | +34.7% |
| 2023 | +22.2% | +22.0% |
| 2024 | +21.7% | +20.8% |
| 2025 | −64.7% | −65.7% |
| Last 12 months (Oct 2025 – Sep 2026) | −86.7% | −87.4% |
A liquidation on BCHUSDT in May 2021 that an earlier version of the engine reported turned out, on 1-minute candles, not to have happened.
Indicators and rules
Full rules: Indicators and rules.
- Averages start like TA-Lib and TradingView: from the plain average of their first
periodbars, and empty until then. EMA, RMA, DEMA, TEMA, MACD, PPO, TSI, RSI, ATR and NATR. - Empty means unknown:
all,any,notand crossovers no longer read a warming input as false. comparewithepscompares with a margin, as documented;approx_eqateps0 is exact equality;in_rangedefaults to 0–100.- HMA rounds like TradingView; Stoch RSI is documented as 0–100.
- Graphs that would have done nothing in silence are refused when saved: a ladder wired through a risk node, a long ladder reaching below zero, a period of 1 where it cannot mean anything. A deep doubling ladder no longer overflows.
- Warm-up requirements now add up along chains of indicators and allow exponential averages to settle.
Warm-up before the window
Full rules: A backtest warms up the way a live run does.
Every backtest now runs the strategy over the history a live run warms on — 1,000 bars, or a week of candles for range bars — before its window, and trades from the window's first bar. Comparisons, periods, baskets, the optimizer and the template showcases all do the same.
Next
Part 2 covers the data a backtest is given: strict candle validation, funding coverage, each market's own lot rules, leverage tiers and maintenance margin per venue, multi-market strategies stamped by bar close, and maker offsets in price ticks as a live run places them.