Partially closed volume order using an EA
Use OrdersClose(ticket, part_of_Volume,...), for example
for (int i=OrdersTotal()-1;i>=0;i--) { if (OrderSelect(i,MODE_TRADES)) { if (OrderType==OP_BUY) { double volume=NormslizeDouble(OrderLots()/2.0,1); int ticket=OrderTicket(); bool res=OrderClose(ticket,volume,Bid,3,Red); if (res) Print("Order #",ticket," was partially closed"); else ("Partially closing of order #",ticket,"is failed!"); } } }
I see,
thank you Rosh
thank you Rosh
For example, we enters the market with 2 lots, after certain price we want to close it partially (1 lot), and left the rest 1 lot in the market. I know we can do it manually, but is it possible to do that using an EA?
Thanks