ma

Syntax

ma(X, window, maType)

Please see TALib for the parameters and windowing logic.

Details

Calculate the moving average (whose type is determined by maType) in a sliding window of the given length.

Differences from TA-Lib MA:
  • DolphinDB ma does not currently support MAMA.
  • Missing-value handling differs: DolphinDB ma and TA-Lib MA behave similarly for leading missing values by preserving them and starting the window calculation from the first non-missing value. However, they differ when missing values appear in the middle of the series. DolphinDB ma typically continues the moving average calculation according to its rules and produces results, whereas some TA-Lib indicators may start returning NaN from the first NaN encountered after the initial non-missing value, which can also affect subsequent results.

Parameters

maType is the type of moving averages. It is an integer in [0,8].0= sma , 1= ema , 2= wma , 3= dema , 4= tema , 5= trima , 6= kama , 8= t3 . Note that value 7 (mama) is not supported.

Returns

A DOUBLE vector.