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 MACD Cross strategy on real crypto candles
The MACD Cross strategy trades momentum shifts: it goes long when the MACD line (EMA 12 minus EMA 26, here named DIF) crosses above its 9-period signal EMA (DEA), and exits when the lines cross back down. Compared with raw moving-average crosses, the extra EMA layer smooths entries slightly and reacts to momentum rather than price level.
This page loads the full rule into the backtester with DIF and DEA drawn beneath the price chart. The simulator fills at the next bar's open, applies your fees and slippage, and outputs the equity curve, Sharpe/Sortino, max drawdown, profit factor and trade-by-trade list — all computed locally in your browser.
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
What are the exact entry and exit rules of this MACD backtest?
ENTRY fires when DIF = EMA(C,12) − EMA(C,26) crosses above DEA = EMA(DIF,9); EXIT fires on the opposite cross. Fills happen at the next bar's open, and fees and slippage are configurable, so the reported metrics reflect tradable, not theoretical, performance.
How does the MACD cross differ from the MA 5/20 cross?
MACD crosses are smoothed twice (EMA difference, then EMA of that), so signals arrive a bit later but with fewer whipsaws than a fast 5/20 price-average cross. Whether that trade-off pays off is pair- and interval-specific — you can backtest both presets here in seconds and compare.
More strategy backtester pages
MA Cross 5/20 · RSI 30/70 · Bollinger Breakout · KDJ Cross · Donchian 20/10