int total=OrdersTotal();
for(int i=0;i<total;i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if( (TimeCurrent()- OrderOpenTime()) >3600)
{
int type = OrderType();
bool result = false;
switch(type)
{
case OP_BUY : result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),3,Pink);
break;
case OP_SELL : result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),3,Pink);
}
}
}