How to differientate if a position has been closed by an user manually or by the EA logic?

 

How to differientate if a position has been closed by an user manually or by the EA logic?

Is this possible?

Greetings

BeLikewater

 

1) the EA has to save the ticket number

2) the EA to delete this ticket number in case the EA closes it.

3) If this ticket number 'disappers' (OrdersTotal()) or OrderClose() creates an Error (most probable):

4108

ERR_INVALID_TICKET

Invalid ticket


you the EA should know it has been closed by someone or something  (STP,TGT) else.

 
gooly: If this ticket number 'disappers'

4108

ERR_INVALID_TICKET

Invalid ticket

Ticket numbers never disappear, they only move from active list to the history list. If a pending order is deleted, or an open order is closed (by what ever reason) it is in the history list. If you select by valid ticket you will get the order.

BeLikeWater: How to differientate if a position has been closed by an user manually or by the EA logic?
There is no way to tell. As gooly implied, only the EA knows it is about to close a position. It must remember that fact in persistent storage (disk.) either (short term) a Global (terminal) Variable with the name including the ticket number, or (long term) a file.
 
i think magic no can go.just put magic no on your close order identifier
 

So its no possible.. I think it should be implemented, could have its functionality!

Greetings

BeLikewater

Reason: