forex software

Create and Test Forex Strategies

forex software

eas-guide:export-expert-advisor

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
eas-guide:export-expert-advisor [2020/12/09 14:13] – [Run Expert Advisor] ilaneas-guide:export-expert-advisor [2026/02/15 08:28] (current) – [How to export an Expert Advisor] Miroslav Popov
Line 3: Line 3:
 ===== How to export an 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.+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. 
 + 
 +{{ :eas-guide:eas-editor-export-expert-advisors.png?nolink |Export Expert Advisors}}
  
-{{ :eas-guide:export-expert-advisor.png?nolink |Export Expert Advisor}} 
  
 There are several Export options: There are several Export options:
Line 11: Line 12:
   * **Expert Advisor for MT4** - exports an Expert Advisor for MetaTrader 4;   * **Expert Advisor for MT4** - exports an Expert Advisor for MetaTrader 4;
   * **Expert Advisor for MT5** - exports an Expert Advisor for MetaTrader 5;   * **Expert Advisor for MT5** - exports an Expert Advisor for MetaTrader 5;
 +  * **Expert Advisor Plus for MT5** - exports an Advanced Expert Advisor for MT5 ([[expert-advisors-plus]]);
  
  
-The exported Expert Advisor is 100% native MQL code and doesn't require any third party libraries or indicators to run.+The exported Expert Advisor is 100% native MQL code and doesn't require any third-party libraries or indicators to run. 
 + 
 +{{youtube>XsObzXqOpzg?medium }} 
  
 ===== How to load an Expert Advisor in MetaTrader ===== ===== How to load an Expert Advisor in MetaTrader =====
Line 21: Line 26:
  
   - Go to **File > Open Data Folder**   - Go to **File > Open Data Folder**
-  - From the folder list open the **MQL4** folder+  - From the folder listopen the **MQL4** folder
   - Open the **Experts** folder   - Open the **Experts** folder
   - Paste the Expert Advisor file   - Paste the Expert Advisor file
-  - Go back to MetaTrater+  - Go back to MetaTrader
   - Go to **Navigator** (if it's not open, open if from **View > Navigator**)   - Go to **Navigator** (if it's not open, open if from **View > Navigator**)
   - In the **Navigator** box right-click. Click **Refresh** from the menu. Your expert should appear in the **Navigator** under **Expert Advisors**.   - In the **Navigator** box right-click. Click **Refresh** from the menu. Your expert should appear in the **Navigator** under **Expert Advisors**.
   - Open the chart you want to place your Expert Advisor on   - Open the chart you want to place your Expert Advisor on
-  - To attach the Expert Advisor to the chart drag-and-drop it from the **Navigator** box to the chartor simply double-click on the Expert Advisor+  - To attach the Expert Advisor to the chartdrag-and-drop it from the **Navigator** box to the chart or double-click on the Expert Advisor
  
 <WRAP center round tip 60%> <WRAP center round tip 60%>
 **Using different Magic Numbers** **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.+When trading several Experts on the same symbolthey 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. Howeverit 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.
 </WRAP> </WRAP>
  
Line 40: Line 45:
  
   - Go to **File > Open Data Folder**   - Go to **File > Open Data Folder**
-  - From the folder list open the **MQL5** folder+  - From the folder listopen the **MQL5** folder
   - Open the **Experts** folder   - Open the **Experts** folder
   - Paste the Expert Advisor file   - Paste the Expert Advisor file
-  - Go back to MetaTrater+  - Go back to MetaTrader
   - Go to **Navigator** (if it's not open, open if from **View > Navigator**)   - Go to **Navigator** (if it's not open, open if from **View > Navigator**)
   - In the **Navigator** box right-click. click **Refresh** from the menu. Your expert should appear in the **Navigator** under **Expert Advisors**.   - In the **Navigator** box right-click. click **Refresh** from the menu. Your expert should appear in the **Navigator** under **Expert Advisors**.
-  - In the **Navigator** right-click on the Expert Advisor name. From the menu choose **Modify** +  - In the **Navigator**right-click on the Expert Advisor name. From the menuchoose **Modify** 
-  - A code editor will open. From the top menu of the window click **Compile**+  - A code editor will open. From the top menu of the windowclick **Compile**
   - Close the code editor.   - Close the code editor.
-  - To attach the Expert Advisor to the chart drag-and-drop it from the **Navigator** box to the chart.+  - To attach the Expert Advisor to the chartdrag and drop it from the **Navigator** box to the chart.
  
  
Line 57: Line 62:
  
 <WRAP center round important 60%> <WRAP center round important 60%>
-The solution to this would be 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.+The solution would be an MT5 Hedging account, which can trade several experts per symbol. If using this featureset a different Magic Number for each Expert Advisor.
 </WRAP> </WRAP>
  
Line 64: Line 69:
 ==== How to Run an 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.+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. 
 + 
 +{{:eas-guide:export-expert-advisor-input.png?nolink|}} 
 + 
 + 
 +=== Options === 
 + 
 +  * **Magic Number** - a number MetaTrader uses to distinguish which position each expert belongs to. 
 + 
 +  * **Max spread protection (points)** - possibility to prevent trading on a high spread. The default value is zero, which means the protection is off. Set the desired value in points to engage the protection. For example, if you set 10, the Expert will open new positions only if the current spread is equal to or lower than 10. The Expert may try several times to execute the order. The Max spread protection does not affect the exit orders. 
 + 
 +  * **Min equity protection (currency)** - a protection which closes the current position and removes the Expert from the MetaTrader chart if the current Equity drops below the given number. The default value is zero, which indicates that the protection is off. Set the desired number in currency to engage the protection.  
 + 
 +==== Backtest an Expert Advisor in the MetaTrader tester ====
  
-{{ :eas-guide:export-expert-advisor-input.png?nolink |Expert Advisor Input}} 
  
 You can test the Experts in the MetaTrader **Strategy tester** (**View > Strategy Tester**). You can test the Experts in the MetaTrader **Strategy tester** (**View > Strategy Tester**).
  
-{{ :eas-guide:export-metatrader-tester.png?nolink |Expert Advisor test in MetaTrader}}+{{:eas-guide:export-metatrader-tester.png?nolink|}}
  
 <WRAP center round tip 60%> <WRAP center round tip 60%>
-You should get the same result in MetaTrader test as in EA Studio. If there is a discrepancy check if you are using **the same data, spreads and commissions**. If the discrepancy still exists, please open a topic in the support forum.+You should get the same result in the MetaTrader test as in EA Studio. If there is a discrepancycheck if you are using **the same data, spreads and commissions**. If there is still a discrepancy, please open a topic in the support forum.
 </WRAP> </WRAP>
  
- 
-~~DISQUS~~