Table of Contents

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 it, click the Expert Advisor button in the toolbar, and a drop-down menu will give you options to export Expert Advisor for MetaTrader 4 and MetaTrader 5.

There are several Export options:

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 MetaTrader
  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 double-click on the Expert Advisor

Using different Magic Numbers

When trading several Experts on the same symbol, they must differentiate between each others' positions. MetaTrader allows us to use a unique Magic Number for each Expert. EA studio will export Expert Advisors with a random Magic Number built-in in the Expert to differentiate its positions from other Experts when trading. However, it is up to you to ensure each Expert 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 MetaTrader
  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 would be an MT5 Hedging account, which can trade several experts per symbol. If using this feature, set a different Magic Number for each Expert Advisor.

How to Run an Expert Advisor

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

Options

Backtest an Expert Advisor in the MetaTrader tester

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

You should get the same result in the MetaTrader test as in EA Studio. If there is 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.