MQL4 - How to Close All Trade
im //---------------------------------
// Close All Trade
//--------------------------------
void CloseAllTrades()
{
//go through all open trades
for (int i=OrdersTotal(); i>=0;i--)
{
//select trade
if (OrderSelect(i, SELECT_BY_POS)==true)
{
//check if trade belongs to current chart
if(OrderSymbol()== Symbol())
{
bool Ans = OrderClose(OrderTicket(),OrderLots(), MarketInfo(OrderSymbol(), MODE_BID),5,Red);
if (Ans == true)
{
Print ("Order Close !");
}
}
}
}
}
Langgan:
Catat Ulasan
(
Atom
)
Tiada ulasan :
Catat Ulasan