Indicators/probuilder · probacktest · proorder · proscreener

MACDsignal

MACDsignal in ProBuilder returns the MACD signal line, an exponential moving average of the MACD line over the signal period. Syntax, formula, examples.

Syntax

probuilder
MACDsignal[S,L,Si](price)

Parameters

NameTypeDefaultDescription
Sinteger12Period of the short exponential average in the underlying MACD line.
Linteger26Period of the long exponential average in the underlying MACD line.
Siinteger9Period of the exponential average applied to the MACD line to produce the signal.
priceprice sourcecloseSeries the underlying averages are computed on, usually close.

Formula

code
MACDLine   = ExponentialAverage[S](price) - ExponentialAverage[L](price)
MACDsignal = ExponentialAverage[Si](MACDLine)

The histogram completes the trio:

code
MACD = MACDLine - MACDsignal

How it works

The signal line is a smoothed copy of the MACD line. Applying an Si-period exponential average to the line removes its fastest wiggles, so the signal trails the line and the two cross whenever the line changes direction decisively. Those crossings are the traditional MACD entry and exit trigger: line above signal reads bullish, line below reads bearish.

The division of labour among the three ProBuilder functions matters. MACDLine returns the raw spread between the fast and slow averages. MACDsignal, documented here, returns the smoothed trigger line. MACD returns the histogram, which is the line minus the signal. That last fact allows a shortcut: MACD[12,26,9](close) > 0 is exactly the same condition as MACDLine[12,26,9](close) > MACDsignal[12,26,9](close), so an explicit two-function comparison is only needed when both values themselves are of interest, for plotting or distance measures.

All three periods are required. The first two shape the underlying line, and only the third controls the smoothing that defines the signal.

Examples

Example 1, Signal line with standard settings (Indicator)

probuilder
// Signal line with the standard 12, 26, 9 settings on the close
MACDsignalLine = MACDsignal[12, 26, 9](close)
RETURN MACDsignalLine

Computes the 9-period exponential average of the 12-26 MACD line and plots it, the trigger line of a standard MACD panel.

Example 2, Full MACD panel (Indicator)

probuilder
// The three MACD components in one indicator
line   = MACDLine[12,26,9](close)
signal = MACDsignal[12,26,9](close)
histo  = MACD[12,26,9](close)
RETURN histo AS "Histogram", line AS "MACD line", signal AS "Signal"

Reconstructs the complete MACD display. On every bar, histo equals line - signal, which makes the relationship between the three functions visible directly on the chart.

Example 3, Crossover system (ProBacktest)

probuilder
// Long when the MACD line crosses above its signal, flat on the opposite cross
line   = MACDLine[12,26,9](close)
signal = MACDsignal[12,26,9](close)

IF NOT OnMarket AND line CROSSES OVER signal THEN
  BUY 1 CONTRACT AT MARKET
ELSIF LongOnMarket AND line CROSSES UNDER signal THEN
  SELL AT MARKET
ENDIF

The textbook MACD strategy: enter when the line overtakes its signal, exit when it falls back below.

Interpretation

Line above signal is the bullish state, line below is the bearish state, and the crossover marks the transition. Crossovers that occur far below zero are often read as early reversal signals, while crossovers above zero are continuation signals within an established uptrend.

The signal line's own position adds context: a signal line above zero means the smoothed momentum backdrop is positive. Because the signal is an average of an average of price differences, it reacts late in fast reversals, which is the price paid for its stability.

Common errors and gotchas

  • Not the histogram. MACD[12,26,9](close) returns line minus signal, not the signal. Testing MACD > 0 already encodes the line-above-signal condition, so combining it with an explicit MACDsignal comparison duplicates the same logic.
  • All three periods are required. The signature always takes [S,L,Si]. The first two define the underlying line and the third the smoothing; MACDsignal[9](close) does not compile.
  • Lag by construction. The signal smooths a series that is itself built from smoothed averages, so it turns well after price does. Systems that exit on the signal cross give back a portion of every fast reversal.
  • Absolute values scale with price. Like the MACD line, the signal is measured in price units. Thresholds tuned on one instrument do not transfer to another without normalisation.
  • MACD, the histogram, MACD line minus this signal line.
  • MACDLine, the raw line the signal is computed from.
  • DivergenceMACD, built-in divergence detection on MACD.
  • ExponentialAverage, the smoothing used at every stage.
  • Average, simple moving average for comparison.
  • PriceOscillator, percentage-based fast-slow average spread.
  • Momentum, raw price difference over N bars.
  • TRIX, triple-smoothed momentum oscillator with similar lag characteristics.