HOLO Buffer

 

Hello Forum!

I was wondering if somebody would be so kind and add two buffers to the attached indicator.
I would like one that appears when the new lower open of the day happens on the 1h time frame and the another one when the new higher open happens also on the 1h time frame.

Presets attached with the right settings.


Thank you.

Files:
 
Why would someone do this? Instead, you have to make an effort and do it yourself.
 
Ahmet Metin Yilmaz #:
Why would someone do this? Instead, you have to make an effort and do it yourself.

well, I spent last three days on editing this code, trying to do it by myself but my coding skills are below zero and once the failure was inevitable I've decided to ask for help ...

 
Robert Stan #:

well, I spent last three days on editing this code, trying to do it by myself but my coding skills are below zero and once the failure was inevitable I've decided to ask for help ...

Can you publish your work here and ask for information about errors!

 
You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
          No free help (2017)

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum (2018)

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting).
          No free help (2017)

 

Ok. Thank you. I understand.

So I figured out that this part of the code is responsible for the buffers.
Ask and Bid in this case

int OnInit()
  {
   IndicatorDigits(Digits);
   
   if(Draw_Ask_Bid)
   { 
      SetIndexBuffer(0, AskBuffer);
      SetIndexBuffer(1, BidBuffer);
      SetIndexArrow(0, AskWingDing); 
      SetIndexArrow(1, BidWingDing); 
      SetIndexStyle(0, DRAW_ARROW, 2, 1, colorAsk );
      SetIndexStyle(1, DRAW_ARROW, 2, 1, colorBid );         

   }
        
   return(INIT_SUCCEEDED);
  }

After that I've added code lines from another indicator and today's highs and lows started to appear.

double AskBuffer[], BidBuffer[], HighBuffer[], LowBuffer[] ;
double PriceLevel[50], dailyhigh, dailylow ;
int    ArrayIndex, FOUND, LINECOUNT ;
string FP[50] ;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   IndicatorDigits(Digits);

   SetIndexBuffer(0, AskBuffer);
   SetIndexBuffer(1, BidBuffer);
   SetIndexArrow(0, AskWingDing); 
   SetIndexArrow(1, BidWingDing); 
   SetIndexStyle(0, DRAW_ARROW, 2, 1, colorAsk );
   SetIndexStyle(1, DRAW_ARROW, 2, 1, colorBid );   
 
   SetIndexBuffer(2, HighBuffer);
   SetIndexBuffer(3, LowBuffer);
   SetIndexArrow(2, HighWingDing); 
   SetIndexArrow(3, LowWingDing); 
   SetIndexStyle(2, DRAW_ARROW, 2, 1, colorHigh);
   SetIndexStyle(3, DRAW_ARROW, 2, 1, colorLow );    
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   Comment("");

//-- delete objects   
   long chartID=ChartID();
   ObjectsDeleteAll(chartID,sObj);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
//int i,limit;

   AskBuffer[0] = NormalizeDouble(Ask, Digits) ;
   AskBuffer[1] = EMPTY_VALUE ;
   AskBuffer[2] = EMPTY_VALUE ;
   AskBuffer[3] = EMPTY_VALUE ;

   BidBuffer[0] = NormalizeDouble(Bid, Digits) ;  
   BidBuffer[1] = EMPTY_VALUE ;
   BidBuffer[2] = EMPTY_VALUE ;
   BidBuffer[3] = EMPTY_VALUE ; 
   
   dailyhigh  = iHigh(NULL,PERIOD_D1,0);  
   dailylow   = iLow(NULL,PERIOD_D1,0);  
   
   
   
   for(int d=0;d<1440;d++)
   {
      if(High[d] == dailyhigh ) { HighBuffer[d] = dailyhigh ; }
      if(Low[d]  == dailylow )  { LowBuffer[d]  = dailylow ; }
      
   }

But as I mentioned before I'm looking for a new lower & higher open of the day on the 1h time frame.
So I've tried to modificate High Buffer and Low Buffer parts of the code by adding commands such as:

  int currentDailyBars=iBarShift(Symbol(),PERIOD_H1,timeDailyOpen,true);

   int iBarHigherOpen=iHighest(Symbol(),PERIOD_H1,MODE_OPEN,currentDailyBars+1,0); //-- on H1
   dHigherOpen      =iOpen(Symbol(),PERIOD_H1,iBarHigherOpen);
   timeHigherOpen   =iTime(Symbol(),PERIOD_H1,iBarHigherOpen);
etc. but it didn't work.
Seriously I have no idea what I'm doing :)
This is my first coding attempt and I follow only logic not knowledge.
Looks like it's not enough so I'm asking for a help cause I have run out of ideas…
 
  SetIndexStyle(3, DRAW_ARROW, 2, 1, colorLow );    

You are trying to create four (4) buffers. How many did you specify in the #property indicator_buffers or in the IndicatorBuffers call?

 
William Roeder #:

You are trying to create four (4) buffers. How many did you specify in the #property indicator_buffers or in the IndicatorBuffers call?

#property indicator_buffers 4

I don't really need Ask, Bid, Daily High  / Low Buffers.

I basically tried to modify existing buffers and turn them into DHO & DLO buffers but as you can see, I faild :(

 
Robert Stan #:

Ok. Thank you. I understand.

So I figured out that this part of the code is responsible for the buffers.
Ask and Bid in this case

After that I've added code lines from another indicator and today's highs and lows started to appear.

But as I mentioned before I'm looking for a new lower & higher open of the day on the 1h time frame.
So I've tried to modificate High Buffer and Low Buffer parts of the code by adding commands such as:

etc. but it didn't work.
Seriously I have no idea what I'm doing :)
This is my first coding attempt and I follow only logic not knowledge.
Looks like it's not enough so I'm asking for a help cause I have run out of ideas…

you should print your calculations to see if it is what would you expect. 

Like:

  int currentDailyBars=iBarShift(Symbol(),PERIOD_H1,timeDailyOpen,true);

Print(currentDailyBars);
Print(timeDailyOpen);


   int iBarHigherOpen=iHighest(Symbol(),PERIOD_H1,MODE_OPEN,currentDailyBars+1,0); //-- on H1
   dHigherOpen      =iOpen(Symbol(),PERIOD_H1,iBarHigherOpen);
   timeHigherOpen   =iTime(Symbol(),PERIOD_H1,iBarHigherOpen);

Print(iBarHigherOpen);
Print(dHigherOpen);
Print(timeHigherOpen );

Like this you can trace your errors !!

Succesuri!

 

unfortunately after another few tries I didn't make any progress :(

Can someone at least tell me how long will it take for an experienced coder to do this modification ?

5 min ? A few hours ? Days ?

Is it difficult one ?