How to Backtest on TradingView? – Free Strategy Scripts Without Coding

As technology continues transforming the financial market, TradingView has emerged as one of the leading online platforms for financial traders and investors. TradingView platform provides an intuitive, user-friendly interface that gives traders and investors a sophisticated charting package. It is a comprehensive and robust market analysis tool that allows traders to set indicators, test trading strategies, and share insights with other investors worldwide.
Please read our latest article to learn how to calculate pips on Tradingview.

The TradingView platform also provides an effective backtesting environment that allows users to test their trading strategies using historical price data. Traders can test custom-made indicators, systems, or automated trading algorithms Scripts (EA ) that can be retested multiple times using the latest data to ensure that strategies remain effective in the long term. In addition, the platform provides backtesting data for various securities, including equities, derivatives, and forex, in the last 50 years.


How to Backtest on TradingView?

To Backtest trading strategy scripts on TradingView, you need to do the following steps:

  1. Choose a backtesting chart timeframe (from 1 minute up to 12 months chart)
  2. Choose trading asset (EURUSd, GBPUSD, Gold, S&P500, etc. )
  3. Find strategy: Go to the “Indicators” section, and in the vertical menu, choose “Technicals.” and then “Strategies.”
  4. Choose strategy: From the list of systems, choose a preferable strategy. Additionally,  you can search for customized strategies.
  5. Set inputs: In the down part of the window, you can press the wheel icon (settings) to set inputs for your strategy in Strategy Tester.
  6. Analyze the result performance.

Please see the video from my fxigor youtube channel with detailed instructions and a good strategy example:

Let us see in detail how to backtest on Tradingview:

How do you Choose a backtesting chart timeframe in TradingView?

The chart timeframe in TradingView can be set if you press the  button in the left upper corner of the screen (see image below):

change tradingview timeframe


How to Choose a backtesting asset in TradingView?

To choose an asset in TradingView, press the icon in the upper left corner of the screen. Next, you will get a Window to search for wished trading assets. See the image below:

choose trading asset in TradingView

How to Choose a script for backtesting in TradingView?

To choose a script for backtesting, press the “Indicators, Metrics & Strategies” option in the upper menu. Next, you will see Window. Choose the “Technicals” option in the vertical menu and press the “Strategies” option. Here you can choose a wished strategy like in the image below:

choose strategy script in TradingView for bactesting

How to change inputs in the strategy Script for backtesting in TradingView?

To change input values in Script in TradingView, press the Strategy tester wheel icon (see image) to go to settings. In Strategy tester settings, you can change input values, trading size, and various preferred settings.

set inputs for backtesting in TradingView

How to change the date range for backtesting in TradingView?

To change the backtesting date range in TradingView, you need to add code to your script. If you add this code to your script, you will add Date Inputs option ability for the trader to add a Date range for testing:

date range in tradingview script

Please see the code:

// From Date Inputs
fromDay = input(defval = 1, title = “From Day”, minval = 1, maxval = 31)
fromMonth = input(defval = 1, title = “From Month”, minval = 1, maxval = 12)
fromYear = input(defval = 2018, title = “From Year”, minval = 2015)

// To Date Inputs
toDay = input(defval = 1, title = “To Day”, minval = 1, maxval = 31)
toMonth = input(defval = 1, title = “To Month”, minval = 1, maxval = 12)
toYear = input(defval = 2019, title = “To Year”, minval = 1970)

// Calculate start/end date and time condition
startDate = timestamp(fromYear, fromMonth, fromDay, 00, 00)
finishDate = timestamp(toYear, toMonth, toDay, 00, 00)
time_cond = time >= startDate and time <= finishDate


TradingView’s backtesting option offers traders an incredibly powerful tool for analyzing and improving their trading strategies. With the ability to see up to 2000 trades and use backtesting Date range in the last 50 years in just a few seconds, traders can quickly and easily test different scenarios and identify patterns that may not be immediately apparent through manual analysis.

This feature allows traders to optimize their trading strategies, minimize risk, and maximize profits. The convenience and efficiency of TradingView’s backtesting option make it a must-have tool for any serious trader looking to stay ahead of the curve in today’s fast-paced financial markets.

If you want to unlock TradingView (advanced features) click button and visit this page below:





Igor has been a trader since 2007. Currently, Igor works for several prop trading companies. He is an expert in financial niche, long-term trading, and weekly technical levels. The primary field of Igor's research is the application of machine learning in algorithmic trading. Education: Computer Engineering and Ph.D. in machine learning. Igor regularly publishes trading-related videos on the Fxigor Youtube channel. To contact Igor write on:

Trade gold and silver. Visit the broker's page and start trading high liquidity spot metals - the most traded instruments in the world.

Trade Gold & Silver

Recent Posts