History
Who and when: Gerald Appel, in the late 1970s.
MACD, the moving average convergence/divergence, was developed by Gerald Appel in the late 1970s. It is the difference between a fast and a slow exponential average of the price, usually 12 and 26 bars. A third line, the signal line, is a 9-bar exponential average of MACD itself.
When MACD rises above its signal line, the short-term pace of the price is gaining on the longer-term pace, which is read as bullish; the opposite cross is read as bearish. Education pages call the signal-line cross the most common MACD signal. Because every line is an average of the price, the signal comes after the move has started.
The rule as the source states it
MACD = EMA(12) − EMA(26); signal line = EMA(9) of MACD. Bullish when MACD crosses from below to above the signal line; bearish on the opposite cross.
Our version
MACD (12, 26, 9) of the close on 4-hour bars of a currency pair. Buy when the MACD line crosses above the signal line. Sell short on the opposite cross. An opposite signal closes the trade and reverses it.
How ours differs
- The source calls the crosses bullish and bearish; ours trades them in both directions.
- Like every library file, ours also adds the builder's default stop, position size and account limits (Steps 5 and 6). You can change them in the form.
Sources
- StockCharts ChartSchool: MACD (Moving Average Convergence/Divergence) Oscillator (opens in a new tab)
- Fidelity Learning Center: What Is MACD? (opens in a new tab)
Questions
Who created the MACD signal-line cross strategy, and what are its rules?
Gerald Appel, in the late 1970s. MACD (12, 26, 9) of the close on 4-hour bars of a currency pair. Buy when the MACD line crosses above the signal line. Sell short on the opposite cross. An opposite signal closes the trade and reverses it. Being well known says nothing about how a strategy will do. Test it on your own data.
Can I build the MACD signal-line cross strategy without coding?
Yes. "Open in the builder" opens it in the AlfaTactix strategy builder with every rule already filled in, so you can read each step and change it. From a saved strategy the builder generates the code for MetaTrader 5 (MQL5) and TradingView (Pine Script v6).

