What is a Backtest?

Kirill Eremenko
A free video tutorial from Kirill Eremenko
Data Scientist
4.5 instructor rating • 119 courses • 1,581,847 students

Lecture description

What is Backtesting?

Investopedia defines backtesting as “The process of testing a trading strategy on prior time periods. Instead of applying a strategy for the time period forward, which could take years, a trader can do a simulation of his or her trading strategy on relevant past data in order to gauge the its effectiveness”

In today’s tutorial we will expand on this definition. We will explore the different types of backtesting and I will show you why backtests are so valuable, how they can save you time and make your add certainty to your Forex algo-trading.

Video Tutorial

Let me know if you have any questions using the comments section below. I am always happy to assist you with questions.

Learn more from the full course

Forex Robots: Automate Your Trading - Forex Robot Included!

Forex Robots - Learn the secrets to trading on a real Forex Account with Forex Trading Systems. Metatrader 4 EA

05:17:46 of on-demand video • Updated September 2020

  • Use the Strategy Tester in MetaTrader 4
  • Import Historical Data into MetaTrader 4
  • Perform Backtests of Forex Robots
  • Perform Forward Tests of Forex Robots
  • Optimize Forex Robots
  • Run Demo Tests on multiple MT4 terminals simultaneously
  • Run meaningful Real Tests of Algorithmic Trading Systems
  • Apply a tried & tested Stability Criteria to FX Robots
  • Set limitations for MT4 Optimizations
  • Take advantage of the Genetic Algorithm and 2D-surface in MT4
  • Schedule Ongoing (Rolling) Optimizations for their Systems
  • Export Optimization Results into Excel
  • Calculate and Apply the Recovery Factor of FX Systems
English Hello this is Kirill from forexboat dot com. And welcome to the third tutorial and of course on testing and optimization meditator for the produce tutorial we learn how to navigate the strategy tester window. And today we're going to be talking about backtesting. So what is a back test and what is the process of backtesting it was the PTA defines backtesting as the process of testing and trading strategy and prior time periods instead of applying a strategy for the time period forward which could take years. A trader can do a simulation of his or her training strategy on relevant past data in order to gauge its effectiveness. So what does that mean reality. Let's draw a timeline and let's put a cross on the timeline to a present today. And you think to the left of the of the cross is the past and the dashed line to the right is the future for us to evaluate the effectiveness of a trading strategy we would have to launch it today and then wait a sufficient number of time for the strategy to accumulate a certain number of trades that would allow us to say whether the strategy is effective or not depending on the strategy it could take from several weeks to several months or possibly even a year. Therefore we can use backtesting to significantly limit the amount of time that we require to evaluate effectiveness of our strategy. Backtesting involves selecting two points in the past. Point A and Point B and then using the data between these two points to run a simulated test of our trading strategy and based on that test we can evaluate whether our trading strategy would have been effective if it were launched in the past. And based on that evaluation we can decide for ourselves whether we want to launch it today or not. And that way we really can speed up the process of evaluation of training strategies and save ourselves a lot of time. There are a few special cases of back tests for example you could select only one point in the past and then run the back test all the way up to today or you could select the point in the past as the very first point from which you have data. And that way you'll have a full back test which includes the whole of the data set that's available to you. And choosing these points the starting point and the ending point really depends on the trading strategy . For example for training strategies working on high timeframes you might want to use several months or years of data and for training strategies working on lower timeframes such as the five minutes or 15 minutes timeframe maybe a month or even several weeks of data would be sufficient for a back test . So let's go to Medtner for now and just run our very first back test here. You can select any of the two expert advisors available to select any chart any period. I recommend selecting control points at this stage just to speed things up. You can choose the dates here these are the two points in time. I'm not going to choose any dates and that way the test will run on the full data set that's available to me will click visual mode so we can see how this is progressing and then we'll just click start over here as you continue chart has appeared and a simulation has begun. So a trader for takes on that responsibility of running the simulation for you. And this as you can see the date here is 30th April 2014. And today's It is already august 2014 but better trader 4 is behaving as if this is happening real time . And as you can see that allows you to control the speed here you can like set the speed to slow and therefore everything is happening much or you can set the speed too much faster and therefore you're condensing this time that actually happened within days so every bar here you see is actually a an hour . You go. We have our first trade that was opened and there was a buy order which which created a loss. So as I was saying every bar here is a hour but it's happening in a matter of less than a second. And that that's how you can actually save time and back. Now you can see what's what's happening and this might be a profitable by ordre here that's about be closed hopefully. There we go. There was a profitable buy order if you go to the graph. The graph shows you how your balance is changing with time. So this is actually turn out of time of every trade. So we started with $10000 and you can see here how your balance is going up and down. Journal shows you some journals on what the expert wise is doing. Results actually lists every single trade that's been opened it's closed open or closed and so on and you can see the profit that every trade is bringing you the reports on trading the report will be ready at the end and at the bottom here of the green lines is the volume so as soon as they are two at least two trades with different volumes this line will appear and we'll show you. So this was point one loss and the all the previous ones were point to lots and that is built into the trade strategy. So I'll just speed this up to the maximum. And as you can see it's finished the test finishes very quickly when you speed up to the maximum. And there you go. So that was your first back test obviously because this prepackaged expert adviser and it has been optimized . It created a loss on the account but that is something that we'll discuss in other tutorials and we'll look at profitable expert advisors through this course going forward. So that that's that hopefully you enjoyed this tutorial and possibly learn something new. I would like to invite you to visit my website at WW dot for example dot com where you can find this and many more other free tutorials and I look forward to seeing you next time. Until then happy trading