New day arrow

 

I am trying to place an arrow on the chart at the start of each day. However the code is only placing an arrow for the start of the last day.

//+------------------------------------------------------------------+
//| DayStart.mq4 |
//| Copyright 2012, MetaQuotes Software Corp. |
//| https://www.metaquotes.net/ |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow

double Lo;
int Holder;
double LoBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW);
SetIndexBuffer(0,LoBuffer);
SetIndexArrow(0,233);

return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();

int CalculatedBars = Bars - counted_bars;

for(int Count = CalculatedBars; Count >=0; Count--)
{
if(TimeHour(Time[Count]) == 0)
{
Lo = Low[Count];
Holder = Count;
}
}

LoBuffer[Holder] = Lo - 0.0025;

//----
return(0);
}
//+------------------------------------------------------------------+

 

Please use the SRC button to post code . . .

Works just fine . . . with one small change . . .

//+------------------------------------------------------------------+
//| DayStart.mq4                                                     |
//| Copyright 2012, MetaQuotes Software Corp.                        |
//| http://www.metaquotes.net                                        |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow

double Lo;
int Holder;
double LoBuffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
   {
   //---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexBuffer(0,LoBuffer);
   SetIndexArrow(0,233);

   return(0);
   }

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
   {
   int counted_bars=IndicatorCounted();

   int CalculatedBars = Bars - counted_bars;

   for(int Count = CalculatedBars; Count >=0; Count--)
      {
      if(TimeHour(Time[Count]) == 0)
         {
         Lo = Low[Count];
         Holder = Count;
         LoBuffer[Holder] = Lo - 0.0025;                    //  <----  line moved 
         }
      }

   //----
   return(0);
   }

//+------------------------------------------------------------------+
 

Another way without using an indicator and with grid off to see the beginning of new day is

properties ==> common ==> select "Show Period Separators"

This way the beginning of the new day is on the chart indicated with a vertical dotted line

 
Control Y = Show Period Separators