Describe the bug
After upgrading to pynesys-pynecore==6.5.1, PyneCore still does not fully match saved TradingView Strategy Tester results for a Pine strategy that uses historical request.security(..., lookahead=barmerge.lookahead_off) on intraday higher-timeframe bars for a non-24h futures symbol.
This is a follow-up to #66. The 6.5.1 release note says historical barmerge.lookahead_off now confirms the closed HTF bar on the period's own last chart bar instead of one bar late. That appears to address the specific one-bar-late timing bug, but strategy-level parity is still not reached on the tested V2.12.2 configurations.
The proprietary strategy and full market CSV are not attached publicly. The isolated Pine expression remains:
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 proprietary entry/exit logic.
To Reproduce
- Install PyneCore 6.5.1:
python -m pip install -U pynesys-pynecore==6.5.1 typer
- Use a 30-minute 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
- For strategy-level evidence, see:
comparison_pynecore_651_vs_tv.csv
pynecore_651_summary_L30_X30_HTF720.csv
pynecore_651_summary_L1_X0_HTF60.csv
tv_metrics_L30_X30_HTF720.csv
tv_metrics_L1_X0_HTF60.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 |
The exact comparison uses saved TradingView XLSX reports ending 2026-06-05. The local PyneCore CSV also ends at 2026-06-05, so later live TradingView data is not part of this comparison.
Observed behavior
PyneCore 6.5.1 still differs from TradingView at strategy-summary level.
| Config |
Window |
TradingView trades |
PyneCore 6.5.1 trades |
Delta trades |
TradingView PnL |
PyneCore 6.5.1 PnL |
Delta PnL |
TradingView PF |
PyneCore 6.5.1 PF |
| L30_X30_HTF720 |
2023 |
18 |
21 |
+3 |
3336.20 |
7525.00 |
+4188.80 |
1.348 |
1.907 |
| L30_X30_HTF720 |
2024 |
17 |
21 |
+4 |
5957.80 |
8500.00 |
+2542.20 |
1.828 |
2.172 |
| L30_X30_HTF720 |
2025 |
16 |
21 |
+5 |
5179.40 |
1800.00 |
-3379.40 |
2.715 |
1.278 |
| L30_X30_HTF720 |
Jun2022-Jun2026 |
74 |
80 |
+6 |
23426.60 |
22875.00 |
-551.60 |
1.713 |
1.705 |
| L30_X30_HTF720 |
2020-Jun2026 |
108 |
68 |
-40 |
12742.20 |
-13850.00 |
-26592.20 |
1.222 |
0.683 |
| L1_X0_HTF60 |
2023 |
27 |
26 |
-1 |
12441.80 |
13050.00 |
+608.20 |
2.185 |
2.286 |
| L1_X0_HTF60 |
2024 |
30 |
28 |
-2 |
8577.00 |
10175.00 |
+1598.00 |
1.763 |
2.025 |
| L1_X0_HTF60 |
2025 |
27 |
27 |
0 |
7591.80 |
8375.00 |
+783.20 |
1.952 |
2.120 |
| L1_X0_HTF60 |
Jun2022-Jun2026 |
111 |
108 |
-3 |
52377.40 |
55950.00 |
+3572.60 |
2.244 |
2.410 |
| L1_X0_HTF60 |
2020-Jun2026 |
168 |
163 |
-5 |
69871.20 |
75650.00 |
+5778.80 |
1.874 |
1.999 |
The HTF720 continuous 2020-Jun2026 case is the largest remaining divergence: TradingView has 108 trades and +12742.20 PnL, while PyneCore 6.5.1 has 68 trades and -13850.00 PnL.
Expected behavior
For historical data, PyneCore should expose HTF values from request.security(..., lookahead_off) on the same lower-timeframe bars as TradingView and should produce matching strategy trades when the same native 30-minute and HTF data are supplied.
The remaining parity should hold around:
- partial intraday HTF candles
- midday or overnight session gaps
- shortened bars
- non-24h futures sessions
- native HTF data supplied through
--security
Screenshots / evidence
Attached ZIP contains:
comparison_pynecore_651_vs_tv.csv
pynecore_651_summary_L30_X30_HTF720.csv
pynecore_651_summary_L1_X0_HTF60.csv
tv_metrics_L30_X30_HTF720.csv
tv_metrics_L1_X0_HTF60.csv
minimal_htf_midpoint_repro.pine
minimal_htf_midpoint_repro.py
TV_LIVE_CHECK_2026-06-13.txt
tv_period_dialog.png
after_ctrl_enter.png
Environment
- PyneCore package:
pynesys-pynecore==6.5.1
- Required CLI dependency installed separately:
typer
- OS: Windows 11
- Python: 3.14.4
- 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
- Data end date:
2026-06-05
Additional context
I understand that 6.5.1 fixed the previously reported one-bar-late historical HTF confirmation. The remaining mismatch may be caused by another piece of the TradingView parity chain rather than the exact same issue, for example:
- native HTF feed mapping through
--security
- strategy simulator order handling after HTF timing changes
- shortened/partial session bar closing semantics
- barmerge behavior on sparse non-24h futures sessions
Could you advise which area to isolate next, or whether you want a smaller anonymized CSV extract around the first divergent trade/bar for one of the two configs?
Describe the bug
After upgrading to
pynesys-pynecore==6.5.1, PyneCore still does not fully match saved TradingView Strategy Tester results for a Pine strategy that uses historicalrequest.security(..., lookahead=barmerge.lookahead_off)on intraday higher-timeframe bars for a non-24h futures symbol.This is a follow-up to #66. The 6.5.1 release note says historical
barmerge.lookahead_offnow confirms the closed HTF bar on the period's own last chart bar instead of one bar late. That appears to address the specific one-bar-late timing bug, but strategy-level parity is still not reached on the tested V2.12.2 configurations.The proprietary strategy and full market CSV are not attached publicly. The isolated Pine expression remains:
The attached minimal Pine/PyneCore scripts only plot this expression. They do not include proprietary entry/exit logic.
To Reproduce
minimal_htf_midpoint_repro.pineminimal_htf_midpoint_repro.pycomparison_pynecore_651_vs_tv.csvpynecore_651_summary_L30_X30_HTF720.csvpynecore_651_summary_L1_X0_HTF60.csvtv_metrics_L30_X30_HTF720.csvtv_metrics_L1_X0_HTF60.csvThe two validated strategy configurations are:
The exact comparison uses saved TradingView XLSX reports ending
2026-06-05. The local PyneCore CSV also ends at2026-06-05, so later live TradingView data is not part of this comparison.Observed behavior
PyneCore 6.5.1 still differs from TradingView at strategy-summary level.
The HTF720 continuous
2020-Jun2026case is the largest remaining divergence: TradingView has 108 trades and +12742.20 PnL, while PyneCore 6.5.1 has 68 trades and -13850.00 PnL.Expected behavior
For historical data, PyneCore should expose HTF values from
request.security(..., lookahead_off)on the same lower-timeframe bars as TradingView and should produce matching strategy trades when the same native 30-minute and HTF data are supplied.The remaining parity should hold around:
--securityScreenshots / evidence
Attached ZIP contains:
comparison_pynecore_651_vs_tv.csvpynecore_651_summary_L30_X30_HTF720.csvpynecore_651_summary_L1_X0_HTF60.csvtv_metrics_L30_X30_HTF720.csvtv_metrics_L1_X0_HTF60.csvminimal_htf_midpoint_repro.pineminimal_htf_midpoint_repro.pyTV_LIVE_CHECK_2026-06-13.txttv_period_dialog.pngafter_ctrl_enter.pngEnvironment
pynesys-pynecore==6.5.1typerlookahead:barmerge.lookahead_off2026-06-05Additional context
I understand that 6.5.1 fixed the previously reported one-bar-late historical HTF confirmation. The remaining mismatch may be caused by another piece of the TradingView parity chain rather than the exact same issue, for example:
--securityCould you advise which area to isolate next, or whether you want a smaller anonymized CSV extract around the first divergent trade/bar for one of the two configs?