Backtesting
jorli backtest infy-ema-crossover --from 2025-01-01 --to 2025-12-31 --broker kitejorli backtest infy-ema-crossover --from 2025-01-01 --to 2025-12-31 --json --no-colorJorli asks the selected authenticated broker CLI for candles. It tries the other broker only when no broker was explicitly selected. Production backtests fail when fewer than 60 unique, in-range candles are available; synthetic candles are never silently substituted.
Successful broker reads are upserted into the SQLite candle cache with source provenance. If all
broker reads later fail, an in-range cache can reproduce the run and is labeled
sqlite-cache(<sources>); demo generation still requires explicit strategy opt-in.
The engine evaluates a crossover on a completed candle and fills no earlier than the next candle open. Stops take conservative precedence when stop and target are both touched inside one bar. The report records:
- strategy ID and immutable version;
- date range, engine version, data source, and SHA-256 candle fingerprint;
- gross/net P&L, return, CAGR for year-plus windows, drawdown and duration;
- win rate, expectancy, profit factor, Sharpe, Sortino, wins/losses, losing streak, exposure;
- costs, monthly returns, equity/drawdown series, and the complete trade ledger.
The cash-equity statutory model distinguishes intraday and delivery STT/stamp duty and uses the NSE cash transaction/IPFT rate effective 1 March 2026. Brokerage and slippage remain strategy assumptions because broker plans and fill quality vary.
Futures reports use whole lots, the contract tick and freeze quantity, and a capital cap based on
the configured initial-margin percentage rather than full notional. The versioned
india-futures-2026-05 cost model applies capped futures brokerage, sell-side STT, NSE transaction
charges, SEBI fees, GST, and buy-side stamp duty effective 1 April 2026. Continuous-contract
research retains the source contract, rollover marker, and futures-minus-spot basis for every
point. The higher futures STT rate is effective 1 May 2026; the model does not erase roll
provenance through back-adjustment.
The version is anchored to the Finance Bill 2026 statutory amendment and the current Zerodha F&O charge table. Charges and broker plans can change, so a newer dated model must replace this version rather than silently rewriting old reports.
Data caveats
Section titled “Data caveats”Broker candle history is not automatically corporate-action adjusted. The fingerprint makes the exact input reproducible, but it cannot make unadjusted source data suitable for a split or bonus period. Review instrument provenance before relying on long-range results.
Advanced research
Section titled “Advanced research”jorli research infy-ema-crossover --from 2024-01-01 --to 2025-12-31 \ --fast 10,20,30 --slow 40,50,80 --atr 1,1.5,2 --folds 3 --seed 42Research uses trading-day boundaries to keep the final 30% holdout untouched while selecting
parameters on the earlier exploratory partition. It also runs anchored walk-forward validation by
default (--rolling selects rolling windows), seeded bootstrap Monte Carlo analysis, parameter
sensitivity, trend/volatility regimes, buy-and-hold benchmark comparison, survivorship and data
quality warnings, and overfitting diagnostics. The parameter grid is capped at 100 combinations.
Every trial retains its parameter set, input candles and fingerprint, source, cost model, backtest engine, research configuration, and result. SQLite migration v5 stores research runs, and normal backup/export includes them. Exploratory trials are visibly labeled and never approve, edit, or deploy a strategy. Only the separately evaluated holdout is labeled independently validated.
Add --portfolio other-strategy-v2,third-strategy-v1 to run the exact immutable component
strategies over the requested period and report date-aligned return correlations plus an
equal-weight portfolio return and drawdown. The dashboard provides the same workflow.