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

 
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.
 
Thiago Duarte:

Remove the "Delete()" command and it will work.

In fact, the delete function was declared without a type; by setting it to "void" it will work correctly again.
 

Hey guys, i really liked this indicator, i've been learning about market profile for a while and this is the best a found.


I just made a change in the method of calculating the profile, i used the volume tick instead verifying just if the price past in the point. I did this because if you see, trades and the different times haave different pounds, you can see it in the volume histogram. So we can't junt count if price is there add one.


Do you agree?


The change I made showed differences between in the two mettods

 
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 Luiz@Luiz Vinicius Pereira Rocha - so mate, I'm new to programming, and I was working on an EA that only tracks POCs, high and low valuations, and I ended up finding this indicator. However, I couldn't find the place where it stores the Poc points, when I use the print function on some of the author's variables such as: Poc_value, zero values appear. can you 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