This is interesting, especially if it correlates to highs and lows which could help potentially to find SR zones.
I will review the code fully later, but it looks very well organized and simple.
I also wonder if there would be a way to plot this not just with ObjectCreate but in indicator plot array.
Thank you Mohammad,
This is interesting, especially if it correlates to highs and lows which could help potentially to find SR zones.
I will review the code fully later, but it looks very well organized and simple.
I also wonder if there would be a way to plot this not just with ObjectCreate but in indicator plot array.
You're welcome
I'm not sure if I properly understand what do you mean by correlation between highs/lows and VP, but as a general rule, it would be better to use volume profile indicators with SR indicators (ZigZag, for example) to know exactly where the start and end of the time range should be placed.
You cannot create a horizontal histogram using the default mql5 drawing styles. Additionally, when plotting the indicator buffers, you may need to call the OnCalculate function and wait for new ticks to see any changes in the plots. In this code, the OnChartEvent function is called, allowing you to see any changes instantly by dragging the vertical lines.

- www.mql5.com
Nice indicator
Thank you Mohammad
Thanks for good indicator. Could VWAP (Anchored ) price show in this indicator?
You're welcome. Yes, of course. You can define a condition in the input section to display the VWAP and place the following in the current code:
//---Drawing anchored VWAP //---Get the current timeframe price data if(vwap_condition) { double cclose[]; double chigh[]; double clow[]; long cvol[]; datetime ctime[]; int cbars=Bars(_Symbol,PERIOD_CURRENT,time_begin,time_finish); ArrayResize(cclose,cbars); ArrayResize(chigh,cbars); ArrayResize(clow,cbars); ArrayResize(cvol,cbars); ArrayResize(ctime,cbars); if(CopyHigh(_Symbol,PERIOD_CURRENT,time_begin,time_finish,chigh)==-1 || CopyLow(_Symbol,PERIOD_CURRENT,time_begin,time_finish,clow)==-1 || CopyClose(_Symbol,PERIOD_CURRENT,time_begin,time_finish,cclose)==-1 || CopyTime(_Symbol,PERIOD_CURRENT,time_begin,time_finish,ctime)==-1 || CopyRealVolume(_Symbol,PERIOD_CURRENT,time_begin,time_finish,cvol)==-1) return; //---check the applied volume if(av==VOLUME_TICK || cvol[0]==0) if(CopyTickVolume(_Symbol,PERIOD_CURRENT,time_begin,time_finish,cvol)==-1) return; //---Calculate VWAP for the range period double vwap=0.0; double vp=0.0; // sum of (volume * average price) long v=0.0; // sum of volumes for(int z=0; z<cbars && !IsStopped(); z++) { vp+=(cvol[z]*((cclose[z]+chigh[z]+clow[z])/3.0)); v+=cvol[z]; vwap=vp/v; ArrowCreate("VP prfl "+IntegerToString(z),ctime[z],vwap,pocc); vwap=0.0; } }
I have used obj_arrow to display the VWAP in the code. You can find the 'ArrowCreate' function in the documentation -> OBJ_ARROW - Object Types - Objects Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Volume Profile:
This is an indicator for showing volume profile on the chart, using simple calculations and very fast execution.
Author: Mohammad Baset