Navigation´╝ÜHome > Content >

atr_macd.mq4

Time: 2017-02-16 | Download file:atr_macd.mq4

//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
//mod 
#property copyright ""
#property link      ""

#property indicator_separate_window
#property indicator_buffers    1
#property indicator_color1     Blue
//#property indicator_color2     Red

#property indicator_width1     1

#property indicator_level1     100
#property indicator_level2     -100
#property indicator_levelcolor DarkSlateGray


extern int period1      = 7;
extern int period2      = 49;



double buffer1[];
double buffer2[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

int init()
{
      IndicatorBuffers(2); 

   
   SetIndexBuffer(0,buffer1);

   IndicatorShortName("atr macd ("+period1+","+period2+") " );  
   SetIndexLabel(0,"atr cd");



   return(0);
}
int deinit()
{
   return(0);
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+



int start()
{
   int counted_bars=IndicatorCounted();
   int limit,i;
   
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
           limit=Bars-counted_bars;


   for(i=limit; i>=0; i--)
   {
     buffer1[i]  = iATR(NULL, 0, period1, i)-iATR(NULL, 0, period2, i); 


 
 
   
  }
   
   return(0);
}

Recommend