Imagine if there was a way to analyze a strategy before you even try it. Investors spend a good chunk of time not only thinking about a strategy, but also figuring out how well it might perform. Well, how do they do it? Place orders and pray? Nope, they backtest.
Backtesting is a process applied to a trading strategy that compares it against historical market data. The result is an overview of the strategy’s performance during certain periods of the market. It’s like comparing the odds of an outcome with a similar past occurrence – similar to the patterns discussed in this article.
Let’s use an everyday example. You go on a date with an attractive woman you’ve met at a local art gallery. She asks about your interests and you’re a second away from babbling about that one weird hobby you have (don’t talk about crypto). But wait, you remember that the last time you talked about it you were ghosted, so you talk about your mediocre cooking skills instead.
Backtesting is just like that. Prevent mistakes by comparing your actions to past events – or rather, past price action.
The Importance of Backtesting Trading Strategies
Backtesting helps with selecting a profitable trading strategy by comparing one against historical market data. The results reveal how the strategy would have played out in the past and its viability under present market conditions.
You likely have several ideas for taking on the crypto market. However, not all strategies may be profitable. Backtesting puts your ideas to the test without using real money and filters out the good from the bad.
You can assess strategies by trying them out. But who wants to lose money when you can experiment with a simulated market? There are alternatives such as paper trading, but the automated nature of backtesting makes it much easier for the average investor.
Backtesting vs. Paper Trading
A backtesting system processes your strategy at lightspeed and outputs the results in a readable format, giving you the statistics needed to identify a strategy’s robustness and flexibility. It’s like ordering food from a restaurant and receiving your dish five-minutes later.
Paper trading is akin to creating a recipe, buying the ingredients, and making the dish yourself – hours after you got hungry. You join the test-net version of an exchange, manually place orders, and wait for the market to fill your orders. With your new position, you wait for the market to move in real-time. If the market plays along, then great, your strategy worked. But if not, you’ll have to try again. You repeat these steps until you have enough quantitative data to back your strategy.
Even though paper trading looks good… on paper, there are some invisible factors that impact your strategy’s evaluation. For example, have you ever thought about the implications of trading assets with fake money?
There’s a huge difference between trading with real money and fake money. You don’t care if you lose $3,000 nor do you feel the dopamine rush of profiting $10,000 in Chuck E-cheese tokens when paper trading. You process the threat of capital loss and risks differently depending on how much money is involved and whether it’s real.
Paper trading and normal trading is the difference between shooting dummies in a shooting range and taking on enemy fire in a warzone. It’s why your body freezes once you perceive a tangible threat but doesn’t when a target dummy moves across the room. You can try to learn trading via paper trading but it’ll never be the same.
The flipside is that paper trading enables you to master trade execution. Maybe you’re the kind of person to flip flop when you’re under pressure – a terrible trait to have. With paper trading, you can pretend it’s real money and force yourself to stick with a plan, to execute the trade as intended. You can’t do this with systemic backtesting. However, it won’t matter if you want to use an automated strategy or trading bots.
How to Backtest a Trading Strategy
You can start backtesting by passing a check on a strategy within a specific time frame. This can be done manually by sorting trades and measuring wins and losses, by employing trading software which automatically does it for you, or by writing a Python script (if you know how to code).
I’ll show you a simple example of manually backtesting a strategy by using the RSI indicator. What I want to do is buy Bitcoin everytime RSI hits 30 and sell once it hits 70 on the daily time frame. For the backtest I’m using data ranging between September 2019 and May 2020.
With $10,000 in trading capital I end up with the following executions:
After the first buy and sell I have profited 24.36% and turned $10,000 into $12,436. The second pair turned into $16,957 after a 36.36% profit, followed by a lucky 81.76% profit that increased my capital to $30,821. The total profit I’ve made is 200% after less than a year of HTF trading.
Of course, six trades do not represent enough quantitative data for me to fully confirm the strategy’s effectiveness. What about another backtest on a different timeframe and time range?
In this example I have used the same capital allocation and RSI strategy but on a lower timeframe (4H). After purchasing and selling the RSI highs and lows between January and March 2019 I arrived to the following results:
The first buy-sell order brought me a 5.07% profit that profited me $507. Next I had a 8.39% profit which got me $11,388 in total. The last trade (and the best one) had a 9.96% profit, moving my total capital to $12,522. I have profited 25% in total.
There are two interesting facts that I noticed. First, it made sense in some situations to sell not the first overbought RSI, but the second one. In the second trade I could have sold at $4200 instead of $3643 for a 25% profit – more than double what I have made. Secondly, I have noticed that RSI reacted positively to the 50 level after dropping from an overbought phase. This gives me the impression that I should readjust the strategy and allow myself to buy 50, rather than 30, in some rare events. However, this would put me at higher risk.
A 25% profit isn’t that bad considering I have traded a small range. If I’m bullish on the market that means I increased my total crypto holdings by 25%, and that the future bull run would dramatically raise my profit levels if I decided to HODL at that moment.
The case for backtesting is that what has worked in the past may likely work in the future. But is that true? Can a strategy that worked in 2019 perform equally well in 2022? It might, but you shouldn’t bet on a “might.”
The market has a flow that changes with the wind. Altcoins chop one month, move erratically the next month, and then don’t move at all a couple months later. Longing parabolic moves might have worked in 2017 but it didn’t have the same efficacy in mid-2021 when Bitcoin lost its steam. Or perhaps trading the highs and lows of a channel made sense at one moment when whales manipulated the market, but what now that institutional investors hold more power?
One major con behind backtesting is that it’s not foolproof. Yes, a strategy might retain a similar risk-reward value within all market conditions but there’s always a chance for it to fail. And if you confidently put too much cash, you risk liquidating your account.
To try backtesting for yourself, check out Shrimpy’s backtesting tool at this link. Use it to construct a crypto portfolio and analyze returns from periodical portfolio rebalancing.
If you want to learn more about assessing trading strategies and automation, I recommend reading the following articles:
Marko is a crypto enthusiast who has been involved in the blockchain industry since 2018. When not charting, tweeting on CT, or researching Solana NFTs, he likes to read about psychology, InfoSec, and geopolitics.