Hello,

Having problems with closing all transactions utilizing orderclose(). What am I doing wrong? I understand the loop functions and it cycles all of the way to the finish. When I have three transactions you and available only two closes is left available.

I examine 3 transactions. All are available and are all buy - exactly the emblem. What am I missing?

If(stop == true)

cnt = OrdersTotal();
for (I=0; I lt; 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