6 steps to backtesting algorithmic stock and Forex trading strategies


A full guide to automated trading

In this article, I decided to go over every piece of useful information that can play a vital role in trading efficiency. Everything is based on true personal experience and pain.

As I have mentioned in my previous article “Backtesting algorithmic stock trading strategies” we are mainly going to be focusing on Wealth Lab. I will try and outline the way information can be structured step by step in order for it to eventually compile into a full framework of quality algorithm trading and backtesting knowledge and experience.

To Begin With

So firstly you are in this ocean of information. If you have never traded before, you are like a little fish swimming amongst tons of books, courses, videos, training resources and it’s really difficult to structure everything and weed out the poor quality stuff that is worthless because you simply don’t have a method of how to do it yet.

It’s probably a little different for everyone at this stage but someday, sooner or later in my opinion, absolutely everyone comes to an idea of quality backtesting of their trading strategies and if they do, the market does offer a variety of choices but today I will be mostly talking and discussing only one – Wealth Lab. If you would like to read about the functionality please refer to the previous article which really does open up the curtain on most of the cool functions.

The first attempts

Now this is the struggle part. No matter what software you choose you get in touch with a whole new world of technical issues concerning how to get it to work the way you want it to.

For Wealth Lab I have created a method of how to walk through the many steps that are available in order to get the most out of it. So…

Step 1

This is really important because here is where the real desires meet the willingness to sit down and do it. I would brake this into two sections.

The overview of the program. That is where you get the taste of the functionality, you install it, play around with the buttons, feel the opportunities it brings and either get excited about it and go to the next step or just figure out it is too much already.

Next you get the step by step instructions on how to deal with the most common and easy functions and program your first trading system, backtest it, play around with what is going on in the program and here, two things might happen. One is you feel fine with coding and the more you dive into it the more you want to find out about how to code your own ideas and two, you are frustrated and you feel that this is really not what going into trading was all about for you, emotions and casino style trading “YES”, fair research style “NO”

Step 2

So hopefully you become fulfilled with many ideas on what you want to code but the lack of practice on strategy writing in C# or any other language compatible with the software you choose holds you back. To sort this out you have to step by step introduce yourself to ready templates (that I will be soon publishing) or you have to code these methods out, test them and make sure they behave correctly. Such templates may include:

Different style of market entries such as:

  • Pivot patterns
  • Indicator crossovers
  • Divergences
  • Candlestick patterns
  • Multiple logic and rules
  • Scalping
  • Swing Trading
  • Different ways of price channeling and scaling
  • Multi symbol screener logic
  • Multi timeframe logic
  • News and statistics fundamental algorithm

Different style of market exits such as:

  • Stop and profit
  • Time exits
  • Various adaptive and trailing stops
  • Reverse exits
  • Multi symbol exits
  • Intra bar exits
  • Indicator exits

Step 3

So once you get to know how to deliver your ideas to the computer monster and it replays what you want inside the backtesting software, two more dilemmas come up.

How to choose the correct symbol or market?

From my personal point of view, all systems can a) be broken down into two main types trend or flat b) can be broken down into further entry and exit types and c) one system will only work on a particular market or symbol, particular timeframe with certain parameters and on a particular date range. Some systems do work on quite a few and even many symbols with the same or similar parameters but there is never going to be a system that will work everywhere.

So that brings out a question how do we find the best market or symbol to trade the system without spending a lot of effort and time to code the exact architecture of a particular idea that we have. Is there a quick method we can use, in order to check a particular symbol or market in a period of time and classify it into types in order to map out what kind of systems will work there. Yes there is, but this article is not about it.

How to rank trading systems?

Once we get a list of systems that work for a market we choose we go into the optimization world. We run through different system parameters and rules in order to realize the best ones that in our opinion, might work for the future because they have been stable in the past.

After that we need a technique that a) will bring all the systems in one data base and b) can let us rank systems under one or few ranking parameters because if we try and compare everything that is out there in the system performance review, we will never get to real trading because if we continue backtesting again and again we will eventually find a weak place inside the system and a fair enough reason not to trade it.

Step 4

Now when we are able to compare systems one to another and see which ones work better than others on different markets, we are going to want to try make systems work better. How? Money management – a huge topic on how to this can be achieved in order to logarithmically boost our capital.

Step 5

Finally live trading and account money management. With Wealth Lab and Fidelity brokers no problem. You can trade everything they have if you have a US social security number. With Forex there are two ways – either use a Wealth Lab connector based on .NET or reprogram your C# code into MQL code for Metatrader.

If you are not fully into algorithmic trading, the live trading step can be avoided and Wealth Lab can be used as an alert software that sends you messages from the strategies you have coded so you can decide what you want to do at the point when you receive an entry or exit market alert.

Step 6

Once you are in live trade you have to be able to monitor your systems and compare the results you get to the results you were expecting to get based on the research you have made and once the live results undercome or overcome the expectations, you have to make sure you do something with the system – add a new one, change parameters, rules, timeframe or symbol.


So this was the main outline of the strategy algorithm trading and backtesting way. Seems like a long way but it can be structured and you can be very impressed by the results you get money wise and lifestyle wise at the end of the way.

Time wise, if we are talking about completion from zero level this can take one year with part time engagement. This is what it took me to go from manual trading to a number of automated accounts on different markets trading tens of strategies at the same time. It is really worth it and I personally think it is amazing, a real time saver and a real opportunity booster so that is why I decided to start posting my experience publicly. Thanks for reading and have a good trading day!
AdBlock Detected

We get it, advertisements are annoying!

But it's thanks to our sponsors that access to Trade2Win remains free for all. By viewing our ads you help us pay our bills, so please support the site and disable your AdBlocker.

I've Disabled AdBlock    No Thanks