Hi,
Having problems with closing all trades using orderclose(). What am I doing wrong? I know the loop works and it cycles all the way to the end. When I have three trades open only two closes and one is left open.
I test with 3 trades. All are open and all are buy - and same symbol. What am I missing?
if(stop == true)
{
cnt = OrdersTotal();
for (i=0; i < cnt; i++)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
ticket=OrderTicket();
// OrderClose(ticket, 0.01, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red);
OrderClose(ticket, 0.01, MarketInfo(OrderSymbol(), MODE_BID), 5, Red);
// TrendTradingProfit(TrendLineTPSize, EnableTrendLineTrading);
}
}
stop = false;
}
Help me!
L
Having problems with closing all trades using orderclose(). What am I doing wrong? I know the loop works and it cycles all the way to the end. When I have three trades open only two closes and one is left open.
I test with 3 trades. All are open and all are buy - and same symbol. What am I missing?
if(stop == true)
{
cnt = OrdersTotal();
for (i=0; i < cnt; i++)
{
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
ticket=OrderTicket();
// OrderClose(ticket, 0.01, MarketInfo(OrderSymbol(), MODE_ASK), 5, Red);
OrderClose(ticket, 0.01, MarketInfo(OrderSymbol(), MODE_BID), 5, Red);
// TrendTradingProfit(TrendLineTPSize, EnableTrendLineTrading);
}
}
stop = false;
}
Help me!
L