Watch how to download trading robots for free
Find us on Telegram!
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:
3699
Rating:
(22)
Published:
2012.01.20 08:29
Updated:
2016.11.22 07:32
\MQL5\Include\IncOnArray\ \MQL5\Indicators\
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

The COBVOnArray class is intended for calculation of OBV (On Balance Volume) on indicator buffers.

Usage:

The Init() method with an optional parameter is called in the OnInit() function:

  • int aPeriod is indicator period. If the value is set to 0 (default), the indicator will work like the one included in the client terminal - it will be calculated for all bars of the chart. Any other positive value sets the number bars of used for calculation of value for each bar (moving average principle).

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 aDataClose[] is the buffer with the Close data for the indicator calculation;
  • double aDataVolume[] is the buffer with the Volume data for the indicator calculation;
  • double & aOBV[] is the buffer with calculated value.

Additional methods:

  • int BarsRequired() returns the minimum number of bars required for the indicator calculation;
  • string Name() returns a string with the indicator name.

The Test_OBVOnArray.mq5 file is an indicator demonstrating how to use the COBVOnArray class. The IncOBVOnArray file must be located in the MQL5\Include\IncOnArray directory of the terminal data folder (the IncOnArray folder must be created).

On Balance Volume Technical Indicator (OBV) is a momentum technical indicator that relates volume to price change. The indicator, which Joseph Granville came up with, is pretty simple. If the close price of the current bar is higher than that of the previous bar, the volume of the current bar is added to the previous OBV. If the current bar close price is lower than of the previous one, the current volume is subtracted from the previous OBV.

An example of using the CObvOnArray class

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

IncCHVOnArray IncCHVOnArray

The CCHOOnArray class is intended for calculation of the Chaikin Volatility indicator (CHV) on indicator buffers.

IncFractalsOnArray IncFractalsOnArray

The CFractalsOnArray class is intended for calculation of Fractals on indicator buffers.

IncFramaOnArray IncFramaOnArray

The CFramaOnArray class is intended for calulcation of Fractal Adaptive Moving Average (FRAMA) on indicator buffers.

Heiken_Ashi_Smoothed_HTF_Signal Heiken_Ashi_Smoothed_HTF_Signal

Heiken_Ashi_Smoothed_HTF_Signal displays trend direction as a sequence of graphical objects, the trend is determined by Heiken_Ashi_Smoothed indicator.