What Is Backtesting?

[ad_1]

TL;DR

Backtesting can be an important step in optimizing how you engage with financial markets. It helps you learn whether your trading ideas and strategies make sense and if they could potentially turn a profit.

But how does backtesting a simple investment strategy look like? What should you be wary of when testing trading strategies? Is backtesting similar to paper trading? We’ll answer all these in this article.

 

Backtesting is a tool that you (as a trader or investor) can use when exploring new markets and strategies. It can provide some valuable feedback based on data and tell you whether your initial idea was valid.

Regardless of the asset classes you trade, backtesting doesn’t require you risking any of your hard-earned funds either. Using backtesting software in a simulated environment, you can build and optimize a particular approach to a market. Let’s dive in.

 

In finance, backtesting looks at the viability of a trading strategy by testing how it would have done based on historical data. In other words, it uses past data to see how a strategy would have performed. If backtesting shows good results, traders or investors may go ahead and apply the strategy to a live environment.

But what do good results mean in this case? Well, the purpose of a backtesting tool is to analyze the risks and potential profitability of a particular strategy. The investment strategy can be optimized and enhanced based on statistical feedback to maximize the potential results. A well-conducted backtest can also provide assurance that the strategy is at least viable when implemented in a real trading environment. 

Naturally, a backtesting platform or tool can also be beneficial in showing when a strategy is not viable or too risky. If the backtesting results indicate a suboptimal performance, the trading idea should be either discarded or modified. However, it’s also important to consider the market conditions it was tested in. The same backtesting could present conflicting results when the market conditions change.

On a more professional level, backtesting trading strategies is absolutely essential, especially when it comes to algorithmic trading strategies (i.e., automated trading).

 

The underlying premise behind backtesting is that what worked in the past may work in the future. However, this can be really tricky to determine. What may be profitable in a particular market environment will completely flop in another.

Backtesting with a misleading data set can lead to less than ideal results. This is why it’s crucial to find a good sample for the backtesting period that reflects the current market environment. This can be especially difficult, as the market is in a constant state of change.

Before you decide to backtest a strategy, it can be helpful to determine what exactly you would like to find out. What would make the strategy viable? Conversely, what would falsify your assumptions? If you know these beforehand, it will be more difficult for the results to affect your biases.

Backtesting should also include trading and withdrawal fees, and any other cost that the strategy may incur. It’s also worth noting that backtesting software can also be quite expensive, just as access to high-quality market data is.

And keep in mind that backtesting is, well, testing. Similar to technical analysis and charting, there’s absolutely no guarantee that it will work, even if it produces great results based on historical data.

 

Let’s go through a dead-simple long-term strategy for Bitcoin.

Here’s our trading system:

  • We buy Bitcoin at the first weekly close above the 20-week moving average.
  • We sell Bitcoin at the first weekly close below the 20-week moving average.

This strategy produces only a few signals per year. Let’s look at the time period starting from 2019.

Bitcoin weekly chart since 2019.

The strategy produced five signals in the measured timeframe: 

  • Buy @ ~$4,000
  • Sell @ ~$8,000
  • Buy @ ~$8,500
  • Sell @ ~$8,000
  • Buy @ ~$9,000

 

So, our backtesting results show that this strategy would have been profitable. Does this mean it’s a guarantee it will continue to work? No. It just means that looking at this specific data set, the strategy would have turned a profit. You could think of this result as a rough benchmark.

Bear in mind; we only looked at less than two years of data. If we’d like to turn this into an actionable strategy, it may be worth going back further in time and test it with more price action.

With that said, this is a promising start. Our initial idea seems to be sound, and we may be able to create an investment strategy from it with some further optimization. Maybe we’d like to include more metrics and technical indicators to make the signals more reliable? It’s all up to our own ideas, investment time horizon, and risk tolerance.

 

So, now we have a rough idea of what backtesting may look like and had a look at a very simple investment strategy. We also know that past performance is not indicative of future results.

So, how could we optimize a systematic strategy for current market conditions? We could try it out in a live market but without risking real funds. This is also known as forward performance testing or paper trading.

Paper trading is the simulation of a strategy in a live trading environment. It’s called paper trading because while the trades are documented and logged, no real funds are used. This provides you with an additional step where you can improve the strategy and get an idea of its performance.

That’s great, but where can you actually start? The Binance Futures testnet is a perfect place for you to test out strategies in the here and now but without risking your funds. You can create an account in a matter of minutes, and test out strategies in a similar environment as if you’d be live trading in real-time markets.

Something to be wary of here is “cherry-picking.” This refers to selecting only a subset of data to confirm a biased viewpoint. The point of forward testing is to test out the strategy as if it would happen in real-time. If the system tells you to do something, do it. If you only pick trades that “look good” based on your personal bias, then the test for the systematic strategy won’t be valid.

 

Manual backtesting involves analyzing charts and historical data and manually placing the trades according to the strategy. Automated backtesting does essentially the same, but the process is automated by computer code (using programming languages like Python or specialized backtesting software).

Many traders use Google or Excel spreadsheets to evaluate the performance of a strategy. These documents work like strategy tester reports. They may include all kinds of information, such as the trading platform, asset class, trading period, number of winning and losing trades, Sharpe ratio, maximum drawdown, net profit, and more.
In short, the Sharpe ratio is used to evaluate the potential ROI of a strategy in relation to the risks. The higher the Sharpe ratio value, the more attractive the investment or trading strategy is.

The maximum drawdown represents the moment at which your trading strategy had the worst performance relative to the last peak (i.e., the biggest percentage drop your portfolio had during the analyzed period).

 

Many systematic traders and investors heavily rely on backtesting for their strategies. It’s one of the essential instruments in the toolkit of any algo trader.

At the same time, interpreting backtesting results can be tricky. It’s easy to imprint your own biases into the backtesting method. Backtesting alone likely won’t create viable trading strategies, but it’ll help you test some ideas out and keep your finger on the pulse of the market.

[ad_2]

Source link