# How Janorium backtests

> The methodology behind every Janorium backtest: Binance data since 2020, when orders fill, how stops, fees, funding and liquidation work, and what is not modeled.

Guide · Janorium · Published 2026-11-05  
Web page: https://janorium.com/guides/how-janorium-backtests

Janorium replays a strategy over Binance spot or USDT-M perpetual candles from 2020 on: rules are checked on each closed candle, orders fill at that candle’s close by default, stops are checked against the candle’s high and low, and fees, slippage, funding and liquidation are charged as described below. This page lists every assumption, including what the engine does not model — read it before trusting or quoting a result.

## Market data

- **Exchange and markets.** Binance only: spot and USDT-M perpetual futures. Coin-margined futures and other exchanges are not available.
- **Period.** A run starts on 2020-01-01 or later. Indicators may warm up on earlier history where Binance has it.
- **Timeframes.** A run uses 1m, 5m, 15m, 1h, 4h or 1d candles; a condition can also read weekly and monthly values. Which coin has which timeframe depends on the data loaded — the chart pages show it.
- **Funding.** Real settled funding rates from Binance, one record per settlement.
- **Delisted coins.** Perpetuals that Binance has since delisted stay available on 1h and 4h candles up to their delisting date, so a test over many coins can avoid [survivorship bias](https://janorium.com/articles/survivorship-bias-crypto-backtest).
- **Gaps and duplicates.** Missing candles are not invented: the engine moves on to the next stored candle. If the same candle is stored twice, the newest copy wins.

## When an order fills

Conditions are evaluated once per candle, after it closes. A signal on a candle fills **at that candle’s close**, moved against you by the slippage. The strategy can switch to **next open**: the order then fills at the open of the following candle, and the entry is checked again on that candle.

A strategy can also place a resting **limit** or **stop** entry at a distance from a reference price, valid for a set number of candles. A limit buy fills when the price trades below its level — at the level, or at the open if the candle opened lower — with the maker fee and no slippage. A stop buy fills when the price reaches its level, at the level or the open beyond it, with the taker fee and slippage. Sells mirror this.

## Stops and take-profits inside a candle

- **Levels are checked against the high and low** of each candle, not only its close.
- **The stop wins a tie.** When one candle touches both the stop-loss and the take-profit, the engine assumes the stop came first. The report counts such trades and shows what the result would have been with the take-profit first, so you can see how much the choice matters. A strategy can ask for 1-minute or 5-minute candles to settle exactly those candles.
- **Gaps fill at the open.** If a candle opens beyond the stop, the exit is at the open, not at the stop price.
- **Trailing stops** follow the highest close (lowest for a short) at a multiple of ATR, only ever tighten, and a level set on one candle is first checked on the next.

## Fees and slippage

- **Fees** are a percentage of the trade’s value, charged on entry and on exit. One rate means the taker fee on every fill; a strategy can set separate maker and taker rates, and the maker rate applies to filled limit entries only. On spot, fees are paid in the quote currency.
- **Slippage** moves every fill against you, on entry and exit: a fixed percentage, a share of ATR, or an impact that grows with the order’s size relative to the candle’s volume. An optional cap skips or cuts orders that would be too large a share of the volume.
- **Defaults.** A new strategy in the editor starts at 0.1% fee and 0.05% slippage per side. A config sent through the API without them runs with no costs at all. Realistic values are in the [how-to guide](https://janorium.com/guides/how-to-backtest-a-crypto-strategy).

## Futures: leverage, funding, liquidation

- **Leverage and margin.** Whole-number leverage from 1× to 125×, isolated or cross margin. Margin is the position’s value divided by the leverage. Cross margin is simplified to one coin’s account.
- **Funding** is charged at every recorded settlement while the position is open: quantity × mark price × rate. A long pays when the rate is positive and receives when it is negative. On isolated margin, paid funding moves the liquidation price.
- **Liquidation price** = entry × (1 − 1/leverage + 0.4%) for a long, entry × (1 + 1/leverage − 0.4%) for a short — a flat 0.4% maintenance margin. It is checked inside the candle on the last-traded high and low, before stops, unless a stop between the open and the liquidation price closes the position first. A liquidation fills at the liquidation price with the taker fee and slippage.

## Position size, capital and warm-up

- **Size** is a percentage of free equity, a fixed amount, a risk percentage tied to the stop, or a volatility target. Quantities are not rounded to the exchange’s lot size. An entry that does not fit the free equity is skipped, never filled in part.
- **Several entries** — layers, pyramiding and DCA with safety orders — are supported.
- **Capital.** The new-backtest form starts with 10,000 USDT.
- **Warm-up.** Indicators are computed on candles before the start date (up to 50,000 of them), so the first trade does not wait for a 200-period average to fill. Statistics, the equity curve and buy & hold start on the start date.

## How the metrics are computed

| Metric | How |
| --- | --- |
| Total return | Final equity ÷ initial capital − 1 |
| CAGR | (final ÷ initial)^(365 ÷ days) − 1, from the first to the last candle of the run |
| Max drawdown | Largest fall from a running peak of equity marked to market at each candle’s close (not inside the candle) |
| Sharpe, Sortino | Daily returns from the last equity of each UTC day, risk-free rate 0, annualized with √365 |
| Win rate | Share of trade rows with a positive net result; each partial exit is a row of its own; fees and funding included |
| Profit factor | Sum of winning trades ÷ sum of losing trades |
| Buy & hold | Close of the first candle to close of the last, without fees or funding |

What the numbers mean and which values are good: [backtest metrics explained](https://janorium.com/guides/backtest-metrics-explained).

## No look-ahead

- A higher-timeframe value (a daily average on a 1h strategy) comes from the last **closed** higher candle only.
- A condition on another coin reads only candles that closed no later than the current one.
- Funding conditions read the last settled rate, not the next predicted one; the taker buy/sell ratio is shifted by one period so that a candle never sees its own future.

## What the engine does not model

- Order book depth and market impact, beyond the optional volume-based slippage.
- The bid-ask spread as a separate cost, partial fills, and latency.
- Exchange rules: lot size, tick size and minimum order value.
- Liquidation by mark price, tiered maintenance margin, the exchange’s liquidation fee, auto-deleveraging and the insurance fund — real liquidations can come earlier and cost more.
- Shorting on spot, coin-margined futures, and one margin account shared by several coins.
- Exchange outages: candles that are missing are simply absent.

> **Results are recomputed only when you run again**
>
> When the engine is corrected, stored runs keep the numbers they were computed with. Rerun an old backtest before comparing it with a new one.

## Questions

### Does Janorium fill at the close or at the next candle’s open?

At the close of the candle that gave the signal, plus slippage, unless the strategy chooses “next open”: then the order fills at the open of the following candle.

### Which comes first when one candle hits both the stop-loss and the take-profit?

The stop-loss — the cautious assumption. The report shows how many trades this affected and the result had the take-profit come first.

### Are funding payments included in futures backtests?

Yes. Every real Binance funding settlement during an open position is charged or credited: quantity × mark price × rate.

### Is there survivorship bias in Janorium backtests?

Delisted perpetuals stay available on 1h and 4h candles up to their delisting, so a test over many coins can include the ones that later disappeared. Delisted spot coins are not kept.

### How is the max drawdown calculated?

From equity marked to market at the close of every candle, net of fees: the largest fall from a previous peak. Moves inside a candle are not counted.
