Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 705

 
borilunad:


There is DoubleToStr() for that, which will write with real Digits, but this way it will write with 4! See the Documentation at the top left, you'll find everything there and learn a lot + tutorial!

There you go:



Thanks a lot! And I'm reading the tutorial, and writing an EA as I go along.

And another question: what is the easiest way to know that a given order is closed (by ticket)? Should I use the OrderCloseTime function, or is there a special function for this purpose?

 
exsistentia:



Thank you very much! I am reading the tutorial and writing an EA as I go along.

And another question: what is the easiest way to know if an order is closed (by ticket)? Should I use the OrderCloseTime function, or is there a special function for this purpose?

   if(OrderSelect(ticket,SELECT_BY_TICKET) && OrderCloseTime()>0) {
      // Ордер закрыт
      }

The ticket variable should store the ticket number of the order being checked
 
artmedia70:

The ticket variable should store the ticket number of the order being checked

If the order is closed, shouldn't it be found in the history (MODE_HISTORY)?
 
artmedia70:

The ticket variable should store the ticket number of the order being checked

Thank you.

Another question. There is a block in the EA that should delete pending orders, depending on the closing of market orders:

OrderSelect(T1,SELECT_BY_TICKET);
datetime cls1;
cls1=OrderCloseTime(); // time to close 1 order
OrderSelect(T2,SELECT_BY_TICKET);
datetime cls2;
cls2=OrderCloseTime(); // time to close 2 orders
Alert(cls1," ",cls2);

if(cls1==0 && cls2==0) //if both orders are open
return(0);
else
CLS++; //closing flag for one of the orders

if(cls1>0 && CLS==1) //delete pending orders depending on which order is closed
OrderDelete(T3);
if(cls2>0 && CLS==1)
OrderDelete(T4);
return(0);
}

The block does not work for some reason (it does not close pending orders) and Alert always shows "0 0". I specifically closed one of the open orders but nothing happens. It feels as if the EA does not detect that an order has already been closed and is now processing outdated data. What might be the problem?

 
exsistentia:

Thank you.

Another question. There is a block in the EA that should delete pending orders, depending on the closing of market orders:


The block does not work for some reason (pending orders are not closed) and Alert always shows "0 0". I purposely closed one of the open orders but nothing happens. It feels as if the EA does not detect that the order has already been closed and is now processing the obsolete data. What might be the problem?

Where is the order ticket found out? And where does OrderCloseTime come from if the order is still active (at least, it is selected among the active ones by code)?
 
evillive:
Where is the order ticket found out? And where does OrderCloseTime come from if the order is still active (at least it is selected among the active ones by code)?
Oh, stop raging. Pool is ignored in this case. Only by a close time greater than/equal to zero, we can determine from which list the order has been selected. It's a shame not to know these basics ;)
 
evillive:

if an order is closed, shouldn't it be looked for in the history (MODE_HISTORY)?
If selected by index - yes, in history, if selected by ticket pool is ignored. Learn the math ;)
 
artmedia70:
Oh stop raging. Pool is ignored in this case. Only by closing time greater than/equal to zero you may determine from which list the order has been selected. It's a shame not to know these basics ;)


I hardly ever search by ticket, more by index, it may be a shame, but what can you do ;)

but the search for the right ticket is not cited there, maybe he's looking for it wrong and then complains that the code doesn't work...

 
evillive:

I almost never search by ticket, more by index, maybe it's a shame, but what can you do ;)

but searching for the right ticket there in the code didn't lead, maybe he's looking for it wrong and then complaining that the code doesn't work...

It's a mess out there...
 

Thank you all for your help! The error was in the local ticket variables. What can I do, I'm a nerd.