Backtest Pine Script at native speed.
Locally. Interactively.

Foresight runs your TradingView .pine strategies as native code on your own machine — fast enough to drag a parameter and watch the results update. No browser, no subscription, no uploading your strategies to the cloud.

Get beta access Watch the walkthrough
Windows · x86_64 Your data never leaves your machine
RE-RUN
~3 ms
8,000-bar backtest
OPTIMIZER
4,000+/sec
24-core parallel
COLD START
<250 ms
compile + first run
MEMORY
<100 MB
per backtest (engine)
MEASURED · 24-CORE DESKTOP · EURUSD 1H · 8,082 BARS 2026-05-23
▸ Walkthrough
◆ 02 / 07▸ MEASURED PARITY◇ AUDITED CORPUS◇ RATINGS-BLIND GATE◆ HONEST BOUNDARIES
02 · ACCURACY VS TRADINGVIEW

If it doesn't match TradingView, it's a bug.

A backtester you can't trust is a random-number generator with a UI. Foresight's core promise is simple: same script, same data — same trades. We don't claim it; we measure it, on every build, and we publish the boundaries instead of burying them.

FIDELITY SUITE
3,039
trading test cases
SCORED CASES MATCHING TV
100%
trade counts within tolerance · 2,023 cases · 0 errors
RATINGS-BLIND GATE
27/29
pre-registered arrival gate, unchanged binary
COMPILE AUDIT
0
unexplained failures across 29,459 real scripts
Measured, not promised
Every build runs a 3,039-case suite against TradingView golden exports — trade counts at level 1, per-trade entry/exit accuracy at level 2. 33% of cases are excluded from scoring for declared reasons (missing golden data, paid entitlements); the number is on this page because you deserve to see it.
Honest boundaries, loudly drawn
When a construct isn't supported, you get a structured diagnostic naming it — NOT_SUPPORTED, APPROXIMATE, LIMITED — as inline squiggles and a Problems tab. Never a silently wrong number. The debugger inherits the rule: a value the engine didn't record is shown as unrecorded, never invented.
One compiler path
No per-script special cases, no "supported shapes" allowlist. Every Pine construct lowers through one canonical path — which is why a fix for one script is a fix for every script, and why the audit corpus keeps converging instead of whack-a-moling.
◆ 03 / 07▸ NATIVE COMPILATION◇ RUNS LOCALLY◇ OFFLINE◆ INTERACTIVE
03 · SPEED

Your .pine script becomes native code.

Foresight isn't a browser interpreter. It compiles your strategy to native machine code and runs it on your CPU — which is where the instant, drag-to-tune re-runs come from. Speed isn't a luxury feature: when a full backtest costs milliseconds, you can afford to leave the rigorous stuff — walk-forward, robustness checks, honest fills — switched on.

01
PASTE
Pine v5 / v6, straight from TradingView
02
COMPILE
transpiled and built to native machine code
03
RUN
executes locally, on your machine, offline
04
TUNE
drag a slider — it re-runs immediately
▸ 01
Interactive optimization
Drag inputs and the strategy re-runs immediately — and a built-in optimizer can search the parameter space for you. Tune by feel, not submit-and-wait.
▸ 02
Measured against TradingView
Parity isn't a goal we chase — it's a suite we run: on every scored case in our 3,039-case fidelity corpus, trade counts match TradingView within tolerance. If your script gives different numbers, that's a bug we want to hear about and fix.
▸ 03
No cloud round-trip
Everything runs on your machine. Load any OHLCV CSV. Your data — and the edges in your strategies — never leave it.
▸ 04
Across many instruments
Run one strategy over a whole basket at once — combined equity plus per-instrument spread — and optimize for an edge that holds across symbols, not one cherry-picked chart. Scales to S&P-500-sized scans.
▸ 05
Honest-execution models
Re-run any backtest under TV, Strict or Adversarial fills — spread floors, adverse slippage, next-bar exits. If the edge survives Strict it's probably real; if it only works on optimistic fills, you'll see that too.
▸ 06
Prosumer-quant stats
CAGR, Sharpe, Sortino, Calmar, Ulcer, profit factor, expectancy with a t-stat and 95% CI, commission drag, buy-&-hold alpha — plus a monthly-returns heatmap.
▸ 07
A real debugger for Pine
Step through your strategy bar by bar — after it ran. Hover any variable to see its value on any bar, set retroactive breakpoints, and inspect the series history. And it never guesses: a value the engine didn't record shows as exactly that, never a plausible fabrication.
▸ 08
Repaint detection
The classic Pine trap: a strategy that looks brilliant on historical bars and falls apart live, because something repaints. Foresight detects repainting behaviour and tells you before the market does.
◆ 04 / 07▸ BROKER MODELS◇ WALK-FORWARD◇ PBO◆ REPAINT DETECTION
04 · REALISM

A backtester that tries to talk you out of bad edges.

Most backtesters are built to flatter you — optimistic fills, one lucky chart, a number that goes up. Foresight is built the other way: its job is to kill fragile edges before your money does. Everything below exists to answer one question: would this survive contact with a real broker?

