Jump to content

Recommended Posts

Posted

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?

Posted

just checked with some of my longer running trades and I'm getting a duration > 0

if it's a fresh trade maybe the resulting value of tmp is too small for the Print function

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...