How to backtest
Backtesting is the bread and butter of any trading strategy.
Why should you never skip backtesting any day trading strategy?
Reward: +10 XP 0 0 0
Before you can use any trading strategy, you first need to backtest. There are many blogs and videos about day trading available. Just look for day trading strategies on youtube and you’ll get thousands of videos. Avoid those that want you to pay money for indicators or sign up for a trading program. You don’t need paid indicators or trading programs. That is something you can do when you have more experience.
Day trading is about consistently following a set of rules that must be met before you enter a position. So before you can backtest, you need to have written down these specific sets of rules that come with the strategy. Once you have done that, you can use Tradingview to backtest this strategy. You can do this two ways:
- Using a pine script
- Using the replay bar
You can only use a pine script if you found a pine script for that strategy or if you know how to make one. This will probably go beyond the knowledge of many so the best way to backtest if you have no programming skills is by using the replay bar in tradingview. While there might be more programs out there that can do the same, I suggest you use tradingview. Do note you need to have a paid subscription if you want to use the replay bar. If you don’t have a paid subscription yet, go to tradingview, click “more” and select the plan you want. The first 30 days are free so you can test the replay bar before you pay. You can’t only use the replay bar, you can also plot more indicators on the chart. The free version only lets you plot three indicators. So if you’re picking a strategy using four indicators you run into problems. Although some indicators are made by the community and can contain multiple indicators at once.
Basically, if you are serious about day trading you need a paid tradingview subscription. It's well worth the money. The only reason not to take it is when you use a strategy that only uses three indicators max and you have another way to backtest.
7.1 Select the correct time frame and session
When you are backtesting, you want to make sure you select the correct time frame and trading session. For example, if you live in the United States you probably want to trade the New York session. When you live in Europe, you probably want to trade the London or Frankfurt session.
What happens when you select a time frame?
Reward: +10 XP 0 0 0
There are many ways to plot sessions on the chart. The easiest way is to find an indicator or pine script that can do it for you. I found one here. This pine script will plot sessions NY, Tokyo and London on the chart. When backtesting, it is important to only backtest when you are actually trading. It makes no sense to look at the chart of the New York session when you live in Europe. Because the market will move while you are sleeping. Unless you have trading scripts that are running 24/7 you should only focus on the session you want to trade. Meaning you only want to look at that specific part of the chart. Many traders look on the chart trying to find every possible trade that meets their trading rules. To get the above script in tradingview, copy the the pine script and paste it in the pine editor at the bottom of the screen:
Click “save” on the right side to save this script and then click “add to chart” to add the script on the chart. Do note that adding scripts to the chart consumes one indicator. If you are using the free version, you only have two indicators left to put on the chart. When added to the chart, it should look like this:
Where each colour represents a session. If you want to adjust the colours or session you can click on the “settings” button at the top left of the chart (blue circle). If you want to stop displaying this indicator on the chart click the “eye” button.
If you only want to trade the NY session, simply remove the London and Tokyo session by clicking the checkbox.
7.2 Using the replay bar
Once you have the session ready to go you can use the replay bar to go back in time. You should at least go back one hundred days. Try to not look at the chart while you are going back in time. As this might give you knowledge about what is going to happen. You can find the replay bar at the top of the screen:
The replay button is activated automatically so you only have to scroll back in time and click in the chart. If you want to use this function manually, just click the bars (see arrow) in the replay bar menu.
Day trading is mostly done on a schedule. For example, you want to trade every Tuesday, Wednesday and Saturday (do note most regular exchanges are closed on the weekend). If you are only trading these days, then only look for these days when looking in the history. It makes no sense to look at the chart of every single day while you only have two or three trading days. So you have to determine which days you want to trade. Once you have determined which days you want to trade you have to determine your trading rules. For example:
- 30 min or 60 min analysis starting at 08:00;
- Trading specific pairs or indices (like US30 or EUR/USD);
- Stop trading at 14:00;
- One profitable trade a day or one stop loss hit a day.
Then look at the time frame on the chart and start your analysis at 08:00 in the session you want to trade. From there on you can start setting up your analysis. Beginning with drawing support and resistance lines, adding trendlines, looking for market structure and moving averages all on the one hour chart. Depending on your strategy, you can zoom in to the 15 min, 5 min or 1min chart and start adding your indicators like RSI, VWAP and engulfing candles.
Once you have drawn all lines and added all indicators you need then you can start analysing using the trading rules that come with the strategy. Meaning you are going to place long, shorts and stop losses based on the strategy you are using.
You can place long, short and stop losses with a single button in tradingview:
Click the button in the left menu and choose long or short. Then click in the chart to place the position. You can drag your position if you want to change it. Once you have everything in place you can click the “play” button on the replay bar. The candles begin to form. Then you simply watch if your trade was profitable or not. It’s critically important that you log each and every trade you make in your trading journal. I will talk about a trading journal in the next chapter. Keep in mind that not everyday is a trading day. There will be days that you don’t see an opportunity according to your trading rules. Don’t enter a trade because you want to trade. Only enter a trade when your trading rules are met.
7.3 Paper trading
Paper trading is a good way to get familiar with trading. Paper trading is a simulated way of trading so that the trader can safely test strategies without any risk. Tradingview does provide the option to paper trade. At the bottom of the screen click “Trading panel”:
If you haven't used this before you need to click “paper trading by tradingview” and click “connect”. The “Trading panel” in the above menu will transform into “paper trading”:
In the menu on the right a order panel will be added:
Here you can place orders as if it was on a real broker. Do note that there is no leverage available.
The standard amount of money in your account will be $100.000. Most likely you don’t have $100.000 of real money lying around you want to spend on day trading. We need to adjust this amount to the amount you are willing to use when you start trading with real money. If you have $1000 then change the balance to $1000. Remember, only use money you can afford to lose. How to change the balance:
Just fill in the balance and hit reset. Now you can paper trade. Do note that you can change settings depending on how you want to trade.
7.4 Forward testing
Once you are done with backtesting, you can start forward testing. Meaning you apply the strategy on the current charts. Go live on the charts with your demo account and start making trades in real time. Spend at least one month forward testing before you use real money.
After one month of forward testing and looking at the results you can use real money. Don’t put all your savings in just yet. Start with $100 or $1000. You’ll notice that trading with real money is very different compared to virtual money. Rely on your trading plan. You have tested your strategy thoroughly so you already know the results. Don’t get stuck in emotional traps because you lose some trades. You already know you will lose trades. Trading is not about avoiding losing trades but managing them.
7.5 Backtesting and forwardtesting is not live testing!
Keep in mind that back and forward testing are not the real thing. Trading with real money is quite different. You have to take commission and spreads into account and live trading accounts behave differently than demo accounts.
What is spread?
Reward: +10 XP 0 0 0
You might notice a difference between your demo and live account. For example, trades close instantly when using a demo account but on a live account it can take a while. This is crucial for your tradingstrategy because a small delay means you are paying other prices than you anticipated. The best way to test this is by simply creating multiple live accounts on different brokers and test their functionality with small trades.