Run a strategy over a grid of its own values, each cell under the same conditions, then choose on one stretch of days and test on the next — anchored or rolling — with every cell counted.
A batch
A batch runs one saved strategy once for every combination of the values you give it. For example, an RSI period of 10, 14 or 20 times a stop of 1, 1.5 or 2 ATR makes nine cells. Each cell runs on a workbench of its own, made over every condition of the workbench you start it from: its days, markets, time zone, account and costs. Each runs from the first moment at machine speed. So the cells differ only by the values in the grid.
Start one from the Run sheet: Batch: one run per combination of figures.
- A figure is named by its path in the strategy document:
studies.rsi.settings.period,exits.stop.atr.times,sizing.value, or a script'sscript.inputs.<title>. See the strategy document. - Two figures vary the cells' workbenches rather than the document:
tick_model:real,every-tick,ohlc-m1oropen-only, the tick models;spread_multiplier: any number above zero, 1 being the spread as recorded.
A batch over them shows whether a result survives cheaper or harsher conditions. Its record compares the results under each, and flags a result whose sign flips.
- How many at once: the computer's cores less two, unless you say otherwise.
- Plan first: a dry batch answers the cells and an estimate of how long they will take, and makes nothing.
- A cell the validator refuses is named by its field and never run. The rest run.
- The largest batch is a setting. Past it the batch is refused with the number.
Each cell is a workbench you can open, replay and inspect. It stays in the laboratory until you remove it. A cell is queued, arming, running, ended (with its run), refused or not started, each with its reason.
Stop ends the running cells as a run's Stop does, starts no more, and keeps what settled.
01A batch's statistics against chance
Once every cell has settled, the batch's line reads, for example, Deflated Sharpe 0.71 · PBO 0.34 · 26 trials. Behind it:
- for the cell with the highest net: its probabilistic and deflated Sharpe ratio, the minimum backtest length the result would need, and the Harvey–Liu haircut, each over every trial the ledger counts for this strategy;
- the probability of backtest overfitting over the cells;
- the cells' interquartile mean, with a bootstrap interval;
- the baseline: the first market's own price change over the days, what doing nothing but holding would have made.
Each is explained in statistics against chance.
02Walk-forward
A walk-forwardWalk-forwardChoose a strategy's settings on one stretch of history, then test them on the next stretch they never saw — repeatedly, moving forward. cuts the workbench's days into windows. Each window has an in-sample stretch, the days the settings are chosen on, and the out-of-sample days after it, which the choice never saw. For each window in turn, Bentrix:
- runs the grid as a batch over the in-sample days;
- chooses the cell with the highest in-sample net;
- runs it, exactly as chosen, over the out-of-sample days.
Then it moves on to the next window. Start one from the Run sheet: Walk-forward, with the In-sample days, the Out-of-sample days and Anchored.
- Anchored: every in-sample stretch starts at the first day and grows. Rolling: each takes only the days just before its out-of-sample stretch.
- A walk runs on the workbench's own tick model and spread, so
tick_modelandspread_multiplierstay out of its grid. - The answer is each window's stretches, its batch, the figures chosen with their in-sample net, and the out-of-sample trades and net. It also gives the efficiency: the out-of-sample net a day over the in-sample net a day. A strategy that holds up keeps a good part of its in-sample result out of sample. One that was fitted to noise keeps little or none.
- Read the out-of-sample total. It is the only figure made on days no choice ever saw: Out of sample: 214 trades · 1,284.50.
Every cell of every window, and every out-of-sample run, is a trial in the ledger, named by the walk and its window.
03From a program
strategy_batch (with dry to plan), batch_get and batch_stop; strategy_walkforward, walk_get and walk_stop. The SDK guide on testing honestly runs a batch and reads it against chance.