//+------------------------------------------------------------------+
//|                                             adx in histogram.mq4 |
//|                                                           .....h |
//|                                                  ibfx forum crew |
//+------------------------------------------------------------------+
#property copyright ".....h"
#property link      "ibfx forum crew"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
extern int pds = 14;

double plot[];
double plot2[];
double plot3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0, DRAW_HISTOGRAM, EMPTY,1,Lime);
   SetIndexBuffer(0,plot);
   
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
 {
   
   int limit, i;
   
   int counted_bars=IndicatorCounted();
   //---- check for possible errors
   if(counted_bars<0) return(-1);
   //---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   
   limit=Bars-counted_bars;
   
   
    for(i = 0; i <= limit; i++)
   
      plot[i]=(iADX(NULL,0,pds,PRICE_HIGH,MODE_PLUSDI,i) - iADX(NULL,0,pds,PRICE_HIGH,MODE_MINUSDI,i));
      
    
      
      
   return(0);
 }

