Identical Pine Script Yields Opposite Backtest Results Across Two Engines
A developer ran the same RSI mean-reversion Pine Script strategy on 4,089 daily bars of CSI 300 data using two different backtesting approaches. The PyneCore bar-by-bar emulator reported a net loss of about 13.5%, while a hand-written pandas port showed a profit over the same period. The author attributes the divergence to differences in how each engine handles tick definitions, indicator warm-up, and order fill timing. The core disagreement starts with RSI calculation, as PyneCore seeds Wilder's smoothing differently than the pandas version, producing early values that differ by up to 16.47 points. These small discrepancies are enough to generate trades in one engine that never occur in the other.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in