Describe the bug
After upgrading to pynesys-pynecore==6.5.0, PyneCore still does not fully match TradingView for a Pine strategy that uses historical request.security(..., lookahead=barmerge.lookahead_off) on intraday HTF bars for a non-24h futures symbol.
This is a follow-up to the earlier HTF/session anchoring issue. PyneCore 6.5.0 appears to improve the alignment, but strategy-level parity is still not reached on two reproducible configurations.
The proprietary strategy and full market CSV are not attached. The isolated Pine expression is:
midLineHTF = request.security(
syminfo.tickerid,
midHTF,
(ta.highest(high, midLen) + ta.lowest(low, midLen)) / 2.0,
lookahead=barmerge.lookahead_off)
The attached minimal Pine/PyneCore scripts only plot this expression. They do not include the proprietary entry/exit logic.
To Reproduce
- Use a 30-minute chart for a futures-like symbol with non-24h sessions and partial intraday HTF candles.
- Run the attached minimal Pine script in TradingView:
minimal_htf_midpoint_repro.pine
- Run the attached minimal PyneCore script:
minimal_htf_midpoint_repro.py
- Compare HTF midpoint timing/value around session gaps, shortened bars, and partial HTF bars.
- For strategy-level evidence, see
comparison_pynecore_650_vs_tv.csv.
The two validated strategy configurations are:
| Config |
Chart TF |
midLen |
midX |
useMidHTF |
midHTF |
| L30_X30_HTF720 |
30m |
30 |
30 |
true |
720 |
| L1_X0_HTF60 |
30m |
1 |
0 |
true |
60 |
For apples-to-apples strategy comparison, I used saved TradingView XLSX reports where the test window is:
Jun 7, 2022 to Jun 5, 2026
The local PyneCore CSV also ends at 2026-06-05.
Observed behavior
| Config |
Window |
TradingView trades |
PyneCore 6.5.0 trades |
Delta trades |
TradingView PnL |
PyneCore 6.5.0 PnL |
Delta PnL |
TradingView PF |
PyneCore PF |
| L30_X30_HTF720 |
Jun2022-Jun2026 |
74 |
83 |
+9 |
23426.60 |
23250.00 |
-176.60 |
1.713 |
1.641 |
| L1_X0_HTF60 |
Jun2022-Jun2026 |
111 |
93 |
-18 |
52377.40 |
43200.00 |
-9177.40 |
2.244 |
2.201 |
The L30_X30_HTF720 case is now close in total PnL, but still differs by 9 trades. The L1_X0_HTF60 case still differs materially in trade count and PnL.
Expected behavior
PyneCore should expose historical HTF values from request.security(..., lookahead_off) on the same chart bars as TradingView, including around:
- partial intraday HTF candles
- midday or overnight session gaps
- shortened bars
- non-24h futures sessions
When the same 30-minute and native HTF CSV data is supplied, the strategy-level trade count and trade timing should match TradingView.
Screenshots / evidence
Attached:
comparison_pynecore_650_vs_tv.csv
TV_LIVE_CHECK_2026-06-13.txt
tv_period_dialog.png
after_ctrl_enter.png
The screenshots show that:
- the proprietary strategy was loaded and compiled in TradingView for private validation;
- TradingView custom backtesting date range is available;
- the live TradingView report currently uses later data than the local CSV, so the exact comparison is based on saved XLSX baselines ending
2026-06-05.
Environment
- PyneCore branch/version:
pynesys-pynecore==6.5.0
- OS: Windows 11
- Python: 3.12/3.14 environment used through PyneCore CLI
- Execution: PyneCore CLI
- Chart timeframe: 30 minutes
- Requested HTFs tested: 60 minutes and 720 minutes
lookahead: barmerge.lookahead_off
- Symbol type: futures-like, non-24h session
Additional context
I understand 6.5.0 changed intraday HTF anchoring to use the session open instead of UTC clock floor. That seems to improve one case substantially, but not enough for full TradingView parity.
Could you confirm whether the announced follow-up time_close() shortened-bar fix is expected to affect the remaining mismatches? If not, is there a recommended way to convert/pass native HTF CSV files through --security so that PyneCore receives exactly the same HTF bar boundaries as TradingView?
I can provide additional anonymized midpoint-only CSV extracts if needed, but I cannot share the full proprietary strategy or full market data publicly.
pynecore_650_new_issue.zip
Describe the bug
After upgrading to
pynesys-pynecore==6.5.0, PyneCore still does not fully match TradingView for a Pine strategy that uses historicalrequest.security(..., lookahead=barmerge.lookahead_off)on intraday HTF bars for a non-24h futures symbol.This is a follow-up to the earlier HTF/session anchoring issue. PyneCore 6.5.0 appears to improve the alignment, but strategy-level parity is still not reached on two reproducible configurations.
The proprietary strategy and full market CSV are not attached. The isolated Pine expression is:
The attached minimal Pine/PyneCore scripts only plot this expression. They do not include the proprietary entry/exit logic.
To Reproduce
minimal_htf_midpoint_repro.pineminimal_htf_midpoint_repro.pycomparison_pynecore_650_vs_tv.csv.The two validated strategy configurations are:
For apples-to-apples strategy comparison, I used saved TradingView XLSX reports where the test window is:
Jun 7, 2022toJun 5, 2026The local PyneCore CSV also ends at
2026-06-05.Observed behavior
The
L30_X30_HTF720case is now close in total PnL, but still differs by 9 trades. TheL1_X0_HTF60case still differs materially in trade count and PnL.Expected behavior
PyneCore should expose historical HTF values from
request.security(..., lookahead_off)on the same chart bars as TradingView, including around:When the same 30-minute and native HTF CSV data is supplied, the strategy-level trade count and trade timing should match TradingView.
Screenshots / evidence
Attached:
comparison_pynecore_650_vs_tv.csvTV_LIVE_CHECK_2026-06-13.txttv_period_dialog.pngafter_ctrl_enter.pngThe screenshots show that:
2026-06-05.Environment
pynesys-pynecore==6.5.0lookahead:barmerge.lookahead_offAdditional context
I understand 6.5.0 changed intraday HTF anchoring to use the session open instead of UTC clock floor. That seems to improve one case substantially, but not enough for full TradingView parity.
Could you confirm whether the announced follow-up
time_close()shortened-bar fix is expected to affect the remaining mismatches? If not, is there a recommended way to convert/pass native HTF CSV files through--securityso that PyneCore receives exactly the same HTF bar boundaries as TradingView?I can provide additional anonymized midpoint-only CSV extracts if needed, but I cannot share the full proprietary strategy or full market data publicly.
pynecore_650_new_issue.zip