v6.5.1
PyneCore 6.5.1 is a correctness and performance release on the 6.5 line, fixing TradingView-parity divergences across the strategy simulator, request.security, the standard library, time/timeframe handling and the compiler, with hot-path speedups on the drawing, array and overload code.
Strategy simulation
- Same-bar
close_allafter a partial close no longer overshoots into a phantom opposite trade. - Multiple same-bar partial closes for one entry id now all fill instead of evicting each other.
- A sub-lot margin-call shortfall closes a single contract, not the whole position.
immediately=Truecloses now book their cumulative stats correctly.- Added
strategy.netprofit_percent,strategy.openprofit_percentandstrategy.max_drawdown_percent.
request.security / higher-timeframe
- Sparse single-period D/W/M feeds keep their
gaps_offforward-fill instead of writingna. - HTF
barmerge.lookahead_offconfirms on the period's own last chart bar, not one bar late (#66). - Tuple
request.security_lower_tfreturns one array per element again. - The per-chart-bar LTF handshake is skipped before the feed begins (faster idle prefix).
Standard library
array.new_*(na)creates an empty array; empty-array reducers returnnainstead of raising.- Array methods dispatch on
array.slice()(SequenceView) receivers. str.contains(na, ...)no longer hangs;str.format_time(na)and out-of-rangetimestamp(...)follow Pine.ta.correlation,ta.crossoverandta.crossunderstay valid acrossnagaps in the window.- An
naseries subscript resolves to the current bar (high[na] == high[0]), matching TradingView.
Time, timeframe and bar aggregation
- Bars close at the trading-day end; daily bars anchor to the session open.
- Multi-period D/W/M aggregation (
2D,3W...) is trading-day- and holiday-aware (#65). last_bar_indexstays fixed at the dataset tail on history, so last-N-bar guards work.
Compiler / transformers
- Emitted builtin calls are shadow-proof against user names like
lenorgetattr. inline_serieshistory is materialized every bar in short-circuited (ternary,and/or) positions.- Overload instance state (
ta.*,Persistent) survives the per-bar swap in library mains. - A library alias shadowing a built-in namespace falls back to the built-in for unexported names.
Performance
- O(1) identity-keyed drawing registries that enforce Pine's
max_*_countcaps. - Overload dispatch memoizes implementation selection per call shape.
pine_rangereturns a nativerangefor integer for-loop bounds;array.getdrops a runtime cast.