With this Professional Advisor we’ll import exterior MQL4 supply code into our principal file, in order that it may be used again and again for automated buying and selling with Metatrader4.
On this video I want to present you one thing, it’s import exterior supply codes.
It is a technique check and once I click on on cease you will note that we now have an rsi sign right here that’s truly what’s calculated inside the technique check however you don’t see something as a result of I didn’t change the template thus far and its doable to alternate the module, the exterior supply code. Should you click on on the embody folder inside your Metatrader set up listing, you will note recordsdata which have the extension mqh.
There are heaps and plenty of recordsdata inside these folders and you’ll open them with Metaeditor or with any editor and that is what you see. That is all supply code, its readable for people, these are lots of and lots of of traces of supply code, they’re supplied by Metaquotes however we need to discover out import our personal supply codes, so please click on on the little button right here or press F4.
Now you must see the Metaeditor window and right here you need to click on on file, new, knowledgeable advisor from template, proceed, I’ll name this file easy supply code import, click on on proceed, proceed and end, now you possibly can delete all the things above the on tick perform and the 2 remark traces right here.
We begin by utilizing an embody assertion, I want to use a file that’s situated inside a folder that is known as import.
I’ve created this folder and the file I want to import is known as test entry underscore macd, that is an mq4 file so it’s a supply code file, so I don’t have to put in writing all of the supply code once more, I simply do it as soon as for every entry and I can import it again and again in all of my techniques.
Now we’ll create a string variable that is known as sign and it’ll name a perform that is known as test entry to get the sign for the macd, and eventually, we’ll use the remark assertion to output the phrase sign, adopted by the calculated sign and that’s all.
Now I can click on on the compile button, and it really works with none errors however bear in mind you would wish to have the identical supply code file right here in any other case the compilation course of is not going to work.
In my case, I can click on on the little button right here or press F4 to return to Metatrader.
Now I click on on view, technique tester or press ctrl and r, I choose the brand new file easy supply code import dot ex4, allow the visible mode right here and begin a check.
Right here is the knowledgeable advisor, it creates purchase and promote indicators and once I cease it you will note that it truly has calculated the macd indicator, so let’s alternate that and use rsi within the supply code, I re-compile the code, restart the check and once I cease it this time you will note that is the rsi indicator.
Really, I’ve created these import recordsdata for a number of knowledgeable advisors and indicators and after getting created one among these recordsdata right here you should use them again and again.
Let’s copy this one, that’s for the bollinger bands, I’ll paste the file inside the import folder that I’ve created, let’s shut this one, alternate the entry, click on on compile and once I begin a brand new check and cease it you will note the bollinger bands are calculated.
It is a very simple strategy to code one thing as soon as and re-use it repeatedly, and on this little video you’ve gotten discovered embody exterior supply code recordsdata and you’ve got coded it your self with just a few traces of mql4 code.