how to backtest on TradingView: the complete guide for futures traders

if you want to know how to backtest on TradingView, you're already ahead of most traders. the majority of people trading futures never test their strategy against historical data. they just trade it live and hope it works.
TradingView backtesting gives you a way to check whether your setup actually has an edge before you risk real money. the platform has built-in tools for this, but most traders either don't know they exist or don't know how to use them effectively.
table of contents
- what is backtesting and why it matters
- how to backtest on TradingView using the strategy tester
- setting up your first TradingView backtesting session
- backtesting on TradingView with pine script strategies
- how to backtest on TradingView using edgeful indicators
- common backtesting mistakes on TradingView
- the limits of TradingView backtesting (and what to do about them)
- combining TradingView backtesting with real statistical data
- key takeaways
what is backtesting and why it matters
backtesting means running your trading strategy against historical price data to see how it would have performed. instead of guessing whether a setup works, you're looking at what actually happened over hundreds or thousands of historical trades.
for futures traders, backtesting is especially important because the data is clean and the markets are liquid. ES, NQ, GC. these instruments have years of reliable historical data that you can test against.
the problem is that most traders skip this step entirely. they see a setup on Twitter, try it for a week, take a few losses, and move on. they never test whether the setup has a real statistical edge over a meaningful sample size.
if you want to know how to backtest on TradingView properly, you need to understand both the tools available and their limitations. TradingView's strategy tester is a solid starting point, but it's not the only way to validate a strategy.
how to backtest on TradingView using the strategy tester
TradingView has a built-in backtesting tool called the "strategy tester." here's how it works:
- open a chart for the instrument you want to test (ES, NQ, etc.)
- add a strategy from the indicator panel. TradingView has built-in strategies, or you can write your own in pine script
- the strategy tester tab appears at the bottom of the screen once a strategy is loaded
- review the results. you'll see net profit, total trades, win rate, profit factor, max drawdown, and more
the strategy tester runs your entry and exit rules against every bar of historical data on the chart. it simulates trades as if you had executed them in real time.
this is useful for getting a baseline sense of whether a strategy has potential. but there are some important limitations to understand, which we'll cover in a later section.
the TradingView strategy tester works best when you pair it with a clear set of rules. vague setups like "buy when it looks bullish" can't be backtested. you need specific conditions: price above VWAP, RSI below 30, breakout above the opening range high. whatever your setup requires.
setting up your first TradingView backtesting session
here's a step-by-step process for backtesting on TradingView if you haven't done it before:
step 1: pick your instrument and timeframe
start with the instrument you actually trade. if you trade NQ on a 5-minute chart during the NY session, that's what you backtest. don't test ES on a daily chart and assume the results apply to NQ intraday.
step 2: choose or build a strategy
TradingView comes with built-in strategies in the indicator library. search for "strategy" in the indicators panel to browse them. for custom setups, you'll need pine script, tradingview's programming language.
if you use edgeful's TradingView indicators, several of them can form the basis of a backtestable strategy. the ORB indicator plots the opening range levels automatically. you can then use edgeful's ORB algo to build a tradeable, backtestable strategy.
step 3: set your parameters
before running the backtest:
- set realistic commission and slippage values (futures typically $4-5 round trip per contract)
- choose the correct session times (if you only trade NY, limit your backtest to NY hours)
- set your lookback period (6-12 months minimum for meaningful results)
step 4: run and review
click into the strategy tester tab and review:
- win rate. what percentage of trades were profitable
- profit factor. gross profit divided by gross loss (above 1.5 is strong)
- max drawdown. the worst peak-to-trough decline (critical for risk management)
- total trades. need at least 50-100 for statistical relevance
backtesting on TradingView with pine script strategies
pine script is TradingView's built-in programming language. it's how you turn a trading idea into a backtestable strategy.
you don't need to be a programmer to use it. pine script is designed to be readable, and there are thousands of examples in TradingView's community scripts.
here's the basic structure of a pine script strategy:
- strategy declaration. defines the strategy name, initial capital, commission
- entry conditions. the specific rules that trigger a buy or sell
- exit conditions. stop loss, take profit, or conditional exits
- position sizing. how many contracts per trade
the key to useful backtesting on TradingView is making your entry and exit conditions as specific as possible. "buy when price breaks above the opening range" is testable. "buy when the chart looks bullish" is not.
if you're using edgeful's ORB indicator for TradingView, you already have the opening range levels plotted on your chart. you can reference those levels in a pine script strategy to backtest ORB breakouts across different timeframes and sessions.
how to backtest on TradingView using edgeful indicators
edgeful offers several free TradingView indicators that can be used as the foundation for backtesting strategies:
- ORB indicator. plots opening range levels for any timeframe (5, 15, 30 min)
- initial balance indicator. marks the first hour's high and low
- gap fill indicator. shows the gap level and tracks fill progress
- session indicators. marks NY, London, and Asian session boundaries
each of these creates clear, defined levels that translate directly into backtestable rules. for example:
- enter long when price breaks above the 15-minute ORB high during the NY session
- enter short when price rejects the IB high and closes back inside the range
- enter long when the gap begins to fill and hold for a target at the prior close
the advantage of using edgeful indicators for TradingView backtesting is that the levels are objective and consistent. every trader sees the same levels. there's no subjectivity in where the opening range high is. it's a defined price level.
for more on how these indicators work, check out our guides on the initial balance indicator and the gap fill indicator.
common backtesting mistakes on TradingView
overfitting
the most common mistake in TradingView backtesting. you tweak your parameters until the backtest looks perfect, and then the strategy fails in live trading. if your strategy has 12 conditions and only works on one specific ticker in one specific timeframe, it's probably overfit.
ignoring slippage and commissions
TradingView defaults to zero commission and zero slippage. that's not realistic for futures. always set commission to at least $4-5 per round trip and add 1-2 ticks of slippage. this alone can turn a "profitable" backtest into a losing one.
too small a sample size
50 trades is the minimum. 100+ is better. if your backtest only produced 15 trades over 6 months, the results aren't statistically meaningful. you can't draw conclusions from a small sample.
backtesting the wrong session
if you only trade the NY session, your backtest should only include NY session data. a strategy that's profitable across 24 hours might be terrible during the specific hours you actually trade. TradingView allows you to filter by session using pine script. use it.
curve fitting to recent data
testing only on the last 30 days of data is a recipe for disappointment. markets change. a strategy needs to work across different conditions: trending, ranging, high volatility, low volatility. use 6-12 months minimum.
the limits of TradingView backtesting (and what to do about them)
TradingView strategy tester is useful, but it has real limitations for serious futures traders:
- no session-level filtering in the UI. you need pine script to limit backtests to specific sessions
- limited statistical breakdown. you get win rate and profit factor, but not performance by day of week, session, or market condition
- single-instrument testing. you can't easily compare the same strategy across ES, NQ, GC side by side
- no forward testing. backtests only look backward. they don't account for changing market conditions
this is where combining TradingView backtesting with a dedicated data platform changes the game. edgeful doesn't just show you whether a strategy worked in the past. it breaks down performance by ticker, session, timeframe, day of week, and specific market conditions.
according to edgeful data, the same trading setup can have dramatically different performance depending on when and where you trade it. a strategy that shows a 72% win rate in the NY session on NQ might only show 51% during the London session. TradingView's strategy tester won't tell you that. edgeful's reports will.
combining TradingView backtesting with real statistical data
the most effective approach to backtesting on TradingView combines two tools:
- TradingView for execution backtesting. does my pine script strategy fire at the right times? are the entry and exit mechanics correct? what's the rough performance profile?
- edgeful for statistical validation. does this setup actually have an edge in the specific conditions I trade? what's the win rate by session and day of week? how does performance change across different market conditions?
here's how that looks in practice:
- you have a hypothesis: "the 15-minute ORB breakout on NQ works better on Tuesday-Thursday during the NY session"
- you check edgeful's ORB report. it confirms that the win rate is higher on Tuesday-Thursday in the NY session compared to Monday
- you build a pine script strategy in TradingVIew that only takes ORB breakouts during the NY session on Tuesday-Thursday
- you run the backtest on TradingView to validate the execution logic and get a detailed trade-by-trade breakdown
this combination gives you both the statistical edge AND the execution confidence. most traders have one or the other. having both is what separates traders who know their setup works from traders who hope it does.
the effort is real. this isn't a shortcut. you have to learn pine script, understand the data, and put in the hours to build and test strategies. but when you do, you're trading with a level of confidence that most people never reach.
for more on building a solid approach to validating your strategies, check out our guide on backtesting best practices.
key takeaways
- learning how to backtest on TradingView starts with the built-in strategy tester. add a strategy, review the results in the performance tab
- TradingView backtesting requires specific, rule-based entry and exit conditions. vague setups can't be tested
- always set realistic commission ($4-5 per round trip) and slippage when backtesting on TradingView. zero-cost backtests are misleading
- the TradingView strategy tester has limitations: no session-level filtering in the UI, no cross-instrument comparison, no breakdown by day of week or conditions
- combining TradingView backtesting with edgeful's statistical reports gives you both execution validation and performance data across sessions, days, and tickers
- according to edgeful data, the same strategy can show dramatically different results depending on session and conditions. TradingView alone won't reveal this
- backtesting is the foundation, but it requires effort: pine script learning, parameter setting, and meaningful sample sizes (100+ trades minimum)
trading involves risk. past performance and historical data do not guarantee future results. backtest results may not reflect live trading performance due to slippage, market conditions, and execution differences. always trade with proper risk management.
FAQs


