Moving Average Convergence Divergence indicator (MACD) is the difference between Exponential Moving Average (EMA) of Short period data, and EMA of Long period data, that is: EMA(price short period) - EMA(price long period). The Signal line is Signal period EMA of MACD. Histogram shows the difference between MACD and Signal (MACD - Signal).

Hierarchy

Constructors

  • Parameters

    • priceChart: TradingChart
    • chart: ChartXY<UIBackground>
    • openValues: number[]
    • highValues: number[]
    • lowValues: number[]
    • closeValues: number[]
    • longPeriodCount: number
    • shortPeriodCount: number
    • signalPeriodCount: number
    • macdColor: Color
    • signalColor: Color
    • positiveStrongColor: Color
    • positiveWeakColor: Color
    • negativeStrongColor: Color
    • negativeWeakColor: Color
    • lineWidth: number
    • rowIndex: number

    Returns MovingAverageConvergenceDivergence

Methods

  • Gets the indicator name.

    Returns string

    The indicator name.

  • Sets the colors for the histogram.

    Parameters

    • positiveStrongColor: string

      The positive strong color for Histogram.

    • positiveWeakColor: string

      The positive weak color for Histogram.

    • negativeStrongColor: string

      The negative strong color for Histogram.

    • negativeWeakColor: string

      The negative weak color for Histogram.

    Returns void

  • Sets the width of the MACD and Signal lines.

    Parameters

    • newWidth: number

      New line width.

    Returns void

  • Sets the color of the MACD line.

    Parameters

    • newColor: string

      New line color as string, should be in HEX format e.g. #FFFFFF.

    Returns void

  • Sets the name of the indicator.

    Parameters

    • name: string

      New indicator name.

    Returns void

  • Moves the indicator from its calculated position forward or backward.

    Parameters

    • newOffset: number

      New offset value.

    Returns void

  • Sets the numbers of time periods (n) used to calculate the indicator.

    Parameters

    • longPeriodCount: number

      New long period count.

    • shortPeriodCount: number

      New short period count.

    • signalPeriodCount: number

      New signal period count.

    Returns void

  • Sets the color of the Signal line.

    Parameters

    • newColor: string

      New line color as string, should be in HEX format e.g. #FFFFFF.

    Returns void

  • Sets which values the indicator calculations are based on.

    Parameters

    • source: Source

      Values to base the calculations on.

    Returns void

  • Sets the type of the indicator's value label(s).

    Parameters

    Returns void

  • Sets the visibility of the indicator. Hiding the indicator via setVisible(false) does not remove it. Use dispose() to delete any indicator.

    Parameters

    • visible: boolean

      Visibility of the indicator.

    Returns void

  • Programmatically opens the indicator settings menu.

    Returns void