Watch how to download trading robots for free
Find us on Facebook!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Views:
2949
Rating:
(24)
Published:
2011.12.26 10:43
Updated:
2017.09.06 10:17
\MQL5\Include\IncOnArray\ \MQL5\Indicators\
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

COsMAOnArray class is designed for calculation of OsMA (Moving Average of Oscillator) values on indicator buffers.

Usage:

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

  • int aFastPeriod - fast МА period;
  • int aSlowPeriod - slow МА period;
  • int aSignalPeriod - signal line period.
  • ENUM_MA_METHOD aFastMethod - fast МА method;
  • ENUM_MA_METHOD aSlowMetod - slow МА period;
  • ENUM_MA_METHOD aSignalMethod - signal line method.

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

  • const int aRatesTotal is a rates_total variable from the OnCalculate() function parameters;
  • const int aPrevCalc - prev_calculated variable from the OnCalculate() function;
  • double aData[] - the buffer with the data for the indicator calculation;
  • double aFastMA[] - intermediate buffer for fast МА;
  • double aSlowMA[] - intermediate buffer for slow МА;
  • double aMain[] - intermediate buffer for MACD main line;
  • double aSignal[] - intermediate buffer for MACD signal line;
  • double aOsMA[] - OsMA calculated value.
Additional methods:
  • int BarsRequiredSignal() - returns the minimum number of bars for signal line calculation;
  • string Name() - returns the line with the indicator name;
  • string Names() - returns the line with the МА names.

Test_OsMAOnArray.mq5 is a sample indicator showing COsMAOnArray class application. IncOsMAOnArray file must be placed to MQL5\Include\IncOnArray of the terminal data folder (IncOnArray folder must be created).

CMAOnArray class from the IncMAOnArray file is needed for the proper work. It can be found here.

Example of use of COsMAOnArray class

Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/628

X2MA Transform Candles X2MA Transform Candles

The indicator transfers the price data to the new coordinates system associated with X2MA indicator values.

Elder Impulse System Elder Impulse System

The candlesticks are colored in red, green and blue colors depending on a trend direction (Moving Average and MACD overall values).

VGridLine Intraday X6 VGridLine Intraday X6

Vertical time grid with six hours step.

XTrendlessOS (trendless oscillator) XTrendlessOS (trendless oscillator)

The indicator is based on the description given in Joe DiNapoli book "Trading with DiNapoli Levels". It is designed to evaluate the actual market overbought/oversold states.