The world of traders is divided into two groups; those who trade using algorithms and those who don’t. Those who trade using algorithms, aka algotraders, are well aware of the advantages of trading with an algo… And for those who don’t use algos? They are equally aware of the algo advantages but are reluctant to dive into its complexity; they are deterred from learning how. But the road to success in trading is not by avoiding challenges, but overcoming them, perhaps in baby steps.
First Baby Step to becoming an Algo trader
Let me ask you a question. What do you think is the first thing you’d need to do to become an algotrader? You might respond, “Learn programming, por supuesto! How else?” Well, you’d be wrong.
If you plan to learn programming for the sole purpose of becoming an algotrader, you’re likely to get lost. Eventualmente, in despair or frustration, you’ll give up on algotrading.
There are numerous languages, from MQL to R to Python, and you have to decide which one to start with. You might find yourself wasting valuable time learning far too many trivial functions. It may take quite a long time before you even create a trading algo, let alone a profitable one.
But there’s another way, which I call reverse engineering.
The first step is to figure out which trading algo you want to make. En otras palabras, what are the functions and strategy it should implement? Then you test it and finally, move on to the programming part. Por aquí, you’re focused like a spotlight. You know exactly what your algo should do and can focus on the exact functionalities you need to learn to make it happen.
Everything will just come intuitively; which language, how and in what. All the pieces will fall much quicker into place because you already know what to look for.
The best way to start is by using a flowchart. It is actually one of the first things you learn in programming schools.
And what determines the flow? Por supuesto, it’s the conditions. What we call the “ifs.” “Ifs” can be one condition or have many “ands” and “ors.” That’s how you decide what your algo should do in any given circumstances. The conditions to the algo are what the brain is to the body; they do the thinking.
Second Baby Step: Use Excel
Once you’ve made a flowchart of conditions, rather than using a complex tool, use Microsoft Excel or some other spreadsheet software.
Extract historical data of a price data; start by using only the closing price. If you want to trade on a daily interval, extract daily data and so on. Use a separate column for each of the conditions in the flowchart, that way it’s easy to write and figure out. Add another column for a buy and sell output to mark when you “opened” and when you “closed” a position. And finally add one column of accumulated profit/ loss.
Use separate columns for each conditions and fill the chart. All you need now is to run a linear chart on one column, accumulated profit/loss, and look at the algo’s historical performance.
Once you master the basics you can move on to move advanced back-testing and curve fitting. But for a start that will do.
Finalmente, Learn to Program
Okay, you’re not a “baby” anymore; you have a good idea of what an algo trader needs to do. Now that you’ve got the concept down pat, you’re ready to begin learning programming.
In terms of which language to start with, that will depend on the circumstances. If you are already using an MT4 platform, it’s a no brainer; learn MQL which runs on MT4. The MQL website is filled with “how to” materials. And since you already have a diagram of your algo and an idea what you want to do, finding your way should be simple.
But if you trade with a different broker, you’ll have to decide which best suits. Personalmente, I recommend starting with MQL, just because it’s easier. Entonces, you can move into Python, which is a rather easy language to learn or C++ if your algo needs to work fast. If you algo is heavy on the math then perhaps R would fit.
Here are some places you can learn online:
O, por supuesto, you can learn from a book. I am more of a book person, but that’s just me.
Then there is another issue—API. API is the mechanism that enables your algo to communicate with your broker and execute your trades. Some brokers work better with certain programming languages than others. Most large brokers have communities and forums that can go into detail as to the best way to use an API.
Unlike the first two baby steps, no one would ever say that learning to program was a baby step. Más bien, it’s more of a giant leap. It takes time to learn and to master, though it is worth it in the long run. Mientras tanto, you can always use libraries of codes on the web for more complex algos. The thing is that once you’ve accomplished the first two baby steps, making the final leap into programming is a no brainer.