Libraries: MovingAverages

 

MovingAverages:

The MovingAverages library is a part of Standard package of MetaTrader 5 client terminal.

The library contains functions for calculation of different types of moving averages. Totally, there are 8 functions that can be divided into 2 groups of functions of the same type, each containing 4 of them.

The first group contains functions that receive an array and simply return a value of a moving average at a specified position:

These functions are intended for obtaining the value of an average once for an array, and are not optimized for multiple calls. If you need to use a function from this group in a loop (to calculate values of an average and further write each calculated value into an array), you'll have to organize an optimal algorithm.

The second group of functions is intended for filling out the recipient array by values of a moving average based on the array of initial values:

  • SimpleMAOnBuffer() - fills out the output array buffer[] by values of a simple average from the price[] array;
  • ExponentialMAOnBuffer() - fills out the output array buffer[] by values of an exponential average from the price[] array;
  • SmoothedMAOnBuffer() - fills out the output array buffer[] by values of a smoothed average from the price[] array;
  • LinearWeightedMAOnBuffer() - fills out the output array buffer[] by values of a linear weighted average from the price[] array.

Author: MetaQuotes Software Corp.

Reason: