CloseOnTime_v1

Author: ��� ����� �. aka KimIV
Orders Execution
Checks for the total of open ordersIt Closes Orders by itself
0 Views
0 Downloads
0 Favorites
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--

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---