STRATEGY TESTING · UPDATED AUGUST 2026

TradingView Backtester: test a strategy before it costs you money.

Every strategy that blows up a live account once had a beautiful backtest. The difference between a test you can trust and a fantasy is a handful of settings and traps most traders skip. Here is how the TradingView Strategy Tester actually works, how to make it honest, and what to do the day your strategy survives it.

BBenjamin SF · Founder Published Aug 20, 2026 Read 6 min

FIRST THINGS FIRST

Strategy vs indicator: only one of them backtests.

TradingView runs two kinds of Pine Script. An indicator draws lines, labels and alerts - it never simulates a trade, so there is nothing to backtest. A strategy declares itself with strategy() instead of indicator() and places simulated orders with strategy.entry and strategy.exit. Only strategies produce results.

To run the test: open your symbol and timeframe, add the strategy from the Pine Editor (or the community library), then open the Strategy Tester tab at the bottom of the chart. You get the equity curve, net profit, profit factor, max drawdown and the full trade list. If you wrote the rules as an indicator, you are not stuck - the entries and exits translate into a strategy almost line for line, or you can go straight to alerts and validate in real time instead (more on that at the end).

REALISM

Make the test honest: commission, slippage, data.

A backtest with zero costs is marketing, not research. In the strategy settings set a commission that matches your broker (a per-lot figure for forex, or a percentage for crypto) and a few ticks of slippage on every fill. These two fields alone routinely turn a 60%-win-rate wonder into breakeven - better to learn that now than from your broker statement.

Two more honest-makers. The bar magnifier (paid plans) uses lower-timeframe data to guess what happened inside each bar, so stops and targets within one candle resolve in the right order - without it, TradingView assumes a path that may flatter your strategy. And deep backtesting on higher paid plans unlocks the full symbol history instead of a capped bar window, which matters because a strategy tested only on the last trending year has not really been tested. Free plan limits change, so check TradingView's current plan page for exact bar caps.

THE SILENT KILLER

Repainting: the backtest that reads the future.

The most dangerous backtest bug is not in your logic - it is in your timing. A script repaints when its historical signals were computed with information that was not available at that bar. The equity curve looks supernatural because, in a sense, it was.

01

request.security with lookahead

Pulling a higher timeframe with request.security(..., lookahead=barmerge.lookahead_on) imports the higher bar's close before it finished. Classic future leak.

FIX → lookahead off and offset the series with [1], so you only use the last confirmed higher-timeframe value.
02

Signals inside the live bar

Entries that fire on the still-forming bar (intrabar calculations, calc_on_every_tick) cannot be reproduced bar-close by bar-close. The tester may assume you filled at a price the market only touched for a second.

FIX → decide on confirmed bars only, and mirror that in live trading with once-per-bar-close alerts.
03

Curve-fitted parameters

Not repainting, but the same outcome: optimize the inputs until the past looks perfect and you have fitted noise. The tell is razor-thin stability - change the length from 21 to 23 and the edge evaporates.

FIX → keep an out-of-sample date range the optimization never touches, and demand the strategy survive it.

THE STEP EVERYONE SKIPS

Survived the backtest? Forward-test it on MT5 demo.

A backtest, even an honest one, is still a simulation on historical candles. It cannot show you live spread widening at the news, the half-second between your alert and the fill, or how your strategy behaves when three signals fire in the same hour. The cheapest reality check is a forward test on an MT5 demo account: same rules, live market, fake money, real fills.

The practical way is to convert your strategy rules into TradingView alerts - one message per entry and exit - and let them execute automatically on the demo. That is exactly what SignalForge does: it routes your TradingView webhook alerts to MetaTrader 5 in milliseconds, with stop-loss, take-profit, multi-TP, break-even and trailing handled by the EA. You can start with the 14-day free trial, no card required, and watch a full cycle of signals fill on demo before a single real dollar is at risk. If you are choosing between bridges, our honest TradingView to MT5 bridge comparison lays out the options.

Treat the forward test as part of the strategy, not a formality: two to four weeks on demo, compare live fills against the backtest's assumptions, and only then decide. If you want the alert JSON right the first time, our guide on Pine Script alert webhooks covers the message format, and copying TradingView signals to MT5 walks the full pipeline end to end.

FAQ

Quick questions.

Email [email protected] if yours isn’t here.

Is the TradingView backtester free?

+
Yes. The Strategy Tester itself is free on every plan. What paid plans add is deep backtesting (the full bar history instead of a capped window) and the bar magnifier, which uses lower-timeframe data to simulate what happened inside each bar.

What is the difference between an indicator and a strategy on TradingView?

+
An indicator only draws plots, labels and alerts — it never simulates trades. A strategy is written with strategy() instead of indicator(), places simulated orders with strategy.entry and strategy.exit, and its results show up in the Strategy Tester with profit factor, drawdown and a trade list.

Why does my TradingView backtest look amazing but lose live?

+
Usually one of three causes: the script repaints (signals use future data via request.security lookahead, calc_on_every_tick or non-confirmed bars), the test had zero commission and slippage, or the parameters were curve-fitted to that exact date range. Fix the first two in the code and settings, and the third with out-of-sample testing.

How much history can I backtest on TradingView?

+
It depends on your plan. Free and entry plans cap the number of bars the Strategy Tester can use, while higher paid plans unlock deep backtesting over the full available history of the symbol. Check TradingView’s current plan page for the exact bar limits.

What should I do after a good TradingView backtest?

+
Forward-test it in real time on a demo account before risking money. Convert the strategy’s entry and exit rules into alerts and let them execute on an MT5 demo for a few weeks — live fills expose spread, slippage and timing effects that no backtest can show you.
B
Benjamin SF · Founder of SignalForge
TRADER · ALICANTE 🇪🇸

Benjamin SF is the founder of SignalForge and an expert in trading algorithm automation. He builds and operates the SignalForge bridge and the SFCloud hosted-MT5 fleet for prop-firm traders.

Forward-test your strategy on MT5

SignalForge routes your alerts to MetaTrader 5 in milliseconds. 14-day free trial, no card required.

SignalForge AI is an order-execution tool. We do not provide investment advice. Trading involves risk of loss.

Backtest survived? Forward-test your alerts on MT5 demo automatically · 14-day free trialStart free →