Hi there all...
Just wondering, does anyone know if you can partially close an open order manually on the MetaTrader platform. I've got orders under EA control that I want to manually close partial...
thx, t.
What I will have to do is tweak my code to look for a comment like "to #nnnnn" in the closed order list and if I find it that will be a sign to my EA that I've executed a partial close manually. Then some more code to find the existing ticket numbers in my tables and update to the new number and everthing should be fine...
Thx for the help, t.
[...]
What I will have to do is tweak my code to look for a comment like "to #nnnnn" in the closed order list and if I find it that will be a sign to my EA that I've executed a partial close manually. Then some more code to find the existing ticket numbers in my tables and update to the new number and everthing should be fine...
Be careful with your assumptions about what's going to be in the comment. It might not be the same with all brokers. FYI.
gordon,
Any ideas about a solution to this issue. I just created a partial close routine and discovered to my horror that the ticket number changes. I have used a 'work around' for now that simply identifies the newest order created and uses that ticket number. Just seems like a lot of work to get a ticket number for an order you have just been dealing with.
int Get_New_Ticket() { int My_New_Ticket = 0, Timer = 0; for (int i = OrdersTotal()-1;i>=0;i--){ if(OrderSelect(i,SELECT_BY_POS)){ if(OrderOpenTime() > Timer){ My_New_Ticket = OrderTicket(); Timer = OrderOpenTime(); } } } return(My_New_Ticket); }
gordon,
Any ideas about a solution to this issue. I just created a partial close routine and discovered to my horror that the ticket number changes. I have used a 'work around' for now that simply identifies the newest order created and uses that ticket number. Just seems like a lot of work to get a ticket number for an order you have just been dealing with.
Hi Kenny
I am looking for a solution for this same issue with my EA so I would be very happy if you did find a solution for your answer and could add it to this post. Or if anyone has an idea cause eventhough this a is a very old thread it seems that no one has answered it properly, not here and not on any other post I have looked at.
What I am trying to do is to select any open order on my MT4 platform, doesn´t matter if it was placed by the EA or by me manually, and if any order gets 40 pips profit the EA should close half of it automatically. That way I can place an order (or the EA can place an order) and can leave my PC unattended. If the order is able to get a 40 pip profit then the EA will close half of it instantly, leaving the other half to run free until it hits the OrderTakeProfit(), or the BreakEven, whatever happens first. In any way, I would be achieving 50% of a 40 Pip gain. I usually set my TP to 120 Pips, and sometimes price reaches 40, 50, or even 60 Pips and after that it retraces and eventually hit my BreakEven (0 losses but also 0 gains), which is very sad. I use a 20 EMA indicator as Trail Stop so most of the time once price has reached a 40 Pips gain the EMA 20 line has already crossed over my OrderOpenPrice(), so when price retraces I still collect some profits but sometimes EURUSD moves so quick and so strong in one direction that the Ema20 line doesn´t have time to react and if price retraces it can hit my SL, that would be at that time at my OrderOpenPrice() because the EA moves the SL automatically to Break Even but I would like to collect 50% of the gains.
Thanks for your help
- You can't use OrderLots()/2 because that is not a multiple of LotStep, and you can't close or have remaining less than MinLot. See my code
- You are only checking if price may trigger a partial close. You aren't checking if you have already done it.
- Set a flag in persistent storage (files, global variables w/ flush)
- I move SL to Break Even+1 before the partial close. That way I know that I already did it.
- Open two orders.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi there all...
Just wondering, does anyone know if you can partially close an open order manually on the MetaTrader platform. I've got orders under EA control that I want to manually close partial...
thx, t.