Closing partial positions

 

I have an ea set up to close half the open position when target is reached.  The problem is once the target is reached it closes half of the new lot size as well until it cant anymore. 


Any ideas on how to get it to only close half the position once?

 
 Lot
double LotSize = OrderLots()/2;
        bool TPOne = OrderClose(OrderTicket(),LotSize,Price,Slippage,Color);
 
too many ways to put into a single forum thread haha. each method depends on the rest of the code. So if you want help, you will have to post your ea code, or at least part of it that signals the ea to do the partial close.
 
Mikeel1987:

I have an ea set up to close half the open position when target is reached.  The problem is once the target is reached it closes half of the new lot size as well until it cant anymore. 


Any ideas on how to get it to only close half the position once?

You could check back through the deals for the order and see if one has DEAL_ENTRY_OUT which would indicate that there has been a partial close already.

Maybe the simplest way would be to have a globally declared array

double TicketArray[][];

and store the ticket number in the 1st dimension and the original lot size in the 2nd.

Then check before partially closing and only act if the trade's lots are the same as the original lots.

Reason: