Download MetaTrader 5
To add comments, please log in or register
Publish your task in Freelance service and developers will execute your order.
KotM
28
KotM 2014.09.17 11:03 

I want to use time for stop entry order

this is my code:

int d =TimeDay(TimeCurrent());

int h=TimeHour(TimeCurrent());

if(OrdersHistoryTotal()>0){

for(int i=OrdersHistoryTotal(),i>0,i--)

   {OrderSelect(Symbol(),h,MODE_HISTORY);

      int D=TimeDay(OrderCloseTime());

      int H=TimeHour(OrderClosePrice());

         if(d=D && H=h){sleep(3000);}}}

the same time,but it's still entry multiple orders at once

how to code it correctly,please help me....

Keith Watford
Moderator
7979
Keith Watford 2014.09.17 12:04  
I have no idea what you are trying to do and I do not believe that your code will compile, so your EA is probably working with whatever code compiled correctly last.
Amir Yacoby
1126
Amir Yacoby 2014.09.17 12:34  
your code looks over your history orders from recent to less recent and if it finds an order that is closed on the same hour of current hour it waits for 50 minutes. Now what is the problem?
KotM
28
KotM 2014.09.17 14:34  
it's not wait 50 minute.it still continuing open order...
whroeder1
13627
whroeder1 2014.09.17 16:57  
int H=TimeHour( OrderClosePrice( ));
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. Would you like to explain what that line does?
  3. Check your return codes (OrderSelect) What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
/
To add comments, please log in or register