iMACD

Calculates the Moving Average Convergence/Divergence (MACD) indicator values.

Syntax

iMACD(
    symbol: string | null,
    timeframe: number | null,
    fastEmaPeriod: number,
    slowEmaPeriod: number,
    signalPeriod: number,
    appliedPrice: TPriceType,
    mode: MacdMode,
    index: number
): number

Parameters

Parameter
Type
Description

symbol

string | null

Symbol name. Null for current symbol

timeframe

number | null

Timeframe in minutes. Null for current timeframe

fastEmaPeriod

number

Period for the fast EMA calculation

slowEmaPeriod

number

Period for the slow EMA calculation

signalPeriod

number

Period for the signal line calculation

appliedPrice

Type of price to use (Open, High, Low, Close, etc.)

mode

MacdMode

Which MACD value to return (Main, Signal)

index

number

Index of the bar to calculate MACD for

Return Value

Returns a number representing the requested MACD value.

Description

The iMACD method calculates the Moving Average Convergence/Divergence (MACD) indicator, which shows the relationship between two moving averages of an asset's price.

Available Price Types can be found in the TPriceType section.

Available MACD Modes (MacdMode):

  • MODE_MAIN - MACD line

  • MODE_SIGNAL - Signal line

Example

Last updated