Indicator to EA: Turn Any MT4/MT5 Indicator Into a Robot
Short answer: an indicator cannot trade, but an Expert Advisor can read an
indicator's values and trade on them. Built-in indicators are read directly;
your own .ex4/.ex5 indicator is read through iCustom by buffer number. To
convert an indicator to an EA, you need to know which buffer holds the signal,
what "no signal" looks like in it, and whether the indicator repaints.
Why can't an indicator trade by itself?
MetaTrader deliberately separates programs that calculate from programs that trade. Indicators are forbidden from sending orders. So "indicator to EA conversion" really means writing an EA that asks the indicator for values and acts on them. More on EAs, indicators and scripts.
Built-in indicators: the easy case
All 38 standard MetaTrader indicators — RSI, MACD, Bollinger Bands, Ichimoku, ATR and the rest — are available directly. In TradeSmithy each is a Technical Indicator node whose outputs are the indicator's lines: MACD gives main, signal and histogram; Bollinger gives upper, middle and lower. Wire the line you need into a comparison and you have a signal. See the RSI and moving average crossover walkthroughs.
Custom indicators: buffers are everything
A custom indicator exposes its values in numbered buffers. An EA calls it with
iCustom, passing the indicator's inputs in order, and reads buffer n at a
given bar. Three things decide whether it works:
- Which buffer is the signal. Open the indicator on a chart and look at the Data Window (Ctrl+D) while hovering over candles. Plotted buffers appear in order. Hidden calculation buffers do not appear but still take numbers, so if the numbering does not line up, check the indicator's documentation.
- What "nothing" looks like. Arrow indicators usually leave a buffer empty on
bars with no arrow. In MQL the default empty value is
EMPTY_VALUE— an enormous number, not zero — so "buffer > 0" is true on every bar. Since no real price is anywhere near that size, "buffer < 1,000,000" means "an arrow is here". Some indicators use 0 as their empty value instead; the Data Window shows which, and then "buffer > 0" is the right test. - The input order.
iCustompasses inputs by position. Skip or reorder one and the indicator silently runs with different settings.
The repainting trap
Some indicators change past values after the fact — a signal arrow moves or disappears once later bars arrive. On a chart, a repainting indicator looks perfect, because you are seeing the final version of history. An EA only ever sees the values as they were at the time, so it trades the messy version.
The test: run the indicator in the Strategy Tester in visual mode and watch whether arrows move. If they do, the EA will not perform like the chart looks, and no conversion can fix that.
How to do it in TradeSmithy
- Add a Custom Indicator node and upload the compiled
.ex5(MT5) or.ex4(MT4). The upload is required — the EA needs the actual file, and anyone who buys your strategy receives it too. - Declare its inputs in order and its buffers by name. Each buffer becomes an output port on the node.
- Wire the signal buffer into a Comparison — for arrows, "< 1,000,000" (or "> 0" if the indicator's empty value is zero); for lines, whatever crossing or level your rule needs.
- Add a Positions & Orders check, the BUY Order / SELL Order, and your stops.
Uploading and authoring custom indicators is on Pro and Premium. The full guide is using your own custom indicator in an Expert Advisor.
What about automatic "indicator to EA converter" tools?
Converter EAs exist that read an indicator's buffers and trade arrows. They work for simple arrow indicators and hit the same limits: they must be told the right buffers, they cannot fix repainting, and they give you a fixed set of rules around the signal. Building the EA yourself lets you add the filters, exits and position sizing that decide whether the signal is tradable.
Turn your indicator into an EA
Start free on TradeSmithy to build with any built-in indicator and
export MQL5 or MQL4; upgrade to Pro to upload your own .ex4/.ex5
indicators, ask the AI assistant to wire the signal, and backtest on our servers.
Frequently asked questions
Can I convert an MT4 indicator to an EA without the source code?
Yes. You only need the compiled .ex4, its inputs, and which buffer holds the
signal. The source is not required.
Why does my EA not trade my indicator's arrows?
Usually the wrong buffer, testing "greater than zero" on a buffer whose empty
value is EMPTY_VALUE, or inputs passed in the wrong order.
Can I use an MT4 indicator in an MT5 EA?
No. .ex4 files only run on MT4. You need the indicator's MT5 version (.ex5).
Does the indicator file have to be on the buyer's computer?
Yes. When you sell a strategy that uses a custom indicator on TradeSmithy, the uploaded file is delivered to the buyer with it.
Keep reading
How to Convert an MT4 EA to MT5 (and Why Converters Fail)
An .ex4 will not run on MT5, and MQL4 is not a dialect of MQL5. What actually has to change, when a converter is enough, and what to do with no source code.
4 min readRSI Expert Advisor for MT5 and MT4: Build, Test, Export
Build an RSI EA without code — why "RSI below 30" is the wrong rule, entering on the turn instead, a trend filter, and making the levels inputs you can test.
4 min readMoving Average Crossover EA for MT5 and MT4: Build It Free
Build a moving average crossover EA without code — detecting the cross correctly, one trade at a time, exits, a trend filter, and settings as inputs.
4 min read