|
PineForge v0.1.2-7-ga095e36
Deterministic PineScript v6 backtest runtime — C ABI reference
|
A/B comparison of the same strategy run with and without the bar magnifier. Quantifies the difference in trade count, fill prices, and net PnL.
The magnifier only fires when script_tf > input_tf — i.e. the runtime is aggregating finer input bars up to a coarser script timeframe. With input_tf == script_tf, there's no extra resolution to recover; turning the magnifier on changes nothing.
The tutorial MACD strategy ships at 15-minute timeframe. Running it with input_tf="15", script_tf="60" (15-minute feed driving an hourly strategy) makes the magnifier sample intra-hour fills from the 15-minute bars.
ta.crossover evaluated at script-bar close) is bar-close-deterministic. Distribution modes only differ when the script has intra-bar strategy.exit(stop=…) brackets, trail stops, or take-profit limits — see Bar magnifier.| Observation | What it tells you |
|---|---|
sub_bars_total is 0 with magnifier on | Either the magnifier was actually off, OR script_tf == input_tf and there's nothing to magnify. |
| Trade count goes up with magnifier on | Stops/limits resolved intra-bar that would otherwise have rolled over to next-script-bar fills. |
| Trade count unchanged, PnL changes | Same fills, but at finer-grained prices — typical for strategy.exit(profit, loss) brackets. |
| Distribution modes give different PnL | Strategy has intra-bar exits (stops, limits, trailing). |
| Distribution modes give identical PnL | Strategy is bar-close-deterministic — distribution choice doesn't matter. |
ticks_total ≈ samples * sub_bars_total | Healthy sample density. Big gap → check for sub-bars too small to magnify. |
strategy.exit(stop=…, limit=…) brackets — the OCA pair fills on whichever level is hit first inside the bar.strategy.exit(trail_points=…, trail_offset=…) — trailing stops update on every magnified sample.strategy.close(qty_percent=…) partial closes triggered by an intra-bar level.strategy.entry from inside an if barstate.isconfirmed == false block.For pure bar-close strategies (the tutorial MACD is one), the magnifier is a no-op on PnL — only magnifier_sub_bars_total changes.