forex software

Create and Test Forex Strategies

forex software

eas-guide:export-expert-advisor

Export Expert Advisor

How to export an Expert Advisor

When you open a strategy in the Editor you can export it as an Expert Advisor. To do this, click on the Export button in the toolbar.

There are several Export options:

  • Expert Advisor for MT4 - exports an Expert Advisor for MetaTrader 4;
  • Expert Advisor for MT5 - exports an Expert Advisor for MetaTrader 5;

The exported Expert Advisor is 100% native MQL code and doesn't require any third party libraries or indicators to run.

How to load an Expert Advisor in MetaTrader

MetaTrader 4

  1. Go to File > Open Data Folder
  2. From the folder list open the MQL4 folder
  3. Open the Experts folder
  4. Paste the Expert Advisor file
  5. Go back to MetaTrater
  6. Go to Navigator (if it's not open, open if from View > Navigator)
  7. In the Navigator box right-click. Click Refresh from the menu. Your expert should appear in the Navigator under Expert Advisors.
  8. Open the chart you want to place your Expert Advisor on
  9. To attach the Expert Advisor to the chart drag-and-drop it from the Navigator box to the chart, or simply double-click on the Expert Advisor

Using different Magic Numbers

When you are trading several Experts on the same symbol they will need to differentiate between each others' positions. MetaTrader allows us to do that by using a unique Magic Number for each Expert. EA studio will export Expert Advisors with a random Magic Number built-in in the Expert so it will differentiate its positions from other Experts when trading. However it is up to you to make sure each Expert that you trade on the same symbol has a different Magic Number. Should you have duplicate Magic Numbers, you can change the Magic Number in the Expert's code or from the Inputs options of the Expert.

MetaTrader 5

  1. Go to File > Open Data Folder
  2. From the folder list open the MQL5 folder
  3. Open the Experts folder
  4. Paste the Expert Advisor file
  5. Go back to MetaTrater
  6. Go to Navigator (if it's not open, open if from View > Navigator)
  7. In the Navigator box right-click. click Refresh from the menu. Your expert should appear in the Navigator under Expert Advisors.
  8. In the Navigator right-click on the Expert Advisor name. From the menu choose Modify
  9. A code editor will open. From the top menu of the window click Compile
  10. Close the code editor.
  11. To attach the Expert Advisor to the chart drag-and-drop it from the Navigator box to the chart.

You cannot trade multiple Experts simultaneously on the same symbol in MT5.

The solution to this would be a MT5 Hedging account, which can trade several experts per symbol. If you are using this feature set a different Magic Number for each Expert Advisor.

How to Run an Expert Advisor

When you drag and drop the Expert onto the chart a dialogue window will open. You you can review the Expert Advisor options in the Inputs tab.

You can test the Experts in the MetaTrader Strategy tester (View > Strategy Tester).

You should get the same result in MetaTrader test as in EA Studio. If there is a a discrepancy check if you are using the same data, spreads and commissions. If there is still a discrepancy, please open a topic in the support forum.