Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2012.01.23 08:07

IncDemaOnArray - library for MetaTrader 5

| English Русский 中文 Español Deutsch 日本語 Português

votes: 12


The CDemaOnArray class is intended for calculation of DEMA (Double Exponential Moving Average) on an indicator buffer.


The Init() method with the following parameters is called in the OnInit() function of the indicator:

The Solve() method with the following parameters is called in the OnCalculate() function:

  • const int aRatesTotal is the rates_total variable from the OnCalculate() function parameters;
  • const int aPrevCalc is the prev_calculated variable from the OnCalculate() function parameters;
  • double aData[] is a buffer with data for the indicator calculation;
  • double aM1[] is an intermediate buffer for calculations;
  • double aM2[] is an intermediate buffer for calculations;
  • double aDEMA[] is the buffer with calculated value of the indicator.
Additional methods:
  • int BarsRequired() returns the minimum number of bars required for the indicator calculation;
  • string Name() returns a string with the indicator name;

Test_DemaOnArray.mq5 is an indicator demonstrating how to use the CDemaOnArray class. The IncDemaOnArray file must be located in the MQL5\Include\IncOnArray directory of the terminal data folder (the IncOnArray folder must be created). The CMAOnArray class for the IncMAOnArray file is required for this class for work.

Double Exponential Moving Average Technical Indicator (DEMA) was developed by Patrick Mulloy and published in February 1994 in the "Technical Analysis of Stocks & Commodities" magazine. It is used for smoothing price series and is applied directly on a price chart of a financial security. Besides, it can be used for smoothing values of other indicators.



Translated from Russian by MetaQuotes Software Corp.
Original code:

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

Average Directional Movement Index (ADX) Average Directional Movement Index (ADX)

The Average Directional Movement Index Indicator (ADX) helps to determine if there is a price trend.

TypeToBytes TypeToBytes

Byte-wise operation with structures and standard data types.

PriceLines PriceLines

Script for drawing a price markup.