Popular results

Advertisements
$ £ ¥
¥ £ $

How to Run Expert Advisor on Chart in MetaTrader 4

There is no point in creating or downloading an expert advisor (EA) if you don't know how to run it on a chart. As you already know, an expert advisor is a robot, a program that executes automated tasks when it is attached to a chart. It can trade, send notifications, create reports, record information, and many other things. Here you will learn how to run an expert advisor on a chart in MetaTrader 4.

You have probably already seen our guide on how to add indicators to a chart. Doing so with an expert advisor isn't much more difficult.

It is very important to remember that:

  • One chart can run only one expert advisor concurrently — in other words, you cannot attach multiple expert advisors to the same chart at the same time.
  • One expert advisor can run on multiple charts.
  • One MetaTrader terminal can run multiple expert advisors concurrently as long as they are running on different charts.

Adding an expert advisor to a chart is very simple. First you need to have the .ex4 file. If you created your own expert advisor, saved, and compiled the file, you can usually find it under the Experts folder in the Navigator panel of MetaTrader.

In our example, we will use the Demo-1 expert advisor, which simply prints the ask price of the currency pair to which it is attached. If you want to see the code, you can find it in our guide on MQL4 Code Flow in Expert Advisors, Indicators, and Scripts.

Finding Expert Advisor in MT4 Navigator
Find the Expert Advisor in the Folder

Same as with indicators, select the chart where you want to attach the EA — when we say attach we mean run. Then drag the EA and drop it on the chart (or simply double-click it) — the window will open with information about the expert advisor. Here, you will also be able to change input parameters (depending on the expert advisor) and configure some other settings.

Drag-and-Dropping Expert Advisor
Drag-and-Drop the EA to the Chart Where You Want to Run It

Alternatively, you can also right-click the expert advisor and select Attach to a chart. In this case, it will be attached to the selected chart:

MT4 Expert Advisor - Attach to a Chart
You Can Right-Click the EA to Run It

A very important setting, which is individual for each EA, is Allow live trading. If this checkbox is ticked, the EA will be enabled to submit, change, and close trading orders.

MT4 Expert Advisor - Enable Live Trading
You Can Allow the EA to Execute Trades or Not

When an expert advisor is running, you can notice if it is enabled to trade or not — a happy face means that the EA can trade; a sad face means that the EA cannot trade. A very important role in enabling or disabling the ability to trade is also played by the Enable/Disable AutoTrading button of MetaTrader. While the Allow live trading checkbox is a setting that is individual for each expert advisor, the AutoTrading button can disable automatic trading at the terminal level, meaning that no expert advisor will be able to trade, even if live trading is enabled individually. Keep this in mind as it can be a safety button when you have many EAs running and you need to halt all trading.

Enabling AutoTrading in MetaTrader 4
Trading Is Enabled
Disabling AutoTrading in MetaTrader 4
Trading Is Disabled

To conclude, I assume you want to know how to remove an expert advisor from a chart at some point. This is very easy: right-click anywhere on the chart, select Expert Advisors, and then Remove. Piece of cake! Or if you click Properties you can change the EA's settings.

Removing MT4 Expert Advisor from Chart
Remove an Expert Advisor

Now you know how to run an expert advisor. Now is probably a good time to start creating some if you haven't done so already.