Skip to content

PyneCore v6.3.5

Choose a tag to compare

@wallneradam wallneradam released this 14 Mar 23:05

Strategy Simulator — Major Improvements

TradingView-Compatible Margin Call System

Complete implementation of margin call simulation matching TradingView's exact algorithm:

  • Creation-time margin check with slippage at strategy.entry() call
  • Fill-time margin validation during order processing
  • Multi-phase margin call handling: immediate at open, immediate at worst-case, and deferred to close
  • Correct deferral skip when OHLC extremum equals close price
  • Default margin_long and margin_short set to 100.0

Order Processing Fixes

  • Fill gap-through take-profit exits instead of incorrectly cancelling entry+exit pairs
  • Correct gap-through exit handling distinguishing pending entries vs open positions
  • Preserve orphan exit orders from margin-rejected entries across bars
  • Tick-based exit order calculation and position flip exit preservation
  • Mintick division in round_to_mintick to match TradingView behavior

Exit Support

  • strategy.exit() now supports comment and alert type parameters

Technical Analysis

  • New ta.pivot_point_levels() function with full TradingView compatibility (Traditional, Fibonacci, Woodie, Classic, DM, Camarilla)

Data & OHLCV

  • Enhanced timezone handling with automatic DST-aware detection from CSV timestamps
  • Additional date format support for broader CSV compatibility
  • Significant-digit rounding for OHLCV prices (preserves sub-mintick data like US stock midpoint prices)
  • Accurate barstate.islast detection using peek-ahead pattern
  • Correct handling of end_timestamp beyond last record in gap-filled files
  • Direct last-record timestamp reading for non-uniform intervals

CLI

  • --chunk-size option for data download command
  • PYNESYS_API_URL environment variable for API URL override
  • Reduced demo OHLCV data generation from 20,000 to 2,000 rows for faster setup

Bug Fixes

  • Handle builtin price series (open, high, low, close) as global scope in nested functions
  • Set syminfo properties before importing script to ensure availability during initialization
  • Fix matrix optional arguments, script TOML escaping, and plot.style_steplinebr
  • Add missing limit parameter to Capital.com download_ohlcv method