Navigation´╝ÜHome > Content >

MAcross_idou_indikatorforeks.ru.mq4

Time: 2015-06-25 | Download file:MAcross_idou_indikatorforeks.ru.mq4

//+------------------------------------------------------------------+
//|                                                   cross idou.mq4 |
//|                                                                A |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "A"
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Blue
#property indicator_width1 3
#property indicator_color2 Red
#property indicator_width2 3
#property indicator_color3 Blue
#property indicator_width3 3
#property indicator_color4 Red
#property indicator_width4 3
#property indicator_color5 Yellow
#property indicator_color6 Green


double BufBuy[];
double BufSell[];
double BufBuyClose[];
double BufSellClose[];
double FastMA[];
double SlowMA[];





extern int idou   =26;
extern int MA     =26;
extern int MA_idou=20;


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexBuffer(0,BufBuy);       SetIndexLabel(0,"Buy");             SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,2); SetIndexArrow(0,233); 
   SetIndexBuffer(1,BufSell);      SetIndexLabel(1,"Sell");            SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,2); SetIndexArrow(1,234); 
   SetIndexBuffer(2,BufBuyClose);  SetIndexLabel(2,"BuyClose");        SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,2); SetIndexArrow(2,251); 
   SetIndexBuffer(3,BufSellClose); SetIndexLabel(3,"SellClose");       SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,2); SetIndexArrow(3,251); 
   SetIndexBuffer(4,FastMA);       SetIndexLabel(4,"MA"+MA); SetIndexStyle(4,DRAW_LINE,STYLE_SOLID);
   SetIndexBuffer(5,SlowMA);       SetIndexLabel(5,"MA"+idou); SetIndexStyle(5,DRAW_LINE,STYLE_SOLID);
   
  SetIndexEmptyValue(5,0.0);

   
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  
   
   int counted_bars=IndicatorCounted();
   int limit=Bars-counted_bars;
   
   if(limit < idou) limit = idou;
   
   for(int i=limit-1; i>=0;i--)
   {
      FastMA[i] = iMA(NULL,0,MA,0,MODE_SMA,PRICE_CLOSE,i);
      SlowMA[i] = iMA(NULL,0,MA_idou,-1*idou,MODE_SMA,PRICE_CLOSE,i);

      BufBuy[i]  = EMPTY_VALUE;
      BufSell[i] = EMPTY_VALUE;

      if(SlowMA[i] != 0){
         if(FastMA[i+1] >SlowMA[i+1] && FastMA[i] < SlowMA[i]) BufBuy[i]  =Open[i];
         if(FastMA[i+1]  SlowMA[i]) BufSell[i] =Open[i];
      }
   }
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Recommend