Author: Copyright � 2010, MetaQuotes Software Corp.
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reached
Indicators Used
Indicator of the average true range
Miscellaneous
It issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
NewsWeek
//+------------------------------------------------------------------+
//|                                                     NewsWeek.mq4 |
//|                      Copyright © 2010, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

extern double Vol=0.01;
extern double Price=0.00070;
extern double KolPipsOpen=0.00010;
extern double StopLoss=0.00250;
extern double KolPips=0.00130;
extern double Magic=566;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
  int i,res;
//----
// Åñëè îäèí èç îðäåðîâ âûïîëíåí, òî óäàëÿåì îòëîæåííûå îðäåðà


// Âûñòàâëåíèå îðäåðîâ íà BUY è SELL íà îäèíàêîâûõ ðàññòîÿíèÿõ îò òåêóùåé öåíû
if (OrdersTotal()==0)
for(i=1;i<=4;i++)
{
  // Alert("123: i=",i);
  // res=OrderSend(NULL,OP_BUYLIMIT,Vol*i,Ask+Price*Point+KolPipsOpen*(i-1)*Point,0,Bid-StopLoss*Point,Ask+KolPips*Point,"1234567890: ",Magic*i,0,Green);
  res=OrderSend(Symbol(),OP_BUYSTOP,Vol*i,Ask+Price+KolPipsOpen*i,0,/*Bid-StopLoss Bid-iATR(Symbol(),0,20,0)*0.1*/0,Ask+KolPips+KolPipsOpen*i,"===",Magic*i,0,Green);
   if(res<0)
   {
      Alert("OrderSend failed with error #",GetLastError());
      Alert("Buy=",Ask+(Price+KolPipsOpen*(i-1))," Point=",Point," SL:",Bid-StopLoss," TP:",Ask+KolPips,"===",MarketInfo("EURUSD",MODE_POINT));
   //   Alert("OrderSend failed with error #",GetLastError());
      return(0);
   } else
   {
      
   }
   
   res=OrderSend(Symbol(),OP_SELLSTOP,Vol*i,Bid-Price-KolPipsOpen*i,0,/*Ask+StopLoss Ask+iATR(Symbol(),0,20,0)*0.1*/0,Bid-KolPips-KolPipsOpen*i,"===",Magic*(i+1),0,Green);
   if(res<0)
   {
      Alert("OrderSend failed with error #",GetLastError());
      Alert("Buy=",Bid-Price," Point=",Point," SL:",Ask+StopLoss," TP:",Bid-KolPips,"===",MarketInfo("EURUSD",MODE_POINT));
   //   Alert("OrderSend failed with error #",GetLastError());
      return(0);
   }
   
}   
//----
   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 ---