Your solution is found in the source code of the MACD (and many other built-in chart studies, too numerous to list).
Check these two lines of code taken from the MACD included with Thinkorswim:
plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);
The first line computes the MACD value. The second line takes that value and computes a moving average of that value.
You will also find examples of this used in the following chart studies:
CCIAverage, DEMA, DMI, StochasticFull, TEMA....
Yep, this sort of thing is quite common. Once you know what to look for you will them everywhere.