Price Data Components
Series array that contains close prices for each bar
Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself
0 Views
0 Downloads
0 Favorites
VR---SIGMA
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
#property link      "http://traders-union.ru/?ref=25250"            //
//                       ÂÍÈÌÀÍÈÅ                                   //
//Äëÿ ïàðòíåðîâ ãðóïïû â "ÌÎÔÒ" (Ìåæäóíàðîäíîå Îáüåäåíåíèå          //
//Ôîðêñ Òðåéäåðîâ) ïèøó ñîâåòíèêè áåñïëàòíî è ïðåäëàãàþ íåñêîëüêî   //
//ðàáî÷èõ âàðèàíòîâ. Ñêàéï Voldemar227  ICQ 155553959               //
//////////////////////////////////////////////////////////////////////
extern string ÌÎÔÒ       = "http://traders-union.ru/?ref=25250";
extern double Lots           = 1    ;
extern int    Distanciya_min = 50   ;
extern int    Distanciya_max = 80   ;
extern int    slip           = 3    ;
extern bool   H24            = false;
extern bool   H4             = false;
extern bool   H1             = true ;
extern int    Chas           = 60   ;
extern int    Magic         = 227  ;
int time;
double bdi,sdi;
//==============================================================================//
int start ()                                  {
//==============================================================================//
//                            Îáóëÿåì ïåðåìåííûå
//==============================================================================//
int up=0, dw=0, v=0, c=0, q=0, p=0;
//==============================================================================//
//                             Ïîèñê îðäåðîâ
//==============================================================================//
int total=OrdersTotal();                                        
   int b=0, s=0,bb=0, ss=0;                                      
   for (int i=total-1; i>=0; i--)                                  
   {
    if(OrderSelect(i, SELECT_BY_POS))                              
    {
    if(OrderSymbol()!=Symbol())continue;                          
     {
     if (OrderType()==OP_BUY&&OrderMagicNumber()==Magic)                                      
     {                         
      b++                            ;                              
     }
     if (OrderType()==OP_SELL&&OrderMagicNumber()==Magic)                                      
     {           
      s++                            ;                      
     }
}}}
//==============================================================================//
//                          Óñëîâèÿ îòêðûòèÿ                      
//==============================================================================//
if (H24  ==true) {time=1440;}
if (H4   ==true) {time=240 ;}
if (H1   ==true) {time=240 ;}
//==========================================================//
int    vremya =Chas*60;
double ask    =NormalizeDouble(Ask,Digits);
double bid    =NormalizeDouble(Bid,Digits);
double dis_min=NormalizeDouble(Distanciya_min*Point,Digits);
double dis_max=NormalizeDouble(Distanciya_max*Point,Digits);
double close  =iClose(NULL,time,1);
double max    =iHigh (NULL,time,1);
double open   =iOpen (NULL,time,1);
double min    =iLow  (NULL,time,1);
if (close>open) {bdi=close-open; q=1;}
if (close<open) {sdi=open-close; p=1;}
if (bdi>dis_min&&bdi<dis_max){v=1;}
if (sdi>dis_min&&sdi<dis_max){c=1;}
if (q==1&&v==1){up=1;}
if (p==1&&c==1){dw=1;}
//==============================================================================//
//                       Óñëîâèÿ îòêðûòèÿ êîíåö                     
//==============================================================================//
//                          Îòêðûâàåì îðäåðà
//==============================================================================//
if (b==0&&up==1)
{
OrderSend(Symbol(),OP_BUY,Lots,ask,slip,0,0,NULL,Magic,0,CLR_NONE); 
}
if (s==0&&dw==1)
{
OrderSend(Symbol(),OP_SELL,Lots,bid,slip,0,0,NULL,Magic,0,CLR_NONE); 
}
//==============================================================================//
//                      Êîíåö îòêðûòèÿ îðäåðîâ
//==============================================================================//
//                          Çàêðûòèå îðäåðîâ
//==============================================================================//
   for (int z=total-1; z>=0; z--)
   {
    if(OrderSelect(z, SELECT_BY_POS))
    {
     if(OrderSymbol()!=Symbol())continue; 
     {
      if (OrderType()==OP_BUY&&OrderMagicNumber()==Magic)
      {
      int cmd = OrderOpenTime(); 
      int fdf = TimeCurrent();
       if (fdf-cmd>vremya)
       {
       OrderClose(OrderTicket(),OrderLots(),bid,5,Red);
       }
       }
       if (OrderType()==OP_SELL&&OrderMagicNumber()==Magic)
       {
           cmd = OrderOpenTime(); 
           fdf = TimeCurrent();
       if (fdf-cmd>vremya)
       {
       OrderClose(OrderTicket(),OrderLots(),ask,5,Red);
       }
       } 
      }
     }
   }
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 ---