Backtesting and Paper Trading: The Secrets to a Profitable Algorithm

4
min read

Backtesting and Paper Trading: The Secrets to a Profitable Algorithm

Have you ever bought a house or a car without any preliminary research? Most likely not. Because it’s the research that tells you what to expect and if something is worth your money.

Trading is the same —  yet, many people blindly jump into sessions without assessing its risk level first. This approach of shooting shots in the dark, hoping to strike gold at least once, leaves more victims than winners.

Backtesting and paper trading are two halves of the same risk assessment and algorithm verification coin — they work in tandem to tell you the whole story of your trade’s future effectiveness — before your capital gets the chance to erode in a LIVE market.

What is Backtesting?

Backtesting is a tool to validate your trading thesis by testing it on relevant data from a previous time period.

Its purpose is to:

  • see if an algorithm functions well in market conditions that mimic the current market environment.
  • assess the algo’s resilience by testing it on various stocks or market assets.
  • identify weak spots which you can modify and test further.

At the very least, this tool shows whether or not your algorithm is sound when exposed to future data and will yield profits when applied in a real trading environment.

All quantifiable trading ideas can be backtested. You can run a simple test using Excel, use a third-party platform that offers backtesting capabilities on various asset classes (but they require some knowledge in coding languages); or, you can use our platform to easily validate any algorithm using 20 years of intraday data — without writing any code.  


Why is Backtesting Important?

Backtesting is a fundamental part of a thesis’ evolution into a viable trading strategy.

Remember that an algo strategy isn’t static; it’s dynamic — it is essentially a prototype that can be tweaked and refined before you fuel it with hard-earned funds and deploy it into the LIVE market.

Here’s another situation where backtesting is valuable — you have multiple algos, and you believe all of them have limitless potential. They’re your brainchild, after all. But, in reality, not all your darlings will bring you profits or even keep your capital afloat in a real market. Your job as a trader is to spot the stars that are worth your time and capital. Backtesting can help with picking out the winners.

Also, some algos do not work well with certain market conditions. Backtesting can give you information on when to deploy which system. Otherwise, strategy and timing mismatch will quickly exhaust funds, and you won’t have capital left when the environment shifts and becomes conducive to where the algo can thrive.


How Does Backtesting Work?

The underlying concept of backtesting is rooted in the theory that the stock market runs in cycles.

So, theoretically, if a thesis worked in the past, then it may work in the future. If it performed poorly in the past, then its chance of success in the future is minimal, signifying that you need to tweak or reject the strategy.

But picking relevant and unbiased data sets — from a time frame that resembles the current market environment — is critical to gather results that can be extrapolated to the present system. It’s also vital that the data set includes stocks from companies that went bankrupt, were delisted, liquidated, or were sold. If your sample data only has companies that still exist today, you will get skewed results.


Problems With Backtesting

Backtesting isn’t devoid of flaws, but it is a good first step in validating your algorithm. Here are some of the shortcomings of backtesting that can produce misleading results:

  • Optimization Bias: Optimization bias occurs when you over-optimize your algorithm with too many parameters to improve its performance on a single data set. It often goes like this — you add an indicator as an honest attempt at improving a system. You test it again and then decide to add another indicator to enhance the results further. This goes on till the system is perfectly optimized for that single dataset. The problem, though, is that your strategy is now optimized to bring brilliant results for that specific dataset but might fail when you apply it to LIVE Trading.
  • Look-ahead Bias: This refers to when a strategy uses data that isn’t yet available. Consider this example — you are an avid Tesla fan, and you are aware that the company has been doing well over the years. You create a strategy to trade Tesla and backtest using data from the Feb – December 2020 period. The results will be outstanding since the TSLA stock price increased by 313%, compared to the S & P 500 index, which only saw an 11% gain during the same time frame. You unintentionally infected the results with look-ahead bias. The unreasonably positive results will make your ego feel good, but the strategy likely won’t work in the current trading environment.
  • Survivorship Bias: This refers to when a trader uses a dataset containing only actively trading stocks. The resulting outcome is artificially inflated since closed or delisted stocks are kept out from the sample and won’t be reflected in the results. Most importantly, a dataset polluted with survivorship bias is an inaccurate representation of the past and will give you distorted results that fail to convey what must’ve actually happened in that time frame.

You can take steps to ensure that bias doesn’t creep into your data selection and backtesting process, but here is another of its shortcomings — in the real market, history doesn’t always repeat itself. The result of the time capsule you’re testing your strategy against may not happen again when you decide to deploy your system.

This is why backtesting is only one part of the coin when assessing the feasibility of a trading algo. Once your strategy gets the green light from backtesting, paper trading is the other half it must withstand.


What is Paper Trading & Why is it Important?

Paper Trading, also known as forward testing, is where you take the parameters of your algorithm and apply them to real-time data. It is called paper trading since bankroll virtual cash is used for buying and selling securities.

An essential part of forward testing is to keep the system’s rules identical to when you backtested. It is an effective way to verify the system's true potential without committing and risking actual capital.

One of the biggest advantages of paper trading is that it significantly minimizes the possibilities of over-optimization and look-ahead bias from corrupting the results of the trades. Also, if you find that the original system fails to bring results in a LIVE market, you can modify the parameters to meet the market conditions.


Unifying the Past and Present for a Winning Algo

Backtesting and paper trading are the two must’ve tools in every successful trader’s arsenal. It demystifies your system’s profit potential before taking its first breath on a LIVE market with real money. The two tools give you a unique opportunity to fortify your algorithm with tried and tested parameters that you’re fully confident will work.

Breaking Equity members get to utilize the platform's backtesting and paper trading capabilities on all their algorithms. The tools make it easy for beginners and pros to augment and refine their trading strategy before giving it wings.


Breaking Equity is neither a broker, nor provides investment advice. Breaking Equity is a platform designed and built for user generated trade testing and algorithms. It is not intended to be trading or investing advice. Breaking Equity does not recommend stocks, equities, or any other vehicle to buy or sell. Breaking Equity is a platform to enable you to make your own investment decisions. All data, analysis, tests, metrics, transactions, signals, and platform are presented ‘AS-IS’ and without warranty. Breaking Equity does not guarantee performance and holds no liability for your trading, algorithms or executions via broker services. Please invest wisely. Please do your own research and due diligence before trading or investing.

Get Early Access

Join a community of users who found their alpha and started to algo-trade. We are running a closed early access program with a limited number of seats available. Join now to secure your early access and we will notify you when a space has opened up.