Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reached
0 Views
0 Downloads
0 Favorites
Nova

int X=0;
double S = 0.0000;
extern double       lot=0.1;
extern double       koef=1.5;
extern int       SL=10;
extern int       TP=10;
double dl;
double a;

int init()
  {
  a=lot;
   return(0);
  }

int deinit()
  {

   return(0);
  }


int start()
 {   
               
              
              
                S=Open[0];
                Sleep(1000);
                
             
             if(OrdersTotal() == 0 && X==1)
              { 
              if (Close[0]>dl){lot=a;}
              X=0;
              }
              
              if(OrdersTotal() == 0 && X==2)
              { 
              if (Close[0]<dl){lot=a;}
              X=0;
              }
                
             
             
 
                   if (OrdersTotal() == 0 && Close[0]>S && Close[1]>Open[1]) 
                           {
                            dl=Close[0];
                            OrderSend(Symbol(),OP_BUY,lot,Ask,3,Ask-SL*0.0001,Ask+TP*0.0001,"",14774,0,Blue); 
                            lot=lot*koef;
                            X=1;            
                           }
                   
                    if(OrdersTotal() == 0 && Close[0]<S && Close[1]<Open[1]) 
                           {
                            dl=Close[0];
                            OrderSend(Symbol(),OP_SELL,lot,Bid,3,Bid+SL*0.0001,Bid-TP*0.0001,"",14774,0,Red); 
                            lot=lot*koef;
                            X=2;
                           }

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