Author: Copyright c 2006, MetaQuotes Software Corp.
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reached
Indicators Used
Moving average indicator
0 Views
0 Downloads
0 Favorites
Mart
//+------------------------------------------------------------------+
//|                                                         Ìàðò.mq4 |
//|                                                  Zuzabush-Càõàëèí|
//|                                           www.Zuzabush@yandex.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright c 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
 
extern int P = 13;
extern int distance=90; 
//+------------------------------------------------------------------+
//| expert initialization function -íåáîëüøîé ìàíäðàæ                |
//+------------------------------------------------------------------+
int init()
  {
 
   MathSrand(LocalTime());
 
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function -Ýõ ïðîêà÷ó                                |
//+------------------------------------------------------------------+
 
int err = 0;
double Lot = 0.1;
double Ballance=0.0;
int start()
  {
//----
   if (OrdersTotal()==0&&err==0)
     {
       if (Ballance!=0.0)
         {
           if (Ballance>AccountBalance())
      
       Lot=Lot+1;
           else
             Lot=Lot-1+(!(Lot>1));
         }
       Ballance=AccountBalance();
         
       int order;
       if ((iMA(NULL,0,P,6,MODE_SMA,PRICE_CLOSE,0))<Ask)
 
         order=OrderSend(Symbol(),OP_SELL,Lot,Bid,5*Point,Ask+distance*Point,Bid-distance*Point);
       else
        order=OrderSend(Symbol(),OP_BUY,Lot,Ask,5*Point,Bid-distance*Point,Ask+distance*Point);
         
 }
   
   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 ---