Second_Easiest

Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains open prices of each bar
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself
2 Views
0 Downloads
0 Favorites
Second_Easiest
//+------------------------------------------------------------------+
//| Second Easiest - daytrade robot                                  |
//+------------------------------------------------------------------+

extern double lot = 1;
extern double marketclosehour = 20; // on friday

int start()
  {
     double h1 = iHigh(NULL,1440,0);
     double l1 = iLow(NULL,1440,0); 
     double o1 = iOpen(NULL,1440,0);
     {
     if ((Bid>o1 && (o1-l1)>15*Point) && OrdersTotal()<1 && Hour()<16)
     OrderSend(Symbol(),OP_BUY,lot,Ask,0,0,0,"Easiest ever",0,0);

     if ((Ask<o1 && (h1-o1)>15*Point) && OrdersTotal()<1 && Hour()<16)
     OrderSend(Symbol(),OP_SELL,lot,Bid,0,0,0,"Easiest ever",0,0);
       {
          for (int i=0; i<OrdersTotal(); i++)
         {                                               
            if (OrderSelect(i,SELECT_BY_POS,MODE_TIME)==true)
             if (OrderType()==OP_BUY && Hour()>marketclosehour-1)
             OrderClose(OrderTicket(),OrderLots(),Bid,0,CLR_NONE);
        
            if (OrderType()==OP_SELL && Hour()>marketclosehour-1)
            OrderClose(OrderTicket(),OrderLots(),Ask,0,CLR_NONE);
         }   
       }
     }
   return(0);
  }
//+------------------------------------------------------------------+

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 ---