v6.4.1 — Bar Magnifier & calc_on_order_fills
Bar Magnifier
Strategy orders now use lower-timeframe (LTF) sub-bar data to determine the chronological order
of intrabar fills. When a bar's price path hits both a take-profit and a stop-loss, the magnifier
resolves which was hit first using actual 1-minute (or other LTF) candles instead of the
simplified OHLC assumption.
- Bar magnifier is now enabled by default for all strategies (
use_bar_magnifier=True) - CLI:
--magnifier-tfflag to specify the sub-bar timeframe (default: auto-detected) - Verified against TradingView reference trades on real BINANCE:BTCUSDT data
calc_on_order_fills & IBPersistent (varip)
When calc_on_order_fills=True, the script re-executes after each order fill on a bar:
Persistent[T](var) variables are rolled back to the previous bar's committed state
before each re-executionIBPersistent[T](varip) variables accumulate across re-executions without rollback- New
VarSnapshotmechanism handles snapshot/restore across main script and libraries - Zero overhead when
calc_on_order_fills=False(the default)
Fixes
syminfo.tickeridnow correctly populated (was empty in some contexts)int()truncation restored in margin callcover_amountcalculation- License link in README fixed to point to correct LICENSE file
Logging
- Log output suppressed in
request.securitycontexts to avoid noise - New
PYNE_SECURITY_LOGenvironment variable for file-based security context logging
Documentation
Major reference documentation overhaul:
- New: complete script format reference (
script-format.md) - New: input functions reference (
inputs.md) with allinput.*()types - New: type system reference (
types.md) — Series, Persistent, IBPersistent, collections,
drawing types,@udt,StrEnum - New: bar magnifier guide (
advanced/bar-magnifier.md) - New: 20+ library namespace reference pages (ta, math, strategy, array, matrix, map, str,
color, label, line, box, table, polyline, syminfo, barstate, timeframe, session, request, log,
runtime, and constants) - Removed Pine Script-centric language reference — all documentation now Python-centric
- Fixed syminfo ticker/tickerid/root documentation semantics
- All code examples include complete context (imports,
@scriptdecorators, main() function)
Other
- Added LICENSE and NOTICE files for proper attribution
- Added additional currency constants (HKD, SGD, SEK, NOK, etc.)