Asirikuy’s First MT4 Genetic Programming Implementation : Get Ready For Coatl :o)

Through the past few months I have written a series of posts called “Can a Computer Design a Trading Strategy ?” where I have discussed several aspects of the use of genetic programming in trading, examples of its use and precautions that need to be taken into account to arrive at reliable solutions. After a lot of work in the development of a native MQL4 genetic framework today I have the pleasure to share with you a sneak-preview of the first Asirikuy genetic programming framework (called Coatl). Through the following few paragraphs I will share with you what the framework is about, what it can and cannot do and what advantages and disadvantages it has because of its native MQL4 nature. The framework discussed herein will be released this weekend to all Asirikuy Community members :o).

When I first thought about the use of genetic programming I certainly had two choices to carry out this endeavor. I could build a tester/framework from zero in a language like C++ or I could use the capabilities of the MT4 strategy tester to achieve this. There are certainly  disadvantages to using the MT4 strategy tester, like the horrendously slow speed of simulations and the lack of freedom in the choice of the genetic optimization algorithm and parameters (like population sizes) but I thought it would be nice to implement the genetic framework as an MT4 native solution as it would allow Asirikuy members an easier use of the framework and the ability to trade whatever output is obtained in a very straightforward manner. This doesn’t mean in anyway that we are not working on the C++ solution, a much more powerful framework which will allow us to do many additional things.

With the idea to implement an MT4 native genetic framework in mind I took the Asirikuy EA Framework and developed what would become Coatl. This name comes from the Nahuatl language – from the Aztecs and related tribes in Mexico – and means “snake”. I named the framework this way because I originally designed it to discover systems on the daily time frames and – as a tradition in Asirikuy – I name all daily systems as animals in Nahuatl.

What is Coatls all about? The framework is actually extremely simple in the way in which it works and discovers profitable systems. The program is implemented on MQL4 and contains many different entry and exit criteria for different indicators (about 15 criteria). These different criteria are linked to “logic parameters” which determine what the system will be trading. Through a genetic optimization in MT4 of these parameters we discover  profitable trading strategies.

However Coatl also implements three different strategies “per system” as it handles three separate trade threads each one with its own very simple entry and exit logic. The reason why I did this was because the daily time frame offers limited trading opportunities and often much more profitable results can result from the inclussion of different entry and exit techniques (to get for example short term reversals and long term trends). On trending pairs – like the EUR/USD – the program generates three quite similar strategies while in others like the USD/JPY the differences between the sets generated are very interesting.

Coatls also works in a very simple way and restricts freedom such that curve-fitted solutions are not attained (or are attained with a much less like hood). Indicator periods are NOT optimized and indicator thresholds (such as RSI symmetrical levels) are only optimized in 10% intervals — which are extremely coarse by any criterion. Additionally the framework has been designed to give reliable control point simulations, such that faster simulations can be carried out. In reality if the framework wasn’t “control points capable” it wouldn’t give any useful results as every run requires at least 11-20K ten year backtests. However a very interesting solution is used to allow the system to have some capping of market exposure (like an internal stop loss) in a compatible way with control points simulations.

The procedure to generate profitable systems with Coatl is therefore very simple, an optimization using EOD data is carried out using the genetic algorithm within MT4, something which generated a given logic solution that generates a certain profit level. Since the random population choice in the beginning of the optimization has a significant effect in the overall results several runs are usually made to discover the maximum potential Coatl can get out of a given currency pair.

Right now Coatl has succeeded in getting profitable results for any pair it has been tested against and even against 20 year EOD data on the GBP/USD and AUD/USD. Coatl also has several internal logic features which prevent it from “running into trouble” by having inconsistent internal logic, something which allows simulations to proceed in a much faster and efficient way.

This framework is quite powerful as it gives the user the ability to explore any currency pair for which daily data is available to find a suitable inefficiency to trade. The fact that Coatl was designed for the daily time frame also makes it much more reliable since its systems are robust and not subject to spread and execution problems. For this reason Coatl systems are also less bound to be broker dependent as fluctuations amongst brokers on daily data is minimal. The framework also has the ability to use traditional TP and SL mechanism so if the user wants to see their effect adequate “every tick” backtests can be performed on the framework’s top results to see how the introduction of these criteria affects them.

Long story short, Coatl is a powerful tool which allows users to find inefficiencies within any pair using only daily data (although other time frames such as the 4H and 1H can also be used), it has been designed to avoid curve fitting and it has not failed to produce profitable results on any pair (major or minor) up until now. The framework is also easily expandable and users will be able to add additional logic sets if they want to. Although this framework is certainly not as powerful as a C++ implementation is, it gives the user an easy-to-use genetic framework and ready-to-use systems with adequate logic and error handling with minimal effort.

Of course, it is very important here to remember that EVERY system provided by Coatl also needs to be adequately evaluated and stress-tested to see if it has vulnerabilities such as curve-fitting, spread-sensibility, etc. Out-of-sample tests and such other testing mechanism are therefore a VITAL STEP before trading any genetically generated systems. If you would like to learn more about system development and how you too can create your own strategies using genetics as well as manual system analysis and design please consider joining, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading in general . I hope you enjoyed this article ! :o)

Print Friendly, PDF & Email
You can leave a response, or trackback from your own site.

4 Responses to “Asirikuy’s First MT4 Genetic Programming Implementation : Get Ready For Coatl :o)”

  1. Bruno says:

    Hello Daniel, this looks so promising!

    Congratulations on your hard work, and I can’t wait to start exploring the possibilities of this new system

    May the strength of this EA match the one of the mighty Quetzacoatl! :)

    • admin says:

      Hello Bruno,

      Thank you for your comment and congratulations :o) The biggest satisfaction is to see how people appreciate and use the things I work on so I am definitely glad to be releasing Coatl this week end. Certainly it will be good to see if the EA matches the strength of its feathered counterpart :o) Thanks again for your comment !

      Best Regards,


  2. Winter says:

    Hi Daniel,

    Thanks for the effort and great vision. I am eager to test it out. All the best in your endeavor.


    • admin says:

      Hi Winter,

      Thank you for your comment :o) It is definitely a big compliment to hear you say I have “great vision”, as always I will continue to work on new implementations to keep our developments updated and our search for profitable trading solutions more and more innovative. I will be thrilled to hear about your experience with this framework after its release this weekend ! Thanks again for your comment,

      Best Regards,


Leave a Reply

WordPress › Error

The site is experiencing technical difficulties.