Andrea Ferrari

How to load Expert Advisors in Metatrader

Follow these 11 steps to quickly load Expert Advisors in MetaTrader.

Summary

  1. Copy the Expert Advisors files
  2. Open Metatrader
  3. Enable 'Automatic Trading'
  4. Open MetaEditor => Open 'Experts' folder => Paste here the Experts Advisor => Reset MT4 to compile it automatically or open them in Metaeditor and click 'compile open files'
  5. Add the Symbols you will trade from 'MT4 Symbol List' in 'Market Watch'. Now you will see the expert in 'Navigator' and you can drop them to their relative chart. Open 'Navigator' from menu-> go to 'Expert' folder -> and double click on the expert or drop the expert advisor to the chart
  6. BacktestMarket EA - quick process: Add to 'MQL4\Files' the folders 'drawdown' and 'Templates'. Check if the 'Common Options' that allow trading and other EA functions are correctly setted. Then run on EURUSD chart 'Open All Chart and Templates' and wait few minutes. The expert will configure all, then close this EURUSD chart
  7. Check if the 'Common Options' that allow trading and additional EA's features are correctly set
  8. Configure the Expert Advisors input parameters.
    BacktestMarket EA: set the contracts rollover (see step 11) just the first time if you are not trading with Activtrades broker
    The other input fields:
    • 'backtest_mode' is set by default to false to allow live trading and performance monitoring (to backtest the Experts, please set backtest_mode=true, to trade live set backtest_mode=0)
    • 'Risk per operation' is max 1.5% of equity. Some Experts like Gold Accumulators has 0.5%
  9. How to know if the EA is working: the smiling face of EA in the top right means that trading is activated
  10. During trading activity check that everything is working in Metatrader Terminal => ‘Experts’, especially if you're not going to use a Virtual Private Server
  11. Additional function: the automatic rollover of the contract if you're not trading continuous futures contracts.

1. 2. 3. Set Metatrader for Algorithmic Trading

  1. Copy the Expert Advisors files
  2. Open Metatrader
  3. Enable 'Automatic Trading'

The enabled icon is the green one. If you don't see the icon in your MT4 menu, add it by right clicking on menu => select ‘AutoTrading' and click 'Insert'.

Enable automatic trading in metatrader

4. Open MetaEditor to open Expert folder (it’s the yellow icon similar to a block notes)

MetatraEditor in Metatrader

Then open the Navigator of Metaeditor –> right clic on ‘Expert’ folder –> ‘Open Folder’ => and paste inside the Experts.
Then I suggest you to create a shortcut of Mt4 ‘Expert’ folder on your desktop to open it easier the next time.

Expert Advisors Folders in Metatrader

Opened Experts’s folder on Metaeditor

Expert Advisors Folders in Metatrader

Reset MT4 (fastly) now close and re-openMetatrader to compile all Expert Advisors automatically otherwise they would not appear in Metatrader's Navigator. Or open them on Metaeditor and 'compile all open files'.

Now if you have our experts, activate the drawdown and performance recording system. Open 'Files' folder (it is the folder below 'Expert') and paste here the folder containing the .txt files where the experts will register each operation from a starting capital.

Expert Advisors DrawDown in Metatrader

Then when each one will open the next trade he will check if his performance is above the drawdown setted in input parameters. If it is over he will trade just virtually, not with real or demo money. When and only if he will come back under its max_drawdown he will start trading again using account's money.

Paste here even the 'Templates' folder.

5. Add the symbols you're going to trade from 'MT4 Symbol List' to 'Market Watch'

In Symbol list's window, search the symbols in your broker's folders --> double clic above the symbol you want to add.
'Symbols' icon:

Pick Symbols in Metatrader

Add a symbol to ‘Market Watch’

Pick Symbols in Metatrader

6. Open Symbol's charts where you want run the expert

From ‘Navigator’ find in ‘Experts’ folder the .ex4 files => double click or drop the expert to charts.
Open a chart from Market Watch:

Pick Symbols in Metatrader

Drop it to the chart:

Charts in Metatrader

7. Check EA ‘Common Options’ parameters

Select these settings to allow automatic trading and eventual features of experts:

  • 'Long & Short' positions,
  • Check 'Allow Live Trading',
  • 'Enable Alerts,
  • 'Allow DLL imports' and
  • 'Allow import of external experts'.

Expert advisor - common parameters

EA common options for Metatrader

8. Set the input parameter

  • If you are going to backtest the strategy with our Expert Advisors, set the value of backtest_mode = 1.
    To backtest High Potential Days expert advisors, please import the data in GMT+1 timezone, so set shift -7 when you're importing GMT-6 data (US futures, forex, commodities, not european indices that are GMT+1). In live trading HPD experts will open the trades at right time of the day automatically
  • If you are going to trade live, set backtest_mode = 0. In this mode the experts will record performances so it is necessary to import the 'drawdown' folder, otherwise the expert will return 'zero divide' error.

In both of the mode it's possible to increase or decrease the risk for each operation (percentual of loss in account equity if the stop loss would be hit) by modifying ‘risk’ parameter. If you modify the 'risk', modify also and proportionally ‘max drawdown’ parameter.
Example of expert advisor input parameters:

expert advisor input parameters

9. The smiling face means that the Expert Advisor is active

smiling face expert advisor

10. Check your trading workstation

During trading activity check that everything is working fine in Metatrader ‘Experts section', especially if you're not going to use a virtual private server. There could be problems due to internet connection, PC updates etc.

Just check once a day from 'Terminal' menu --> 'Experts' that everything is fine: the experts are running, that your computer (or better, vps) is on, that the internet connection is ok etc. An error is a red circle icon, the yellow triangle is a notification (not a problem).

Terminal-->Experts

EA Terminal Expert for Metatrader

11. Final automations: automatic rollover function of cfd/futures contracts

We implemented the automatic rollover function and it is very convenient if you trade in a broker that has not continuous cfd. It would be very boring to update manually the new contracts when they expire. The robots will do automatically the rollover when a new contract will be quoted. If you don’t want to use this function leave the default inputs, the function will not cause errors even if it is not setted well.

For example Dax futures contract expire around the 20th day of March, June, September and December. Few days ago, for example on 15th day of these months, the expert reload automatically the chart with the new contract. And so on year over year.

EA Dax sample for Metatrader

Each CFD of a instrument, quoted in different broker, has always the same expiration months because every of these CFD are underlying of the same futures contract (example: Dax30Mar16, Ger30Mar16, DaxH16, GDaxH6 etc).

The problem is that every broker call its CFD almost always with a different name from another brokers.
So in input parameter insert in the ‘cfd’ string field, the name your broker give to its CFD (Dax, Ger30, Dax, GDax). The default name of our experts are the ActivTrades’s CFD names.

Example:
CFD= "Dax30";
Month= "Mar";
Year_digits= 2;  (if year is 2017)
Dax30Mar17

These are the month letters of the futures contracts, that will help you to write the right rules:
Jan: F     Feb: G     Mar: H     Apr: J     May: K     Jun: M     Jul: N     Aug: Q     Sep: U     Oct: V     Nov: X      Dec: Z

To create the name of the Symbol the function use this string concatenation: "CFD"+"Month"+"Year_digits"

Andrea