Discussion of article "The Price Histogram (Market Profile) and its implementation in MQL5" - page 5

 
Hi, i need help urgently. On my platform in AMP Price Histogram no longer works, the calculation stops at 94%. Can anyone tell me how to fix it ? I would be very grateful to anyone who would like to help me
 
birbante16:
Hi, i need help urgently. On my platform in AMP Price Histogram no longer works, the calculation stops at 94%. Can anyone tell me how to fix it ? I would be very grateful to anyone who would like to help me

Do not double post!

I have deleted your duplicate post.

 
Hi, does anyone know how to modify the 'ClassExpert' code to build a Weekly or Monthly market profile? I ask for help
 
Hi, i cant find the attached files! Only pricehistogram.
 
Hello Does anyone know if it is possible to make a robot betray only in these lines of the POC? if so, how can i do it? because I'm testing all the variables in the ClassPriceHistogram file and the values are all zeroes, can someone help me?
 

Hi Dmitry,

first of all: Thank you for your great article and work !

Though its long time ago you published it, it works fine.

What I have here for you and the community is an update, so that histogram uses the tickvolume, because using only price action in time areas, where the volume is nearly zero, does not help much.

Replace the corresponding code in the file ClassPriceHistogram.mqh


bool CPriceHistogram::calculationPOCs()
  {
   int rates_total,rates_high,rates_time,rates_tv,index;
   double iHigh[],iLow[];
   long iTV[];
   datetime iTime[];
// Ïîëó÷àåì äàííûå çà ïåðèîä ñ time_start äî time_end / We obtain the data from time_start to time_end
   int err=0;
   do
     {
      rates_time=CopyTime(NULL,PERIOD_M1,time_start,time_end,iTime);
      rates_high=CopyHigh(NULL,PERIOD_M1,time_start,time_end,iHigh);
      rates_total=CopyLow(NULL,PERIOD_M1,time_start,time_end,iLow);
      
      rates_tv=CopyTickVolume(NULL,PERIOD_M1,time_start,time_end,iTV);
      
      err++;
     }
   while((rates_time<=0 || (rates_total!=rates_high || rates_total!=rates_time || rates_tv!=rates_time)) && err<AMOUNT_OF_ATTEMPTS);
   if(err>=AMOUNT_OF_ATTEMPTS)
     {
      return(false);
     }
   poc_start_time=iTime[0];
   high_day=iHigh[ArrayMaximum(iHigh,0,rates_total)];
   low_day=iLow[ArrayMinimum(iLow,0,rates_total)];
   int count=int((high_day-low_day)/_Point)+1;
// Ïîäñ÷åò äëèòåëüíîñòè íàõîæäåíèÿ öåíû íà êàæäîì óðîâíå / Count of duration of a finding of the price at each level
   int ThicknessOfLevel[];    // ñîçäàåì ìàññèâ äëÿ ïîäñ÷åòà òèêîâ / we create an array for count of tics
   ArrayResize(ThicknessOfLevel,count);
   ArrayInitialize(ThicknessOfLevel,0);
   for(int i=0;i<rates_total;i++)
     {
      double C=iLow[i];
      long CTV=iTV[i];
      // Distribute the tickvolume of the minute bar on all possible points in the bar
      // So the increment per point will be this ...
      int CInc=int(((iHigh[i]-iLow[i])/_Point));  
      while(C<iHigh[i])
        {
         int Index=int((C-low_day)/_Point);
         ThicknessOfLevel[Index]+=CInc;
         C+=_Point;
        }
     }


I admit its a quick hack and I have not tested every piece of code, but so far it works well.

Here a sample with the SP500 Index:


Left side original code. Right side with tickvolume

 

Dear Dmitry

I hope, you`re well.

Would it be possible that you implement buffers for the lines?

For each POC, maybe a Vwap and Median?


Thank you very much in advance

 
Just a heads up here... I downloaded all files to their appropriate directories, compiled, and received errors regarding ClassPriceHistogram.mqh. On line 375 therein, I simply replaced 
CPriceHistogram::Delete()

with

void CPriceHistogram::Delete()

Works fine now in AMP Futures' MT5 Version 5.00 Build 3661.

@Oleksandr, this "indicator" is technically an Expert. Indicator buffers are not available in Experts. Buffers can be effectively recreated using arrays in Experts but only real indicator buffers can be called by iCustom so for that purpose, a new custom indicator would have to be coded from scratch. Unfortunately, both options are beyond my level of coding ability. Good luck to you in finding better help.

 
is thre any way to plot the current seesion?


THNAKS
 
hello i tried changing the lines in your comment , but it istill doesnt work , i cant see the current session volumen profile

THANKS
Reason: