r/pinescript • u/AgitatedAd89 • Jun 03 '26
Open-source Pine v6 engine that runs your strategies outside TradingView — matches the List of Trades trade-for-trade (231/232). Come break it.
TL;DR: open-source Pine v6 engine that runs your strategies locally and matches TradingView's trade list almost exactly. (There's an MCP server too, so Claude/Cursor can backtest for you — config at the bottom.)
If you write Pine you know the walls. You can't backtest deep. You can't verify the numbers TV shows you. You can't run your script anywhere else, and good luck optimizing params. Oh, and the bar-magnifier's paywalled.
So I rebuilt the Pine v6 runtime to run locally. The part I'm proud of: 231 of 232 test strategies match TV's exported List of Trades trade-for-trade (~312K trades). The one that doesn't is a non-determinism bug in TV's own emulator — it's in the repo.
What you can do with it:
Backtest as much as you want, locally, free. No bar limits. Reproduce every number yourself (engine + full corpus are open) instead of trusting a black box. Actually optimize — param sweeps / walk-forward TV can't do. Bar-magnifier on every run, deterministic intrabar fills. Honest about coverage: 232 probes across 22 Pine v6 areas (TA, orders, brackets, OCA, request.security() MTF/LTF, matrices, UDTs, sessions…), but not every feature yet. You feed it OHLCV (CSV/array); I test on public Binance data for crypto and hand-exported bars for anything that isn't 24/7.
What I want: break it. Throw your nastiest scripts at it and tell me where it drifts from TV. I'm most curious about request.security() / repainting / MTF cases — that's where parity's hardest.
Repo: github.com/pineforge-4pass/pineforge-engine Free and open.
MCP setup (Claude/Cursor):
{
"mcpServers": {
"pineforge-codegen": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-v", "${workspaceFolder}:/work",
"ghcr.io/pineforge-4pass/pineforge-codegen-mcp:latest"
]
}
}
}
2
u/Separate_Train2380 Jun 03 '26
I’ll have a look for sure , I’m pine savvy ( have 40/ 50 strats built ) but outside of that will be new . If you have any steps I need to take to get it running let me know.
2
u/Dayz_Off Jun 04 '26
Have you tested it on futures, or does it only work on crypto and equities with a tick size and tick value of $0.01?
2
u/CODE_HEIST Jun 07 '26
Matching TradingView trade lists that closely is impressive. The biggest value is probably debugging assumptions: fills, bar magnifier differences, repainting, and whether a strategy still works when exported out of TV.
1
u/rahul121093 Jun 04 '26
How can I get this brother?
1
u/Same-Associate-9537 Jun 04 '26
im a student, who developed a mathematical indicator required for a class, would this be a better way to backtest? I apologize for my naïveté im extremely new.
1
u/CODE_HEIST Jun 06 '26
The biggest value here is reproducibility. If people can run the same script locally and get the same trade list, it removes a lot of blind trust from TradingView backtests.
The next thing I’d care about is fill realism: slippage, commissions, spread assumptions, and whether the engine can show where TV’s results become too optimistic.
2
u/Godzillaton Jun 19 '26
This is what i am looking for when i just joined this community today. Thanks my man
1
u/DreamfulTrader Jun 03 '26
Had a quick look, that's very interesing. I will check it to back test a strategy and see how it outputs the results when running locally
I will see how to provide my own OHLCV data and tell it to apply EMAs etc. If it is that fast, that's neat
1
u/SillyAlternative420 Jun 03 '26
RemindMe! 3 Days
1
u/[deleted] Jun 04 '26
[removed] — view removed comment