After opening a strategy in the Editor, you can export it as an Expert Advisor for MetaTrader 5 and MetaTrader 4 by clicking on the Export Advisor button in the toolbar.
One-click and you have the Expert Advisors ready. No programming is needed, no experience in coding.
Depending on the platform you are going to use it for, you have the following export options:
The Expert Advisor is fully written in native MQL code, so it can be used without third-party libraries or indicators.
How to add an Expert Advisor in MetaTrader 5 and MetaTrader 4
|MetaTrader 4:||MetaTrader 5:|
|1. Go to: File/Open Data Folder/MQL4/Experts||1. Go to: File/Open Data Folder/MQL5/Experts|
|2. Paste the Expert Advisor file.||2. Paste the file of your Expert Advisor there|
|3. Return to MetaTrader||3. Return to MetaTrader|
|4. Go to the Navigator section (in case it’s not open, please go to View/Navigator).||4. Go to the Navigator section (if you don’t see it, open it from View/Navigator)|
|5. Right-click on the Navigator, then hit Refresh from the right-mouse menu. The expert advisor will show up in the Navigator Expert Advisors folder.||5. Right-click on the Navigator, then choose Refresh from the menu. The expert advisor will then be in the Expert Advisors folder.|
|6. Open the chart where you plan to add the Expert Advisor.||6. Then right-click on the name of the Expert Advisor and choose Modify.|
|7. Drag and drop the Expert Advisor from the Navigator box to the chart and it will be attached.||7. You’ll see a code editor opening. Click Compile in the top menu of the window.|
|8. Then close the code editor.|
|9. Drag-and-drop the Expert Advisor from the Navigator box to the chart in order to attach it there.|
Using different Magic Numbers for the Expert Advisors
The magic numbers are unique numbers for each Expert Advisor in MetaTrader. They are incredibly helpful especially if you’re using several experts on the same symbol because you need to differentiate their positions.
The exported Expert Advisors from EA studio have been pre-set with random Magic Numbers ensuring you’ll distinguish the positions during the trading process.
Despite this when you’re trading with multiple Experts on the same symbol, we advise you to check and make sure their Magic Numbers are different.
If it happens to find Experts with the same magic numbers, you can change the numbers from the code of the Expert or the Inputs parameters.
MetaTrader 5 does not allow you to trade with several Experts on the same symbol at the same time.
The solution to this would be to use a MetaTrader 5 Hedging account. In this case, you will need to set different Magic Numbers for each Expert Advisor.
How to Run an Expert Advisor
After you drag and drop an Expert to a chart, a dialog window will open. If you want to go over the different settings of the Expert Advisor, simply go to the Inputs tab.
You can apply any changes you may wish and then test the Expert Advisors in the MetaTrader Strategy tester (please find it in View/Strategy Tester).
The results of the tests in MetaTrader and EA Studio should correspond with each other. If there is a conflict in the results, make sure that you are applying the same data, spreads, and commissions. If the issue still persists, we recommend you open a topic in the Forum and we will be happy to help you.