AlgoScriptX
ASX Sessions for MT5 on EURUSD M15: Tokyo, London and New York session boxes with previous day high and low

MT5 Expert Advisor vs Indicator: The Practical Difference, with Code

MT5 Expert Advisor vs indicator: what each can do, real MQL5 code from our own indicator next to a minimal EA, installing, testing and which one you need.

Short answer: in MetaTrader 5 an Expert Advisor (EA) can trade on its own; an indicator can only calculate and draw. MQL5 enforces this: trade functions such as OrderSend() are prohibited in indicators, and so is WebRequest(). An EA reacts to every new tick in OnTick(), only one EA can run on a chart, and it needs automated trading switched on. Indicators run in OnCalculate(), and you can stack as many as you like on one chart. Choose an indicator if you want help reading the chart and still click Buy yourself; choose an EA if you want the rules executed while you are away.

Below: the differences side by side, real code from our own MT5 indicator next to a minimal EA, how each is installed and tested, and a short decision guide.

The differences side by side

IndicatorExpert Advisor
Main event handlerOnCalculate()OnTick()
Can open and close tradesNo (trade functions prohibited)Yes
Can call WebRequest()NoYes, for URLs you allow
How many per chartUnlimitedOne
Folder (File → Open Data Folder)MQL5\IndicatorsMQL5\Experts
Strategy TesterVisual mode only, no trades, no optimisationFull backtest and optimisation
Needs MetaTrader runningOnly while you look at the chartAll the time it should trade, often on a VPS

Real code: what makes a file an indicator

Here are the relevant lines from our free ASX Sessions: Free Session Box Indicator for MT5. The #property indicator_chart_window line makes it an indicator drawn on the price chart, and all of its work happens in OnCalculate():

#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0

int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[],
                const double &open[], const double &high[], const double &low[], const double &close[],
                const long &tick_volume[], const long &volume[], const int &spread[])
  {
   if(rates_total < 1)
      return 0;
   int n = rates_total - 1;
   // redraw on a new bar, on history reload, or when the current bar widens a running box
   if(prev_calculated > 0 && time[n] == g_bar && high[n] <= g_hi && low[n] >= g_lo)
      return rates_total;
   if(Redraw(time[n]))
     { g_bar = time[n]; g_hi = high[n]; g_lo = low[n]; }
   return rates_total;
  }

It reads prices and draws session boxes. It has no way to place an order, by design.

Real code: a minimal Expert Advisor

For comparison, the smallest useful EA skeleton. It runs on every tick and can send an order through the standard CTrade class. This is an illustration of the structure, not a trading strategy:

#include <Trade/Trade.mqh>
CTrade trade;

int OnInit()   { return INIT_SUCCEEDED; }
void OnDeinit(const int reason) {}

void OnTick()
  {
   if(PositionsTotal() > 0)
      return;                                    // one position at a time
   double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
   double sl  = ask - 200 * _Point;              // example values only
   double tp  = ask + 400 * _Point;
   // a real EA checks its entry rule here before trading
   // trade.Buy(0.01, _Symbol, ask, sl, tp);
  }

Everything that makes an EA useful or dangerous lives in that rule check: position size, stop, filters for news and spread, and what happens after a disconnect.

Installing each type

  1. In MetaTrader 5, open File → Open Data Folder.
  2. Copy an indicator (.ex5 or .mq5) into MQL5\Indicators, an EA into MQL5\Experts.
  3. Restart MetaTrader or right-click the Navigator and choose Refresh.
  4. Drag it onto a chart. For an EA, also enable automated trading: the AutoTrading button in the toolbar (newer builds label it Algo Trading) and the automated-trading checkbox in the EA’s own settings.
  5. If an EA checks a license or a web service online, add the server’s URL under Tools → Options → Expert Advisors → Allow WebRequest for listed URL. The option is off by default.

Testing each type

The Strategy Tester runs full backtests and optimisations for EAs. Indicators can only be watched there in visual mode, without trades and without optimisation. So a “backtested” indicator usually means someone wrote an EA around it, or counted signals on a chart. Ask which one, and ask whether the signals were final when each bar closed: many indicators redraw their past, which makes hindsight results look far better than live ones. We measured an 88.6% hindsight win rate turning into a loss once the same indicator was read point in time; details are in How to check a free indicator before you rely on it.

Which one do you need?

  • You trade by hand and want structure, sessions or levels on the chart: indicator.
  • You have written rules and want them executed without you: EA, plus a plan for uptime (a VPS if your computer sleeps).
  • You are on a prop-firm challenge: read the firm’s rules first; some restrict EAs or specific behaviour such as high-frequency trading.
  • You trade mainly on your phone: MetaTrader’s mobile apps do not run custom EAs or indicators, so neither helps there.

Browse MT5 tools in the marketplace. If you also use cTrader, the same logic applies there: cBots are built for automated trading, indicators for analysis.

Automated trading can lose money faster than manual trading. Test every EA on a demo account before you let it trade real money.

FAQ

Can an MT5 indicator open trades?

No. MQL5 prohibits trade functions such as OrderSend() in indicators. Only Expert Advisors and scripts can trade.

Can I run two Expert Advisors on one chart?

No. MetaTrader 5 allows one EA per chart. Open a second chart of the same symbol for a second EA. The number of indicators per chart is not limited.

Can an EA use an indicator?

Yes. An EA can read built-in indicators or custom indicators (for example with iCustom()) and trade on their values.

Why does my EA not trade?

Most often automated trading is switched off (toolbar button or the EA’s own setting), the market is closed, or a required WebRequest URL is not allowed. Check the Experts and Journal tabs for messages.

Sources (checked November 2026): MQL5 documentation on program types and event handlers and WebRequest; MetaTrader 5 help on trading robots and indicators, platform folders and the Strategy Tester.

Leave a Reply

Your email address will not be published. Required fields are marked *