You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: MQL5 Expert Advisor Builder (Part 1): A Simple Static Template.
After writing a significant amount of code in MQL5, you come to realize that many algorithms, approaches, and local solutions are very similar, if not identical. So why keep writing the same thing over and over in different ways when it can all be standardized into a common framework, saving time on writing new trading strategies? The question is, in fact, rhetorical—but not for everyone.
By asking ourselves this question and generalizing the core algorithms we use in our solutions, we can arrive at a template-based approach and save as much time as possible when writing Expert Advisors (EAs). This can be achieved by creating a set of templates that can be applied to a fairly wide range of solutions. By combining these templates, you can not only speed up and standardize your solutions but also develop the habit of creating more and more similar templates, thereby covering a wider range of solutions.
I arrived at this paradigm after repeatedly performing the same actions across different Expert Advisors (EAs): loading historical data, checking for a new bar, opening and closing positions, and accounting for commission and swap. Obviously, it makes sense to set this up as a template once and then simply plug in different entry and exit logic. A simple static template is like an exoskeleton for your trading signal: you decide "when to enter" and "when to exit," and the template takes care of everything else. Of course, such templates aren't a cure-all for every problem, but they can still solve a significant portion of the typical challenges faced by beginner and intermediate traders. This same approach serves as the foundation for more complex templates—multi-timeframe, diversified, and others that emerge as the concept evolves; these will be discussed in the following articles in this series. First, a solid foundation.
Author: Evgeniy Ilin