Download MetaTrader 5
To add comments, please log in or register
How to choose the most appropriate signal and subscribe to it in no time
DrZogg
140
DrZogg 2014.07.17 11:10 

I used to do something like this to get the code to wait:

     if (TimeCurrent() > lastChecked+(60*15)){
         for (int i = 0; i < OrdersTotal(); i++){
            if (OrderSelect(i,SELECT_BY_POS) > 0){
                  if (OrderType() == OP_BUY){
                     if (OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),0,0)> 0){;}
                  }
                  if (OrderType() == OP_SELL){
                     if (OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),0,0) > 0){;}
                  }               
             }
          }
         lastChecked = TimeCurrent();   
     }

But after that last update it's no longer working. I did a print statement and it actually adjust for the time differences and prints it, but it no longer works.  It used to give an integer value and now it gives an actual date. It prints is correctly if I add integers, but the same method of waiting no longer works.

So, how am I supped to do this now?

DrZogg
140
DrZogg 2014.07.17 11:16  
Also the comment function returns an error of wrong type and won't comment. But the compiler doesn't and prints it correctly.. So I can compile it, print it, but the comments can't use it and the rest of the code can't use it.
whroeder1
13644
whroeder1 2014.07.17 11:33  
PumPuiMonkey: It used to give an integer value and now it gives an actual date.
It used to give a datetime, still does. datetime and long are interchangeable. Only difference is what Print/Comment does with it.
datetime lastChecked;
DrZogg
140
DrZogg 2014.07.17 11:53  
I tried that. First thing I did. No effect.
DrZogg
140
DrZogg 2014.07.17 11:58  

The problem is obviously I'm trying to add integers to timedate. Not sure how to get around it. Where TimeCurrent used to be an integer.

And just to confuse me it prints correctly. When I print the result it does give the result I was excepting.

DrZogg
140
DrZogg 2014.07.17 13:10  
I think I had a logic problem....
/
To add comments, please log in or register