in the if block but it is not close : if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_HISTORY)==true)

 

Hi,

I have a problem with a line of code:

I want to execute the code inside the if only if the ticket is a trade is in the history: it is close,

but does not works.

Where is my miskake?


if(OrderSelect(ticket,SELECT_BY_TICKET,MODE_HISTORY)==true){

.. code }


the code insede the if block is executed also if the the trade with that ticket is open, but I don't want this.

I want to execute the if block just the trade is close (in the history)

Help me... please...

 
IriAle:

Hi,

I have a problem with a line of code:

the code insede the if block is executed also if the the trade with that ticket is open, but I don't want this.

I want to execute the if block just the trade is close (in the history)


Read the Documentation for the function you are trying to use . . .  OrderSelect()  it says . . .    "pool  -   Optional order pool index. Used when the selected parameter is SELECT_BY_POS. It can be any of the following values:"


If you use  SELECT_BY_TICKET  the pool parameter makes no difference . . .  you select the ticket and the ticket is selected regardless of which pool it is in . . . 

 

Thank you for your answer Raptor,

and so now how can I understand if the order with that tickect is closed?

Thank you

 
IriAle:

Thank you for your answer Raptor,

and so now how can I understand if the order with that tickect is closed?

You can just select from the History Pool using SELECT_BY_POS  or check the OrderCloseTime()  from the documentation  . . .    "If order close time is not 0 then the order selected and has been closed and retrieved from the account history."
 

Thank you very much!!!!

I will try it.


Thank you very much!!!!

Reason: