Categories
News Room

[ad_1]

For Indicators:


ArraySetAsSeries(time,true);
static datetime pastime = time[0];
if(pastime!=time[0]) {
   Print("new bar closed");
   
   pastime=time[0];
}

For EA :Example for birth of a new bar in 1minute


datetime lastBarTime=0;

void OnNewBar() {



   if (lastBarTime != iTime(NULL, PERIOD_M1, 0)) {
      

      
  
      

      lastBarTime = iTime(NULL, PERIOD_M1, 0);

   }

}

add OnNewBar() function to OnTick() or OnTimer() to detect the birth of a new bar

[ad_2]

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *