FXTAA Русская версия

Setting a moving average to another indicator in MT4

Smoothing an oscillator with a moving average is a two-click operation in MT4 — if you know which of the Apply-to options means what. Most of the confusion comes from one badly named dropdown entry.

Updated: 2026-09-22

By default a moving average is calculated on price. MT4 can also calculate it on the output of another indicator, which is how you get a signal line on RSI, a smoothed CCI, or an average of ATR.

The procedure

  1. Attach the base indicator first — RSI, for example. It opens in a separate subwindow.
  2. From the Navigator, drag Moving Average onto that subwindow, not onto the price chart. Dropping it in the wrong window is the most common mistake and there is no warning.
  3. In the dialog that opens, go to the Parameters tab and find Apply to at the bottom.
  4. Choose Previous Indicator's Data.

The moving average now plots inside the RSI window, smoothing RSI rather than price.

What the two indicator options actually mean

The dropdown offers both First Indicator's Data and Previous Indicator's Data. They are not synonyms, and the difference only appears once a subwindow holds more than two indicators.

OptionRefers to
First Indicator's DataThe indicator added to that subwindow first
Previous Indicator's DataThe indicator added immediately before this one

With RSI and one moving average the two settings give identical results. Add a second moving average intending to smooth the first, choose First Indicator's Data, and you will silently get another average of raw RSI instead — two lines that look plausible and mean something different from what you designed.

Ordering is positional, not by name. Delete the base indicator and re-add it, and it becomes the *last* indicator in the window — every reference now points somewhere else. Rebuild the whole stack after any deletion.

Doing it in MQL4

Programmatically there are two routes. iMAOnArray averages any array you have filled yourself, which is the flexible option:

double rsiBuf[];
ArrayResize(rsiBuf, 200);
ArraySetAsSeries(rsiBuf, true);

for(int i = 0; i < 200; i++)
   rsiBuf[i] = iRSI(NULL, 0, 14, PRICE_CLOSE, i);

// 9-period smoothing of RSI, current bar
double rsiSmoothed = iMAOnArray(rsiBuf, 0, 9, 0, MODE_SMA, 0);

For the handful of built-in indicators that expose an applied_price parameter there is also the constant route, using values 0 to 6 for price types — but iMAOnArray is clearer and works with custom indicators too.

Where this is genuinely useful

The cost of every layer

Each smoothing stage adds lag. RSI(14) already lags; a 9-period average of it lags further, and the combination can easily be slower than a plain moving average of price, while being much harder to reason about.

Before adding a layer, check whether a longer period on the base indicator achieves the same thing with one moving part instead of two. It usually does.