Jump to content

Calculate open order time duration.


Recommended Posts

i'm trying to make up a code to know the total time for each open order. below is the code.

 

for(int nCnt=OrdersTotal(); nCnt>=0; nCnt--) {

if (!OrderSelect(nCnt,SELECT_BY_POS)) continue;

if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic) {

double tmp = (TimeCurrent()-OrderOpenTime())/3600.0;

Print("Current trade Duration is ",NormalizeDouble(tmp,8));

}

}

 

but the log shows for every trade is "Current trade Duration is 0".

can anyone advice what went wrong?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...