Thursday, November 21, 2024

The Ultimate Guide to TradingView Backtesting

Must read


?

When you buy something through one of the links on our site, we may earn an affiliate commission.

In this tutorial, I’ll show you how to use the backtesting function in TradingView and give you the benefits and downsides of this platform, based on my personal experience.

This powerful tool allows traders to test the effectiveness of any trading strategy, whether it’s one they have developed themselves, or one created by a member of the TradingView Community.

Key Takeaways

  • TradingView’s backtesting function allows traders to quickly test a wide selection of trading strategies across a huge collection of worldwide trading markets.
  • The platform offers a variety of strategies created by Community members, as well as the ability to create your own.
  • While there can be limitations to TradingView’s backtesting platform, there are also solutions.

Benefits of TradingView Backtesting

Trading at beach

Here are some of the benefits of using TradingView’s backtesting platform:

  • Fast results: The backtesting system is fast, and you can see the results right away. This allows you to iterate quickly and adjust your strategy accordingly.
  • Community scripts: You can use other traders’ strategies that are available in the Community. This saves you time and effort in developing your own strategy.
  • Historical Data: TradingView has a Deep Backtesting feature that provides all the historical data you need to conduct a thorough backtest.
  • Easy to use: The backtesting function is simple, no complex setups required.
  • Access tons of worldwide markets: TradingView gives traders access to a wide range of markets from around the world. It could be the largest collection of publicly available data feeds in the world.
  • Browser based: Available on almost any operating system.
  • Create your own strategies: Make and test your own strategies quickly with Pine Script.

Now that you know a little about the platform, here’s how to start using it.

How to Access Strategy Tester on TradingView

First make sure that you’re logged into a paid account.

To access the backtesting function, first click the Strategy Tester tab at the bottom of the screen.

Strategy Tester in TradingView

From there, click on the Load Your Strategy button.

This can either be a strategy that you’ve created or one that’s been developed by a Community member within TradingView.

To find a strategy, search by name or browse through the available community scripts.

Be sure to use the menu on the left of the window to see other types of strategies.

Select Personal to see the strategies you’ve created.

TradingView Strategies

Yeah, there are a TON of strategies available and it can be a little overwhelming.

So start with something that you understand and test all the related strategies.

For example, when I search for a Bollinger Bands trading strategy, here’s what comes up.

The number on the right of each strategy indicates the number of people currently using it.

Strategies list in TradingView

Usually, the most popular ones are at the top.

But not always.

So scroll through the strategies to see them all.

Once I click on a strategy, TradingView will add it to my chart, run the backtest on the current market/timeframe and give me the results.

Strategy result

You can see the trades it took and get a performance summary report below the chart.

Pretty slick!

How to Run the Backtest on Other Markets and Timeframes

Once you’ve selected a strategy to backtest, it’s super easy to run the test on any market and timeframe available on TradingView.

To run the test on another timeframe, simply click one of the available timeframes on the top of the current chart.

You can even set your own custom timeframe by clicking on the down arrow and selecting “Add custom interval”.

Timeframes in TradingView

The results of the backtest on that timeframe will appear on the bottom of your screen, just like with the first backtest.

You’ll see the results almost instantly, making this a very efficient way to backtest.

To test the strategy on other markets, click on the watchlist icon in the upper right corner, then click on the market you want to backtest.

TradingView backtest on new market

You can also click on the current market ticker in the upper left corner of the screen and search for a new market to test.

Search for market in TradingView

Again, as soon as you select the market, you’ll see the backtesting results in the bottom panel.

Remove a Trading Strategy

To remove a strategy from your chart, click on the Object Tree icon on right side of the screen, then click the Delete icon next to the trading strategy.

Remove TradingView strategy

Once you’ve deleted a strategy, you can a new one, or go back to using TradingView as just a charting platform.

Evaluating Backtesting Results

Now it’s important to talk about what a “good” backtesting result is.

Many new traders think that they need to have a fantastic result on the first try, or the backtest is a failure.

That’s not how it works.

In reality, it’s best to look for strategies that have potential.

So here are some things to look for:

  • The strategy is near breakeven: The strategy could be optimized
  • There are huge winners, which get slowly get taken out by small losers: The number of losers could possibly be reduced
  • Conversely, there are consistent small winners, but a few big losers: The size of the losing trades could be reduced
  • Strategies that perform well in some markets but not others: Only trade it in markets where it performs well

But that’s just the tip of the iceberg.

To get a complete guide on how to judge and potentially improve backtesting results, read my article on good backtesting results.

Selecting a Trading Strategy the Smart Way

When it comes to selecting strategies to test, there are a couple of ways to approach it.

First, you can browse the available strategies that you can use for free, as I mentioned above.

Sort the strategies by popularity and backtest each one.

This is a decent method if you don’t know where to start.

But you’ll quickly learn that most of the free strategies don’t work.

Yeah, you generally get what you pay for.

And there are so many strategies out there that it would take forever to test them all.

So once you get tired of looking for random ass strategies, it’s time to get smarter.

A better way to approach this proess is to start by asking yourself what type of strategy you’re looking for:

  • Do you prefer trend strategies?
  • Do you want to trade a RSI strategy?
  • Do you want to day trade?

Then take a look at all of the strategies that fall into your chosen category.

Search keywords related to the type of strategy you want to find. 

Backtest them and see how they perform.

Again, chances are very good that they won’t work.

But they might.

Worst case scenario, they will give you a good starting point and ideas for your own strategy.

This is a huge benefit of the TradingView Community.

How to Create Your Own Strategy

Since many of the trading strategies on TradingView are free and open source, you can use them to help build your own strategy quickly.

First find a free strategy that you want to build on.

Then create your own Pine Script project by clicking on the Pine Editor tab at the bottom of the screen.

TradingView Pine Editor

Copy and paste an existing strategy into the Pine Script tab and start making adjustments.

Save the strategy, then run a backtest.

Yes, you need to learn Pine Script.

But most programming tutorials can be very boring.

When you know what you want and you have a starting template to get there, learning becomes much more fun and you’ll usually see results faster.

Focus on the parts of the current script that you want to change and go from there.

To sign up for TradingView, go here.

Considerations of Historical Data Availability

When using the backtesting function in TradingView, it is important to understand how much historical data is being tested in each test.

Data availability will vary by market and timeframe.

Higher timeframe charts like the daily, weekly and monthly charts will usually have enough data to do valid tests.

But on lower timeframes, such as the 4-hour chart and below, the historical data is very limited.

You may only have access to two or three years of data, which is never sufficient to do a thorough backtest.

Be sure to read more about how to how many trades you need to have confidence in a trading strategy.

If you require the entire data set for a particular market, you’ll need to subscribe to the Deep Backtesting feature, which is only available on the higher tier paid plans.

This is a big downside of the platform.

If you don’t want to pay the higher TradingView monthly fee, there are other solutions such as Naked Markets, which usually provides much more historical data than TradingView and free ongoing data updates, for just a one-time investment.

Limitations and Downsides

Here are the limitations of TradingView to be aware of:

  • The backtesting function is only available on TradingView paid plans.
  • TradingView lacks sufficient historical trading data on the lower tier plans. It can be enough data on the higher timeframes, such as the daily chart. As you move down to lower time frames like the 4-hour or 1-hour chart, you may only get two or three years of data, which is not enough. You have to pay more for Deep Backtesting to get more comprehensive data.
  • There’s no way to upload your own historical data.
  • You can only backtest one market, strategy and timeframe at a time. There is currently no way to backtest multiple variables simultaneously.
  • No offline testing.
  • The reporting metrics are decent, but still limited. I would like to see more detailed backtesting statistics.
  • Although TradingView’s backtesting function is useful, it is not a substitute for live trading. You should still exercise caution and not rely solely on backtesting results. Be sure to implement Forward Testing before risking real money on a strategy.

While TradingView’s backtesting function has its limitations and costs, it can be a valuable tool for testing trading strategies quickly.

Conclusion

Based on my experience with the backtesting function in TradingView, it’s not for everyone.

It only really makes sense if you can do 2 things:

  1. Code in Pine Script
  2. Subscribe to a paid plan that has Deep Backtesting capability

One big benefit of the backtesting feature is that you can test community-created trading strategies and scripts.

Unfortunately, most of them are useless. That’s no different than any other platform.

But they can be an excellent starting point to give you ideas for your own strategy.

If you want to backtest manually, TradingView also has a Bar Replay function that will eliminate the need to learn Pine Script.

So at the end of the day, backtesting in TradingView can make sense for some traders, but it’s not for everyone.

That said, I strongly feel that TradingView is the best charting platform available and I highly recommend it for that.

 



Source link

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article