datetime - one minute one trade

Back to topics list To post a new topic, please log in or register
avatar
36
kot_filemon 2016.05.05 11:17
 

Hi,


I try write the code with limitation of one trade per minute, but it doesn't work (perhaps problem is with logic). I tried many versions with break, Sleep(). Have anyone any suggestions?


thank you.


datetime mt=TimeCurrent();
 datetime mtoop=mt-PERIOD_M1*60;
   Print("mtoop==",mtoop);   // current time minus 1 minute, works
                                            
  for (int j=OrdersTotal()-1;j>=0;j--)
 {
  if (OrdersSelect(j,SELECT_BY_POS,MODE_HISTORY)
   if (OrderSymbol()==Symbol())
    {
      datetime z=OrderOpenTime();
       if (mtoop <z && z<mt) break;    // Sleep(60000) doesn't work
    }
 }
Back to topics list  

To add comments, please log in or register