How can I Check the Candle before the next day/Candle starts?

 

I have the Problem, that i musst always watch in the past with the Code.


When i debug i see this:

The Candle  Close is under Lower Bollinger Band

When the next day is open, i see this:

Bollinger Band is now other Value, the Close Price also.

Debug Says same:



In My Code i use this:

void OnTick()
  {
   MqlDateTime dt;
   TimeCurrent(dt);
   
   /* gibt den Tag zurück, 0 = Sonntag, 1 = Montag, usw...
   dt.day_of_week;
   */
   
   
   //if (TradingDay[DayOfWeek()] == false) return(0);
   if (!TradingDay[dt.day_of_week] == false) 
      {
         //return(0);
         if (!TradingTime() == false)
         // return(0)
         {  
         
      
            if(Analyse_Candles >= 3){  
            
               datetime time = iTime(_Symbol,PERIOD_CURRENT,0);
               if(timestamp != time){   
                  timestamp = time;
                   
                  for(int currency=0;currency<ArraySize(CurrencyArray);currency++){
            
                     signal = "";
                     Positions = 0;




the Code Part of Bollinger is this one:

   BB_Handle = iBands(currency, _Period, BB_Periods, BB_Shift, BB_Deviation, PRICE_CLOSE);
   //ChartIndicatorAdd(0,0,BB_Handle);           
             
   MqlRates PriceArray[];
   ArraySetAsSeries(PriceArray,true);
   
   //int PriceData = CopyRates(_Symbol,PERIOD_CURRENT,0,Analyse_Candles,PriceArray);   
   int PriceData = CopyRates(currency,PERIOD_CURRENT,0,Analyse_Candles,PriceArray);                   
              
   //Copy Price into the array
   CopyBuffer(BB_Handle,0,0,Analyse_Candles,BB_MiddleBand_Value);      
   CopyBuffer(BB_Handle,1,0,Analyse_Candles,BB_UpperBand_Value);
   CopyBuffer(BB_Handle,2,0,Analyse_Candles,BB_LowerBand_Value);
   
   ArraySetAsSeries(BB_UpperBand_Value,true);
   ArraySetAsSeries(BB_LowerBand_Value,true);
   ArraySetAsSeries(BB_MiddleBand_Value,true);    
   
   
   if(
      /*
         (PriceArray[i].close > BB_LowerBandArray[i]
          )  
      && (PriceArray[i+1].close < BB_LowerBandArray[i+1] || PriceArray[i+2].close < BB_LowerBandArray[i+1]) 
      //und es eine grüne Kerze ist hier muss das aktuelle close größer als das letzte sein
      && (PriceArray[i].close > PriceArray[i].open || PriceArray[i+1].close > PriceArray[i+1].open) //&&
      */
         PriceArray[0].close < BB_LowerBand_Value[0]
      ){
      BB_Buy = true;
   }
   
   else{
      BB_Buy = false;
   }

I don't want to wait for the next day. I know that it is possible to change the Code Part (PriceArray[0].close < (BB_LowerBand_Value[0]) || BB_LowerBand_Value[1]))


It is Possible that can check the Values before the next Candle Starts? And have somebody Codesnippets for that Problem?

Thanks

 
Please insert the code correctly: when editing a message, click on  Code and paste your code in the popup window.