Strategy Backtester
Backtest signal strategies over real exchange candles — the same WASM indicator engine computes your ENTRY/EXIT lines, and the simulator fills at the next bar's open with fees, slippage and optional protective stops.
How fills are simulated
ENTRY / EXIT are 0/1 output lines of the same array DSL the Indicator Lab uses — the WASM engine computes them over the loaded candles; any other output lines are drawn on the chart.
Beyond H L O C V, formulas can reference data series by name — DATE TIME MKTCAP TVOL — auto-loaded and aligned to the bars (CoinGecko series are daily, forward-filled on intraday charts).
A signal known at bar close fills at the next bar's open (no lookahead bias), worsened by slippage; fees apply per side.
Stop-loss / take-profit trigger intrabar against the bar's low/high — gaps fill at the open, and when both are touchable in one bar the stop is assumed first.
Long-only, all-in per trade; an open position at the end of the data is closed at the last close. Sharpe/Sortino are annualized from per-bar equity returns.
Backtest the MA Cross 5/20 strategy on real crypto candles
The MA Cross 5/20 strategy is trend-following in its simplest form: go long when the 5-bar moving average crosses above the 20-bar, and exit when it crosses back below. It stays flat in downtrends and re-enters quickly after upturns, at the cost of whipsaw losses when price chops sideways.
This page loads the exact rules into the backtester — both moving averages are drawn on the chart and ENTRY/EXIT are the same CROSS() events the Indicator Lab marks visually. Orders fill at the next bar's open with your chosen fees and slippage, then the simulator reports the equity curve, Sharpe and Sortino ratios, max drawdown, profit factor and the complete trade list.
How it works
- Pick a trading pair, interval and number of bars.
- The strategy ENTRY/EXIT formulas load into the editor, fully editable.
- Set fees, slippage and optional stop-loss / take-profit.
- Run the simulation and inspect the equity curve, Sharpe/Sortino, drawdown and trade list.
Frequently asked questions
When does the MA Cross 5/20 backtest enter and exit trades?
It enters long on the bar where MA(C,5) crosses above MA(C,20) and exits when MA(C,20) crosses back above MA(C,5). The fill happens at the next bar's open — signals are only confirmed at bar close, so there is no look-ahead bias.
Is the moving-average crossover profitable on crypto?
It depends on the pair, interval and fee regime: crossovers capture large trends but bleed through small losses in ranging markets. That is exactly what this backtester quantifies — run it across several pairs and intervals, then use the Multi-Coin Scanner to check how the rule performs out of sample.
More strategy backtester pages
MACD Cross · RSI 30/70 · Bollinger Breakout · KDJ Cross · Donchian 20/10
Related tools
Moving Averages in the Indicator Lab · MA Cross Signals in the Indicator Lab