What is backtesting? It’s a way to test a trading strategy using past market data.
It’s a simple concept … but actually doing it can get a bit more complex.
Setting up an automated backtest can involve coding. And that can send you down the rabbit hole into automated trading and algorithmic trading … That’s all way over my head.
I like to stick to my little penny stock niche — away from all the institutional investors and algorithms.
But backtesting can still have advantages, and you should know what it is as an informed trader. So let’s get into how to backtest a trading strategy. Plus I’ll give you some tips and common mistakes to avoid.
Table of Contents
- 1 What Does Backtesting Mean?
- 2 How Does Backtesting Work?
- 3 Why Is Backtesting Important?
- 4 Automated Backtesting vs. Manual Backtesting
- 5 What Are the Types of Backtesting Systems?
- 6 4 Tips for Effective Backtesting Strategies
- 7 What’s Backtesting in Value at Risk (VaR)?
- 8 How Is Backtesting Done? See a Practical Example
- 9 Top 3 Backtesting Mistakes You Must Avoid
- 10 4 Platforms You Can Use for Backtesting
- 11 Frequently Asked Questions About Backtesting
- 11.1 How Accurate Is Backtesting?
- 11.2 How Long Should You Backtest a Trading System?
- 11.3 What’s the Difference Between Backtesting and Forward Performance Testing?
- 11.4 What’s the Difference Between Backtesting and Scenario Analysis?
- 11.5 Should You Build Your Own Backtester?
- 11.6 What’s the Ideal Backtesting Period for an Intraday Strategy?
- 12 Conclusion: Is Backtesting a Waste of Time?
What Does Backtesting Mean?
It’s testing a trading strategy using historic price movements. It’s based on the assumption that past results are indicative of future returns. But that assumption can be dangerous…
That’s why I prefer saying, “History doesn’t always repeat, but it often rhymes.”
History rhymes because the market’s made up of traders and investors, and human psychology doesn’t change. So the market doesn’t change.
[Please note that these kinds of trading results are not typical. Most traders lose money. It takes years of dedication, hard work, and discipline to learn how to trade, and individual results will vary. Trading is inherently risky. Before making any trades, remember to do your due diligence and never risk more than you can afford to lose.]
New to penny stocks? Get my FREE online guide here and start your trading journey today.
How Does Backtesting Work?
Technical traders usually use backtesting. If you see a pattern in the market that you think is repeatable, you can backtest the strategy to see if it’s potentially profitable.
Before you can backtest a trading strategy, you need to know the parameters of your strategy. For example, what signals entries and exits? Where will you cut losses, and what time frame do you want to trade?
Then you take those indicators and apply them to past market moves to see if they result in the returns you expect.
It’s kinda like paper trading. But you’re testing based on the past market, rather than in the current one.
See which stocks I’m watching every week, right from your inbox. Sign up for my free weekly watchlist here.
Why Is Backtesting Important?
It can be important if you want to look at data on how often your pattern or strategy works, or whether it works, without risking your capital.
When you know how reliable a trading strategy is, you can then make some key decisions … Do you want to trade it, tweak it, or forget about it and start over?
You can also adjust your position size based on the strategy’s win rate. You might choose to be more aggressive with higher-odds setups or use smaller position sizes on less-reliable patterns.
Getting the information you need to make these decisions can take time, but it can be worth it. It’s one part of becoming a consistent, self-sufficient trader.
It took me years to learn my trading patterns. But it doesn’t have to take you years — I can be the mentor to you that I never had. I started teaching to help students learn from my mistakes.
Automated Backtesting vs. Manual Backtesting
You can choose an automated system or a manual method. Let’s break ‘em down…
What’s Automated Backtesting?
Automated backtesting involves using software or a platform. You’ll have to program the software to enter and exit trades based on the indicators of the strategy you’re testing.
How Do You Manually Backtest?
You can backtest without fancy programs, but it’s not as easy. To do it, you need access to charting software with historic charts.
Then, choose a stock chart you want to use to test your strategy. Scroll back in the chart a few years … Next, scroll the chart forward one candle at a time, marking every time your trading indicators indicate a buy or a sell or to cut losses.
Record your trades and results in a trading journal or a program like Excel or Google Sheets.
What Are the Types of Backtesting Systems?
This is the starting point and where you’ll probably have more than one strategy in mind. The goal is to narrow them down to a few you’ll test more thoroughly.
The name of the game here is speed. You want quick results on whether the strategy has any potential before testing further.
This is a type of automated-backtesting system. It runs on a loop based on the code you enter in.
It’s very similar to executing real trades. The program runs simulated market data and executes buys and sells based on the triggering events you enter in the code.
4 Tips for Effective Backtesting Strategies
The more parameters you have for your strategy, the better your results should be. You want to be specific on the type of trade you want to take. You don’t want mixed results with too many variables.
You want specific data on a specific setup. That’s it.
When I trade, I look for specific patterns and price action. If it’s not there, I don’t take the trade.
Remember the Big Picture
When you backtest a trading strategy, you want to account for all kinds of markets. Testing a strategy during a bull market might not give you a good picture of how the strategy will work in a bear market and vice versa.
Also, think about the kind of market you test a strategy in. If you backtest a market driven by a certain sector, like tech or coronavirus, the strategy may not necessarily work in a different hot market or sector.
Do your testing over a time frame that accounts for different market conditions and hot sectors.
Include Fees in Your Testing
Most brokers have gone to a commission-free model, but not all of them. Most backtesting software allows you to account for commissions.
If you’re testing a short-selling strategy, you should also account for borrow fees and interest charges. You gotta know if your strategy will be profitable after fees and commissions.
Never Stop Learning
Having good results from a backtest doesn’t mean you’re on the road to riches overnight. Don’t just jump into the market thinking you’ll nail every play.
Remember to be patient & let the best trading setups come to you, you do NOT have to trade every minute, hour or even every day/week. Patience is difficult so that’s why most traders don’t practice it/that’s also why most traders lose on non-ideal setups that lead to frustration!
— Timothy Sykes (@timothysykes) September 16, 2020
What’s Backtesting in Value at Risk (VaR)?
Value at risk (VaR) is a calculation of how much an investment might lose over a given time period in normal market conditions.
VaR is measured as a probability of loss. It’s not exact. Backtesting VaR compares your actual losses to your probable loss calculation. This will give you the accuracy of your VaR calculation. If your VaR calculation fails the backtest, you can make adjustments to your calculation.
Institutions mostly use VaR to determine risk either firm-wide or by an individual portfolio or position.
How Is Backtesting Done? See a Practical Example
Let’s say you have a chart pattern with indicators that you believe can predict a penny stock supernova before it goes up … (BTW, I have a strategy for this. You can get the alerts for no cost. Sign up for my Supernova Alerts here.)
You input your indicators and parameters into your chosen software. Choose your time frame, going back, say, three years. The software runs and builds a portfolio based on the buy and sell indicators you program in.
When it’s done, you have a portfolio of data showing which stocks went up and which were losers. You can review all the data from your portfolio analyzer to see if it’s a successful strategy.
Top 3 Backtesting Mistakes You Must Avoid
We’ve covered all the basics … Now let’s look at three mistakes to avoid at all costs.
Ignoring The Data
You want your new-found strategy to work … Everyone likes to be right. But the goal of backtesting isn’t to be right — it’s to gain knowledge.
If you can’t accept you’re wrong, you might try to change the outcome. You might leave out trades you say you would’ve taken in real life. Or exclude trades tested in a bear market, thinking it doesn’t apply to the bull market you’re trading in.
Don’t cherry-pick which examples you use or don’t use. If the trade was based on the parameters of your strategy, you need to include it in your results.
Sometimes having too much information can cause analysis paralysis. If you’re over-analyzing every single move, you can freeze up and miss out on a perfect opportunity. Or you can think you see your setup but miss one indicator, resulting in a loss.
The whole point of backtesting a strategy is for the data. You can then use that data to find confidence in your setup. Take the trade and see how it works. If it doesn’t work, cut your losses and move on.
If your losses are smaller than your gains then your account will grow over time.
Failure to Adapt
Relying solely on backtesting results can hurt your trading. Your results might be stellar, but maybe that strategy doesn’t work in the current market. You have to be able to recognize when a setup doesn’t work and adapt.
Determine if it’s a short-term change and adjust your position sizes. Or if you must, stop trading the strategy altogether.
I am EXTREMELY grateful though for all the shorts, they REALLY hate studying or adapting to changing markets, & while it causes huge losses/stress for them, it makes dip buying/breakouts SO MUCH BETTER FOR LONGS! So, thank you short sellers, please never study/change, keep it up!
— Timothy Sykes (@timothysykes) September 16, 2020
4 Platforms You Can Use for Backtesting
There’s software available to help you with your strategies. Let’s go over a few of them…
Backtesting in Excel
You can use Excel to track your manual backtest results.
Just enter the data for the pattern you’re testing, like where you entered and exited. What was the stock’s high of the day and how much did it go up?
Then you can use Excel’s formulas to give you an average of how stocks performed over time. And you can view the data as percentages, charts, or graphs.
Backtesting on Tradingview
You can backtest on Tradingview with its web-based platform. But you have to be able to enter the parameters of your strategy as lines of code.
You have to enter whether you’re going long or short, your risk, your position size, and your entry and exit signals. Once you enter the information, the system is totally automated.
Backtesting With Python
Python is a tool for building automated trading systems. It requires writing code for your trading strategy.
With Python, you can use its pre-existing outlines or make your own.
Backtesting With AmiBroker
AmiBroker also requires you to enter code for your buy and sell indicators. You can also set your position sizes and the number of positions you want to take at any one time.
Restricting your portfolio size can be good practice so you don’t use all your capital at once.
Frequently Asked Questions About Backtesting
Let’s go over some frequently asked questions…
How Accurate Is Backtesting?
It can have different outcomes of accuracy depending on the information you put in. And there’s always the chance that a strategy that worked in the past won’t work in the present market.
How Long Should You Backtest a Trading System?
It’s smart to backtest over a course of at least a few years. It’s even better if you can backtest over different market conditions like bear markets and bull markets. This can give you better data on whether your strategy can work in any market.
What’s the Difference Between Backtesting and Forward Performance Testing?
You backtest to analyze how your trading strategy has performed in past markets. Forward performance testing is another term for paper trading. In short, forward performance testing is putting your strategy to work in real time without using real money.
What’s the Difference Between Backtesting and Scenario Analysis?
When you backtest, you use real historical data to determine a strategy’s success rate. Scenario analysis uses hypothetical scenarios to simulate changes in a portfolio’s value. It’s more like an estimate of the worst-case scenario.
Should You Build Your Own Backtester?
That depends on how much time you have and your coding prowess. The experience can be educational and you can fine-tune your parameters to test a specific strategy. You can run your custom test on an automated platform like Tradingview or Python.
What’s the Ideal Backtesting Period for an Intraday Strategy?
To backtest day trading strategies, you should still go back a few years. You want to make sure your strategy can work in many different market conditions. To have a high-odds strategy, it has to be repeatable over time.
Conclusion: Is Backtesting a Waste of Time?
Backtesting can give you useful data on a strategy. It could give you confidence in your trading if you have the numbers and data to back up your theory. I think it’s worth knowing the past. As I always say, “I’m just a glorified history teacher.”
But remember, the markets constantly change. You need to be able to adapt.
By the time you track a pattern in the past market, it might not work in the current market. That’s why I became a teacher — to teach students the nuances of the market.
I’ve been trading the same penny stock patterns for years. It doesn’t matter if it’s crypto, electric vehicles, coronavirus, or any other hot market.
By trading with a small account and sticking to my patterns, I turned my $12,415 bar mitzvah money into $1.65 million by the time I graduated college.*
Now I’ve been in the market for 20+ years. I’ve seen a lot of hot markets, hot sectors, and even bear markets. And I’ve profited through all of them.*
Ready to learn the patterns and strategies that got me where I am today? Apply for my Trading Challenge.
Want to build your knowledge account first? Start with the 30-Day Bootcamp I made with one of my top students, Matthew Monaco. You can go as fast or slow as you need. And you can rewatch the videos as often as you need. It’s all broken down in 30 easy-to-digest lessons…
What do you think? Let me know in the comments … I love to hear from my readers!