GetMA

Calculates Moving Average value for the current symbol and timeframe.

Syntax

GetMA(
    index: number,
    ma_shift: number,
    period: number,
    maMethod: E_MAType,
    appliedPrice: TPriceType,
    prev?: number
): number

Parameters

Parameter
Type
Description

index

number

Index of the bar to calculate MA for

ma_shift

number

MA shift in bars

period

number

MA period

maMethod

E_MAType

Moving average method (SMA, EMA, SMMA, LWMA)

appliedPrice

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

prev

number

Optional. Previous MA value for optimization

Return Value

Returns a number representing the calculated moving average value.

Description

The GetMA method calculates the Moving Average value for the current symbol and timeframe. It supports different MA types and can be optimized by providing the previous MA value.

Available MA Methods (E_MAType):

  • Simple Moving Average (SMA)

  • Exponential Moving Average (EMA)

  • Smoothed Moving Average (SMMA)

  • Linear Weighted Moving Average (LWMA)

Available Price Types can be found in the TPriceType section.

Example

Last updated