▸ BROKER MODELS
TV · Strict · Adversarial
Re-run any backtest under three execution models: TV (TradingView-parity fills), Strict (spread floors, conservative fills), and Adversarial (adverse slippage, worst-reasonable-case). An edge that only exists under optimistic fills isn't an edge — it's a rounding error with a story.
▸ OUT-OF-SAMPLE
Walk-forward validation
Optimize in-sample, test out-of-sample, roll the window forward — the discipline that separates a tuned curve from a tradable system. Built in, one click, fast enough to run on every candidate instead of just the finalist.
▸ OVERFITTING
PBO & robustness analysis
Probability-of-backtest-overfitting scoring, parameter-neighborhood robustness (does the edge survive nudging every input?), and minimum-trades guards — the quant-desk checks that tell you whether your optimizer found a signal or memorized the noise.
▸ REPAINTING
Repaint detection
Strategies that peek — lookahead requests, recalculating signals — look phenomenal historically and evaporate live. Foresight flags repainting behaviour ambiently, before the market invoices you for the lesson.
▸ BREADTH
Multi-instrument truth
One chart can be luck. Run the same strategy across a whole basket — combined equity, per-instrument spread — and optimize for the edge that holds across symbols. Scales to S&P-500-sized universes.
▸ COSTS
The unglamorous stuff
Commission drag, expectancy with a t-stat and 95% confidence interval, buy-&-hold alpha, Ulcer index. The numbers that tell you whether the strategy beats doing nothing — after costs, with statistical honesty about how sure you should be.
◆ 05 / 07▸ MCP CONTROL SURFACE◇ AGENT-READY◇ PYTHON / CLAUDE◆ LOCAL

Drive it with an agent — or from Python.

Foresight exposes its engine over MCP (Model Context Protocol) and a matching Python client — one shared command core. Point Claude (or any MCP client) at it and the agent can run backtests, sweep parameters, run the optimizer, read equity curves and trades, and edit your script directly. Prefer code? pip install foresight and drive the same engine from Python — OHLCV and result series move as numpy arrays, against the live GUI or fully headless.

run / run_rangeCompile & run a strategy over a symbol / range.
start_optRun the optimizer over the active parameters.
run_walk_forwardIn-sample / out-of-sample rolling validation.
get_equity_curve / get_tradesPull results back as data.
modify_script / set_paramPatch the script or inputs and re-run in place.
set_broker_modelSwitch execution realism — TV / Strict / Adversarial.
pip install foresightSame engine, same verbs — driven from Python.
claude · mcp:foresight● connected
USER
Sweep the fast MA from 5 to 30 on this strategy and find the best Sharpe.
start_opt({ param: "fast_ma", min: 5, max: 30 })
⤷ optimizer ran · best fast_ma = 14 · Sharpe 1.82
CLAUDE
Best Sharpe is at fast_ma = 14 (1.82). Want me to run a walk-forward on it to check the edge holds out-of-sample?
~/strategies/ma_cross.pinemcp · foresight
◆ 06 / 07▸ PINE v5 / v6◇ BROAD COVERAGE◇ TRACKED◆ IMPROVING

Audited against 29,459 real published Pine scripts.

We audit a frozen universe of 29,459 community-published Pine scripts: 21,686 run out of the box, and every one that doesn't hits a declared, documented boundary with a clear error — on the current build there are zero unexplained failures. Our curated regression corpus (6,197 strategies & indicators, incl. LuxAlgo) passes at 98.0%. On the 3,039-case trading-fidelity suite, every scored case matches TradingView's trade count within tolerance (2,023 scored, 0 errors); 33% of cases are excluded from scoring for declared reasons (missing golden exports, paid data entitlements) — we publish that rather than bury it. Hit a script that doesn't work? Send it — fixing those is the whole game.

SUPPORTED PARTIAL NOT YET
CORE LANGUAGE6
Variables, operators, expressions● SUPPORTED
Conditionals & loops (for / while / for-in)● SUPPORTED
User-defined functions & methods● SUPPORTED
User-defined types, enums, switch● SUPPORTED
var / varip persistence, series history []● SUPPORTED
Collections — arrays, matrices, maps● SUPPORTED
INDICATORS & STRATEGY4
Strategy framework — entries, exits, sizing● SUPPORTED
Standard indicators (ta.*)● SUPPORTED
Plots, hline, fill● SUPPORTED
Tables, boxes, labels, lines● SUPPORTED
DATA & MULTI-TIMEFRAME5
OHLCV built-ins, any CSV (forex / stocks / crypto / futures)● SUPPORTED
Higher-timeframe request.security — incl. ta.* & computed expressions● SUPPORTED
Cross-symbol request.security (other tickers, e.g. VIX) — needs that symbol's data loaded● SUPPORTED
Lower-timeframe / intrabar (request.security_lower_tf) — served from canonical 1-minute data● SUPPORTED
Library imports (import Author/Lib/N) — vendored or local libraries● SUPPORTED
NOT YET SUPPORTED1
request.financial / economic data○ NOT YET
See the full feature list in the docs →
◆ 07 / 07▸ BETA◇ FREE FOR NOW◇ WINDOWS◆ DOWNLOAD
07 · PRICING

Free while we're in beta.

Foresight is free to use during the public beta — everything unlocked. Paid plans are coming at launch (we're still finalizing them), and beta testers will get founding-member pricing.

BETA
Freewhile in beta
Get beta access

PRICING AT LAUNCH — TO BE ANNOUNCED

08 · DOWNLOAD

Install in under a minute.

Create a free beta account, confirm your email, and download the Windows installer. Beta builds refresh regularly — you'll always grab the latest.

Windows · x86_64
Windows 10 / 11 · installer
Create account & download
Already have an account? Sign in.