is this code correct ?

 
i want to calculate the orders number that was opened and close in last 24 hours ,and write the code below ,but ,it seems not work .
 
YALEWANG:
i want to calculate the orders number that was opened and close in last 24 hours ,and write the code below ,but ,it seems not work .

Do it like this . . . How to use the   SRC   button. 

If there is a lot of code it can be too big for the box . . .  in that case you need to add the mq4 file as an attachment,  

 

 
YALEWANG: i want to calculate the orders number that was opened and close in last 24 hours ,
Order History sort by closing date - MQL4 forum
 

i am very sorry ,after i write the topic ,i cannot upload the code use  src mode ,and till now i can loggin the forum  normally 

my code as follow :

int  limit()

{

  int num=0; int orders=orderstotal(); int  timenow=timelocal();

  for(int cnt=0;cnt<orders;cnt++)

  {

   orderselect(cnt,select_by pos,mode history)

  if(orderopentime()>timenow- 24*3600)  num++

  }

return(num);

}
 
YALEWANG:

i am very sorry ,after i write the topic ,i cannot upload the code use  src mode ,and till now i can loggin the forum  normally 


Why ?  click this link  -->  How to use the   SRC   button.   it shows you how you use the SRC button.  Then please   edit   your post
 
YALEWANG:

i am very sorry ,after i write the topic ,i cannot upload the code use  src mode ,and till now i can loggin the forum  normally 

OrderOpenTime() is set according to your Broker's time not your local time,  so you need to use TimeCurrent() not TimeLocal()
 
YALEWANG:
  int  timenow=timelocal(); // No such function

Your computer's clock (TimeLocal) has NOTHING to do with the broker's server's time (TimeCurrent).
 
YALEWANG:
i want to calculate the orders number that was opened and close in last 24 hours ,and write the code below ,but ,it seems not work .

Beside of using   TimeCurrent() 

You have to search inside from OrdersHistoryTotal()

 OrdersTotal()  are trades still open not be closed


Reason: