I want to make an EA that can open trade more than one and at certain point I want to close all the trade. This is my first time dealing with this situation. I made a "step" to do it, does this step to do it correct?
int limitOpenOrder=3;
//open orderfor(int i=0;i<limitOpenOrder;i++) //loop to check if ther's open order and if it's under limit open order
{
if(OpenCondition)
BUY;
if(SellCondition)
SELL;
}
//close orderfor (int i = (OrdersTotal() - 1); i >= 0; i--) //loop to check all open order to find open order type
{
if (OrderType() == OP_BUY)
if(CloseBuyCondition)
res = OrderClose(OrderTicket(), OrderLots(), BidPrice, Slippage);
elseif (OrderType() == OP_SELL
if(CloseSellCOndition)
res = OrderClose(OrderTicket(), OrderLots(), AskPrice, Slippage);
}
I want to make an EA that can open trade more than one and at certain point I want to close all the trade. This is my first time dealing with this situation. I made a "step" to do it, does this step to do it correct?