class CloseAll_Action : public iActions
{
ENUM_ORDER_TYPE _type;
string _symbol;
int _magic;
int _slippage;
double _price;
bool doAction()
{
bool result=false;
int n = 0;
for (int i = OrdersTotal() - 1; i >= 0; i--)
{
if (OrderSelect(i, SELECT_BY_POS) && OrderSymbol() == _symbol && OrderMagicNumber() == _magic && OrderType() == _type)
{
if (!OrderClose(OrderTicket(), OrderLots(), _price, _slippage, clrNONE))
{
Print(__FUNCTION__, " ", "can't close Order: ", OrderTicket(), " error: ", GetLastError());
return false;
}
}
}
return result;
}
};
CloseAll_Action btnClose_Action();