MACD - FXB.ta.MACD

The FXB.ta.MACD class calculates moving average convergence/divergence. It is a value-based calculation, and can be applied to any series of values including the output of another FXB.ta calculation. Parameters are as follows:

Parameter

Description

fast

Period for fast moving average (e.g. 12)

slow

Period for slow moving average (e.g. 26)

signal

Signal/smoothing period (e.g. 9)

maType

Type of moving average for the fast and slow averages. Defaults to an exponential moving average (ema / 1).

smoothingType

Type of moving average for the smoothing of the differences. Defaults to a simple moving average (sma / 0).

The MACD has three outputs:

The primary value (GetValue): the difference between the fast and slow moving averages

The signal value (GetSignalValue): the smoothed moving average of the differences

"Histogram" (so named because that's how it's usually drawn on a chart): the difference minus the smoothing of the difference.

In addition to the usual functions for getting the primary and signal values, the FXB.ta.MACD has further helpers for getting the histogram values:

Parameter

Description

GetHistogramValue(idx)

Returns the histogram value at index #idx

GetHistogramArray()

Returns an array of all the histogram values, similar to GetValueArray() and GetSignalValueArray()