In this video we are going to find out how to create an Expert Advisor that is able to import other files.
In our case we are trading the MACD entry here, now let’s stop the test and start it again and this time it’s the Accelerator Indicator. This is the same main module and now we are going to find out how we can create an Expert Advisor that is able to trade and import different entry signals in MQL5.
To do that please click on the little button here or press F4 in your Metatrader and now you should see the Metaeditor window and here you want to click on “File/ New/ Expert Advisor (template)” from template, “Continue”, I will call this one: “SimpleModule” click on “Continue”, “Continue” and “Finish”.
Now we can delete everything above the “OnTick” function and we can remove the comment lines and before we start with the “OnTick” function we want to include an external file.
In our case it is an external file that can create a trading signal it’s called: “CheckEntry_IAC” and you will find everything here in another video and we use the include function to import the “CheckEntry_IAC” file that is located in the same directory than the simple module file (SimpleModule).
In the “OnTick” function we get a string signal from the external file so we create a string variable called “signal” and we call a function called: “CheckEntry” that is included in the “CheckEntry_IAC” file and it will return the signal.
Once we have the signal we want to create an output for the signal on the screen; that is done by using the “Comment” function that will output the word: “signal” followed by the calculated signal and basically that’s it for the simple module.
Now let’s click on compile; that worked without any errors and without any warnings, so now we can click on the little button here or press F4 to go back to Metatrader.
In Metatrader we click on “View/ Strategy Tester” or press CTRL + R, select the “SimpleModule.ex5” file and start a test. Oh, please make sure to enable the visualization option here and now we see that we get buy or sell signals and this is the Accelerator Oscillator, now stop that test, this is the check entry function for the “CheckEntry_MACD” file, that’s also another video but let’s actually exchange the entry module here. Now we include the “CheckEntry_MACD.mq5” file, compile the same simple module, close the last test, start a new one and here is the MACD entry.
Actually it’s that simple to create a simple modular system that can show you the entry signals of different indicators and you have created it yourself with a few lines of MQL5 code.

Download “MQL5 TUTORIAL - SIMPLE MODULAR EXPERT ADVISOR” SimpleModule.txt – Downloaded 62 times – 245 B