previous bar Sunday

 

Hi all, could you suggest a method to detect if previous bar is Sunday?

Thank you!

 
There's no new bar when market close, sunday is where market close (except crypto).
 
Alberto Tortella:

Hi all, could you suggest a method to detect if previous bar is Sunday?

Thank you!

Here you go, just for you.

void OnTick()
  {
   if(prev_day_week() == 0)
      Print("Previous Candle Day is Sunday");
   else
      Print("Previous Candle Day is definitely not a Sunday");
  }
//+------------------------------------------------------------------+
int prev_day_week()
  {
   MqlDateTime tm;
   datetime prev_day = iTime(_Symbol, PERIOD_CURRENT, 1);
   TimeToStruct(prev_day, tm);
   return(tm.day_of_week);
  }
 
Thank you very much!