myeatrade

Community

OrderClose

merak merak 2015-12-07 19:52
Hi everyone

Do you know why an expert advisor can't close positions automatically?

Which code do you use?

Here's mine.

Code: Select All
if(condizione1)
if(condizione2)

if(OrdersTotal() > 0)

{

for(int c = 0; c < OrdersTotal(); c++)
{
OrderSelect(c, SELECT_BY_POS);

if(OrderType() == OP_BUY)
{
OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, clrYellow);
}
else
if(OrderType() == OP_SELL)
{
OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, clrYellow);
}
}

}
Page 1 of 1 1

Please login to post reply, if you haven't account you can register free

Return to MQL Programming
menu image pre-loadermenu image pre-loadermenu image pre-loadermenu image pre-loadermenu image pre-loadermenu image pre-loadermenu image pre-loader