CloseOnTime_v1





//+------------------------------------------------------------------+
//|                                                  CloseOnTime.mq4 |
//|                                           Êèì Èãîðü Â. aka KimIV |
//|                                              http://www.kimiv.ru |
//+------------------------------------------------------------------+
#property copyright "Êèì Èãîðü Â. aka KimIV"
#property link      "http://www.kimiv.ru"

//---- input parameters
extern int       CloseHour=23;
extern int       CloseMinute=55;

int start() {
  int cnt, ticket, total;
  if (Hour() == CloseHour && Minute() >= CloseMinute) {
    total=OrdersTotal();
    for (cnt=0; cnt < total ;cnt++) {
      if (OrderType() == OP_BUY) {
        OrderClose(OrderTicket(), OrderLots(), Bid, 3, Yellow);
        return(0); // exit
      }
      if (OrderType() == OP_SELL) {
        OrderClose(OrderTicket(), OrderLots(), Ask, 3, Yellow);
        return(0); // exit
      }
    }
  } 
  return(0);
}
//+------------------------------------------------------------------+
--------------020300040205050204090306--



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:
Checks for the total of open orders

It Closes Orders by itself

Other Features: