Discussion of article "Building an Expert Advisor using separate modules"

 

New article Building an Expert Advisor using separate modules has been published:

When developing indicators, Expert Advisors and scripts, developers often need to create various pieces of code, which are not directly related to the trading strategy. In this article, we consider a way to create Expert Advisors using earlier created blocks, such as trailing, filtering and scheduling code, among others. We will see the benefits of this programming approach.

Separate modules are easier to connect/disconnect, debug and modify. Logic in OnTick will become more accessible for maintenance and improvement if binds are implemented in one handler instead of being added in different places throughout the EA code:


This minor design change provides a clearer EA structure, which becomes intuitive. The new structure resembles the result of application of the "Observer" pattern, though the structure itself is different from the pattern. Let's see how we can further improve the design.

Author: Andrei Novichkov

 
Mr Novichkov,

Thank you for sharing your hard work with the community. I am teaching myself MQL and eventually want to code my own EA's, your work with modules and pattern design helps me tremendously
Thank you
Dan
 
dmc9966 :
Mr Novichkov,

Thank you for sharing your hard work with the community. I am teaching myself MQL and eventually want to code my own EA's, your work with modules and pattern design helps me tremendously
Thank you
Dan
Thanks. I am happy to help you )
 

I really liked this approach and finally some structure for an EA.

What all need to be changed to adapt it to MQL4? I'm using MQL_Easy library to develop common code for my EA on both platforms.

I'll appreciate your advice. Thanks.

 
Manuraj Dhanda:

I really liked this approach and finally some structure for an EA.

What all need to be changed to adapt it to MQL4? I'm using MQL_Easy library to develop common code for my EA on both platforms.

I'll appreciate your advice. Thanks.

To work with MQL4 you just need to try to compile the project in MT4 )))) There shouldn't be a lot of mistakes. The code is pretty simple