Is Your TradingView Backtest Reproducible? We Replayed Our Strategies Trade by Trade
A backtest shown in a tool is only a claim. It becomes a measurement the day someone else, with another engine, finds the same trades: same dates, same prices, same fees, same final capital. That is the real test of reproducibility, and it is rarely done.
On October 13, 2026, we ran it on our own exports. The Strategy Arena Lab computes its backtests with its own engine, then exports the strategy as Pine Script. We pasted those Pine scripts into a real TradingView account and compared, trade by trade, what TradingView executed with what the Lab had predicted.
Research on past data, not investment advice.
The result in one table
BINANCE:BTCUSDT 4-hour chart, TradingView account on the Basic (free) plan, capital 10,000, fees of 0.10% per side.
| Export | Rule | Trades TradingView / Lab | Final capital TradingView / Lab | Mismatches |
|---|---|---|---|---|
| 02 | Follows ETH (read with request.security) and BTC above its 50 SMA, 5% stop |
258 / 258 | 5,755.23 / 5,755.23 | 0 |
| 03 | Calendar: enter Monday 00:00 except in September, exit Thursday 20:00, 6% stop | 97 / 97 (+ 1 position open at the end) | 8,872.76 / 8,872.76 | 0 |
| 04 | Turn of the month: enter on the last day, exit on the 3rd day, 6% stop | 26 / 26 | 9,344.72 / 9,344.72 | 0 |
For every trade: identical entry and exit dates, identical prices (maximum gap: 0.00), identical net return within 5 ten-millionths of a point, identical commission, identical quantity.
One point that matters: these strategies do not make money. Export 02 loses 42.45%, export 03 loses 11.27%, export 04 loses 6.55%. They are test rules, chosen to exercise specific mechanics (a second market, calendar conditions). The question was not "is it profitable?" but "do both engines say exactly the same thing?". For these three exports, yes.
How it was measured
- Frozen export. The Lab exports the Pine with a sealed receipt: exact period, fees, quantity step, capital, sha256 fingerprint of the Pine. The expected trades are written to a file in advance.
- Pasting into TradingView. The Pine is pasted as is into the editor and added to the chart; the script then writes each of its trades to the Pine Logs, with a header line carrying the export identifier and its parameters.
- Independent comparison. A comparator written separately, without calling the Lab, checks every line of the TradingView log against the expected trades: dates, prices within half a tick, net return, commission at 10 basis points per side, replayed quantity, final capital.
In export 03, one position is still open on the last candle. TradingView counts it in its capital with its unrealized gain; so does the Lab. Both give 8,872.76.
What the check found: two flaws, on our side
A check that never finds anything proves nothing. This one found two flaws, both on the Lab's side.
1. The stop order that crashed in TradingView
Export 01 used a stop entry order: buy if price exceeds the candle high by 2%, 5% target, 4% stop. The Pine compiled without error. Then, at the first stop fill, TradingView halted:
Error on bar 1392: In 'array.get()' function. Index 0 is out of bounds, array size is 0.
Bar 1392 is August 20, 2024, the candle of the first expected trade. No trades, no log.
The cause. The Lab's Pine generator wrote an array read guarded by an and:
if saNlLevel >= 0 and array.get(saPend, math.max(saNlLevel, 0))
In many languages, the second half of an and is skipped when the first half is false. Pine v5 evaluates both sides. With a stop order alone, the array is empty, and reading index 0 stops the script. Our internal simulator did not model that Pine rule: our mirror tests were green; the real TradingView was not.
The fix. The read moves into a nested if, three lines:
bool saNlPend = false
if saNlLevel >= 0
saNlPend := array.get(saPend, saNlLevel)
With those three lines, the same Pine replayed in the real TradingView gives 62 out of 62 identical trades, final capital 12,369.19 on both sides. The stop-order logic was right; only the Pine template was at fault. The next Lab version (249) fixes the generator and adds an automatic check that rejects this pattern (an array read under an and or an or) in every Pine template. That same evening, the official export from that version, frozen with its receipt, ran in the real TradingView: 62 out of 62 identical trades, 0 desyncs, final capital 12,369.19 on both sides. Two other official 249 exports, which also read their array inside a nested if, match as well: lot buying under a when condition (44 out of 44 identical trades) and a market-regime allocation (519 out of 519 identical trades). In both cases, the lots still open at the end of the window are identical too, and so is the final capital.
This bug was only visible in the real test. An export declared "exportable" and sealed in a receipt was unusable in TradingView. That is exactly what this check is for.
2. The second market that stopped silently
Export 05 used the rule of export 02 over a longer window. TradingView and the Lab are identical up to trade 258. Then TradingView keeps going: 167 more trades, up to October 2026. The Lab stopped.
The cause: to read ETH, the Lab picked the ETH dataset with the most candles, and that dataset ended on October 31, 2025. After that date, no more signal, and no warning. TradingView reads the real ETHUSDT to the end.
The fix picks the dataset that covers the window and states it in every response, export and receipt. Replayed on the real data, it gives 420 trades, all identical to the real TradingView log; TradingView's last 5 trades fall after the end of the ETH data available in the Lab, and the Lab now says so.
Why this matters to you
If you use TradingView's Strategy Tester, three questions are worth asking of any backtest you are shown, including your own:
- Are the fees the ones you will pay? Over 258 trades, 0.10% per side weighs heavily.
- Does the script read another market? Misused with
lookahead_on,request.securitycan read the future. Our exports writelookahead_offexplicitly: the script only reads what the closed candle knew. - Does another engine find the same trades? If nobody has checked, the displayed number only binds the engine that computed it.
Reproducible does not mean profitable. A strategy can be reproduced to the cent and lose 42%. The reproducibility check comes before the verdict, not in its place. For the verdict itself, see how our judge caught itself out and was fixed and our TradingView strategy validation method.
Run the check yourself
- The free Windows Lab: backtest on your PC, frozen Pine export with its receipt, then trade-by-trade judging of the TradingView log.
- The free Quick Check: paste a Pine strategy and see how it does against buy-and-hold, fees included.
- A free TradingView account is enough to paste a Pine script. No account yet? Create a free TradingView account (affiliate link). Partner link: Strategy Arena may earn a commission on a first subscription. It changes no number and no verdict in this article.
Key takeaways
- 3 exports pasted into a real TradingView: 258/258, 97/97, 26/26 identical trades, final capital identical to the cent.
- The check caught a real bug: the stop order crashed in TradingView because Pine v5 evaluates both sides of an
and. Fixed, the official export from the next version gives 62/62 in the real TradingView, 0 desyncs. - It also caught a second market that stopped silently on the Lab side; fixed, 420 identical trades.
- These test strategies lose money: reproducibility is a prerequisite, not a verdict.
Research on past data, not investment advice. No past result guarantees a future result.
⚠️ Disclaimer — This article is for informational and educational purposes only. It does not constitute investment advice or a buy/sell recommendation. Past performance does not guarantee future results. Strategy Arena is an educational simulator with virtual capital. Always do your own research before making investment decisions.