Type/to search
Built-in Functions
Global
Log
Market
Trade
Account
Futures
Exchange
IO
Network
Storage
Threads
TA
Talib
Overlap Studies
Momentum Indicators
Volume Indicators
Volatility Indicators
Cycle Indicators
Price Transform
Statistic Functions
Math Transform
Math Operators
Pattern Recognition
OS
Structures
Built-in Variables and Constants
Conventions
Exchanges

Calculates the MACD with Controllable MA Type and returns the MACD line, signal line and histogram.

talib.MACDEXT(inReal)
talib.MACDEXT(inReal, optInFastPeriod)
talib.MACDEXT(inReal, optInFastPeriod, optInFastMAType)
talib.MACDEXT(inReal, optInFastPeriod, optInFastMAType, optInSlowPeriod)
talib.MACDEXT(inReal, optInFastPeriod, optInFastMAType, optInSlowPeriod, optInSlowMAType)
talib.MACDEXT(inReal, optInFastPeriod, optInFastMAType, optInSlowPeriod, optInSlowMAType, optInSignalPeriod)
talib.MACDEXT(inReal, optInFastPeriod, optInFastMAType, optInSlowPeriod, optInSlowMAType, optInSignalPeriod, optInSignalMAType)

Examples

Compute the MACD with Controllable MA Type from the latest K-lines.

javascript
function main() { var records = exchange.GetRecords() if (!records) return var ret = talib.MACDEXT(records) // Output: [MACD line array, signal line array, histogram array] Log(ret) }
python
import talib def main(): records = exchange.GetRecords() if not records: return ret = talib.MACDEXT(records.Close) # Output: (MACD line array, signal line array, histogram array) Log(ret)

Returns

TypeDescription

array

Two-dimensional array: [MACD line array, signal line array, histogram array] (a tuple in the same order in Python).

Arguments

NameTypeRequiredDescription

inReal

Record array / numeric array

Yes

K-line array (close prices are used) or numeric array; in Python, pass a numeric array such as records.Close.

optInFastPeriod

number

No

Fast period. Default 12.

optInFastMAType

number

No

Moving average type of the fast line; see the MAType table on the Talib page. Default 0 (SMA).

optInSlowPeriod

number

No

Slow period. Default 26.

optInSlowMAType

number

No

Moving average type of the slow line; see the MAType table on the Talib page. Default 0 (SMA).

optInSignalPeriod

number

No

Signal line period. Default 9.

optInSignalMAType

number

No

Moving average type of the signal line; see the MAType table on the Talib page. Default 0 (SMA).

See Also

Remarks

TA-Lib equivalent: MACDEXT(Records[Close],Fast Period = 12,Fast MA = 0,Slow Period = 26,Slow MA = 0,Signal Period = 9,Signal MA = 0) = [Array(outMACD),Array(outMACDSignal),Array(outMACDHist)].