talib.MACDEXT
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
| Type | Description |
array | Two-dimensional array: [MACD line array, signal line array, histogram array] (a tuple in the same order in Python). |
Arguments
| Name | Type | Required | Description |
inReal |
| Yes | K-line array (close prices are used) or numeric array; in Python, pass a numeric array such as |
optInFastPeriod | number | No | Fast period. Default |
optInFastMAType | number | No | Moving average type of the fast line; see the MAType table on the |
optInSlowPeriod | number | No | Slow period. Default |
optInSlowMAType | number | No | Moving average type of the slow line; see the MAType table on the |
optInSignalPeriod | number | No | Signal line period. Default |
optInSignalMAType | number | No | Moving average type of the signal line; see the MAType table on the |
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)].