Spécifications
Now that we have finished creating the basic skeleton, we can finally automate the EA to make it operate 100% automatically while following the operational rules that we have defined. The purpose of the article is not to build an operational model, but to show and prepare you to use the system proposed here, by turning a manual Expert Advisor into an automated one.
I think the big problem of the most traders who want to use a 100% automated EA (not necessarily your case, dear reader) is that they know absolutely nothing about programming, or even worse, they know nothing about the financial market and do not want to explore this area.
Many people just want to run a computer program that will magically generate money, without actually understanding what is going on behind the scenes. I see a lot of people talking good or bad about a particular platform, system or EA. But the vast majority do not have the slightest idea of the risk level they are putting themselves in, imagining that a simple computer program written in MQL5 to run on MetaTrader 5 or developed in any other programming language will become an ATM.
Many people have this "dream", or "illusion". They think that some programmer or even themselves can develop a method, program or algorithm that will magically generate money in their brokerage accounts. Many of them even need to learn the basics of the financial market, but they don't like anyone telling them that they are wrong.
Everything, absolutely everything that can be used, created or developed to somehow try to turn a program into a money factory in the financial market, has already been created, tested and developed. Some things have proven to be unsuitable, while others having good risk control, manage to generate some profit over some period.
So, if you are one of those who hope to find a magic system that can eventually make you rich, stop reading this article immediately because this information is not aimed at you. The same applies to anyone who expects to see a magic formula in this article: please, do not continue reading.
Here, I'll show you how to develop a trigger to automate the system that already use.
Let's figure out how to automate an Expert Advisor. Let's start by planning what we actually need to do.
Planning the automation
First, it doesn't matter what you are going to trade. It doesn't matter which indicators, chart timeframes or signals you are going to use. The automation process will always follow the same type of planning. The only difference is how the trigger will be built, but the planning will always be the same.
To plan how to automate the system, you must first have a trading model that has been in use for some time. This is paramount. Do not try to automate an unknown model. You need to have a habit of using that specific model.
So, this is the first requirement for automation: You must know how to use the model. Now you need to clearly define the rules for performing trades. This should be done in a clear and objective way. There should not be things like: If this is like this, when maybe this here is that other way, I hope this works out. This is wrong. The rule should be something like: If this happens, sell; if that happens - buy. The rule must be something objective. Remember, we are going to teach a robot that has no emotions or feelings. It feels no fear or remorse. So, be objective.
After determining clear rules, it's time to start creating the programming logic. Many get lost at this point , since by the time of programming they try to invent new rules trying to make the system better or more profitable. Again, this is wrong. The EA must do the same what your model does. Exactly the same.
As an example, let us look at how to create rules for the Larry Williams model, known as the 9-period Exponential Moving Average. There are many variants of the model, but this original one is quite simple. Please note that this is only an example, which I do not recommend using if you do not actually understand how it works. So, let's see the planning of the rules for this model.