How to Backtest a Trading Strategy in TradingView


Staff member

Hello Traders,

Hope you're all doing fantastic!!!

I learned a few weeks ago that TradingView released a CSV Export feature. Basically, you can export any indicator outputs/plots and get the data in your favorite Excel/ Google Sheet/Open Office, etc.
Using that software is relatively easy and learning how to construct pivot tables/charts will expand your analytics beyond the realm of what you thought was even possible.

Trading strategies and trading setups can be backtested by using a manual or systematic approach.
Trading strategies should be backtested to determine if they will show promise and profitability in a variety of markets or if they are a waste of time and money. While you can get software that does systematic backtesting… we prefer manual backtesting as it can be carried out by any type of trader,

Developing an effective trading strategy is essential. Each strategy is unique, and any slight change will affect the results. This is why backtesting is critical, since it shows which parameters work best.

What Do I Backtest?

To start backtesting, you don't need a complete trading strategy. For example, I always look at new trading setups and candlestick formations and backtest them to see how effective they are. Trading strategies can be tested in small parts before they are implemented as a whole. In addition, you should backtest your entire trading strategy in a variety of trading environments.

  1. Use at least a few weeks of trading data when testing short-term strategies on short timeframes. Ideally, you should use years of trading data if you're analyzing higher timeframes.
  2. Define the parameters of the strategy. Various conditions must be met when entering and exiting. You should include as many "If X happens, then I will do Y" scenarios as you can so that your strategy can be repeated. Risk management must also be included in these parameters. Decide what percentage of your account you are risking on each trade if you are risking an equal percentage on each trade. In case you are managing your risk in another way, make sure it is something you are able to measure. ALL OF THESE PARAMETERS ARE WHAT YOU ARE MEASURING AND TESTING. THESE ARE THE ELEMENTS THAT YOU CAN CHANGE TO SEE WHAT IS MORE OR LESS PROFITABLE.
  3. By using TradingView's Bar Replay Tool, you can travel back in time and remove the predictive nature of knowing where the chart will end up. Depending on how far back you wish to go, you could search for trades from a year, a month or a week ago.
  4. Identify entry and exit points by analyzing price charts. Until all trades on the chart up to the current time have been located and marked or written down, it might take you several sessions to backtest and record the trades. (Be aware that it may take you a few sessions of backtesting to fully test a strategy.)
  5. After you have completed this step, you can begin to total up your trade results to determine how profitable or unprofitable your trading strategy / setup has been.

What Is Wrong with Backtesting?

When people fail at backtesting, it is usually because they are not thorough enough. That could mean that the backtest didn't include sufficient data. In a live trading situation, the strategy may not be usable or realistic because there are too many unknowns. Furthermore, people may not back test long enough to determine whether the strategy is profitable. A short losing or winning streak of trades can drastically affect the results if you have a small sample size. In order to be confident that your strategy can withstand live trading situations, you must have enough trades showing winning streaks, losing streaks, and everything in between. Imagine, for instance, that when you backtested your strategy, it never lost more than two trades in a row. However, when you start using it in real time, it loses five trades in a row. As this situation has not been tested, the results may differ. It is critical to backtest long enough and thoroughly enough so that nothing in live trading has not been tested before. The goal should be to achieve this, and you should feel confident enough that you have done everything possible to ensure that it has been achieved.

Using the TradingView Replay Tool

The Bar Replay Tool is how you can relive any moment in time on a chart. It can be used to study past price action, trading history or to analyze specific investing strategies at certain point in time.
  1. To get started, click the Bar Replay button at the top of your chart. If you are having a hard time finding this tool, look for the rewind icon ⏪ and click it
  2. Once you have the Bar Replay tool open, select your starting point or where you want to begin the replay. After you have selected your starting point, you can adjust your playback speed. This will determine how fast each bar of trading appears as you watch the replay
When you're ready, press the play button. Sit back and watch the action on your screen.


Reach out today to learn more about our plans and talk to us about your specific needs. We’d love to help you take your trading to the next level.

Twitter for B4 Signals:
Facebook for B4 Signals:
Join us for free on discord at:
And you can sign up for our Premium Membership at:
Check out our YouTube Here:

Happy Trading,
- B4 Team
Last edited by a moderator: