iMA

Calculates Moving Average value for any symbol and timeframe.

Syntax

iMA(
    symbol: string,
    timeframe: number,
    period: number,
    ma_shift: number,
    maMethod: E_MAType,
    appliedPrice: TPriceType,
    shift: number
): number

Parameters

Parameter
Type
Description

symbol

string

Symbol name

timeframe

number

Timeframe in minutes

period

number

MA period

ma_shift

number

MA shift in bars

maMethod

E_MAType

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

appliedPrice

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

shift

number

Index of the bar to calculate MA for

Return Value

Returns a number representing the calculated moving average value.

Description

The iMA method calculates the Moving Average value for any specified symbol and timeframe. Unlike GetMA, which works with the current symbol and timeframe, this method allows calculation of MA values for any available symbol and timeframe combination.

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