Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 5 Libraries | Basic Library to Create Volume Profiles

This library provides a few simple public methods to create and plot Volume Profiles:

public:     void              VolumeProfile(datetime _from, datetime _to, int _resolution_points);                      ~VolumeProfile() {};     double            GetHVPrice();     void              Plot();
  • GetHVPrice returns the price that is related to highest volume in the range.
  • _resolution_points holds the window size to quantize adjacent prices(counted in points)

Here is a sample script to instantiate and plot a desired Volume Profile:

#include <VolumeProfile.mqh>  void OnStart()    {        datetime from=iTime(_Symbol, PERIOD_CURRENT,50);        datetime to=iTime(_Symbol, PERIOD_CURRENT,20);        VolumeProfile *VP = new VolumeProfile(from, to, 5);        VP.Plot();        Print(VP.GetHVPrice());        delete VP;    }  

MetaTrader Experts, Indicators, Scripts and Libraries

49718