Download MetaTrader 5
To add comments, please log in or register
Do you need a programmer? Freelance service will find the developer you need!
m
105
m 2016.05.05 09: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
    }
 }
/
To add comments, please log in or register