Partial close help
- Need help with my code
- Partial close not working
- Please Help me add % Partial Close Lots to this EA
if(!OrderClose(ticket,lots /2 ,Bid,3,Green))
You can't just use OrderLots()/2 because that is not a multiple of LotStep, and you can't close or have remaining less than MinLot.
You also must check if you have already done it, to avoid repeated closing. Alternatives:
- Move SL to Break Even+1 before the partial close. That way, you know that you already did it.
- Set a flag in persistent storage (files, global variables w/flush)
- Open two orders initially, and close one (manually or by TP.)
You can't just use OrderLots()/2 because that is not a multiple of LotStep, and you can't close or have remaining less than MinLot.
You also must check if you have already done it, to avoid repeated closing. Alternatives:
- Move SL to Break Even+1 before the partial close. That way, you know that you already did it.
- Set a flag in persistent storage (files, global variables w/flush)
- Open two orders initially, and close one (manually or by TP.)
Thank you for your help
Hello, I've written this partial close function but it's not working as it's supposed to. I need your help in correcting the bug so that it can work in my code and help in closing orders partially after certain % of pips has been achieved.
For partial close purposes, there is already an OrderCloseBy function that you can use.