//+------------------------------------------------------------------+
//|                                                 SDL_Angle_v1.mq4 |
//|                                                            d4y47 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "d4y47"
#property link      ""

#property indicator_separate_window
//#property indicator_minimum 0
//#property indicator_maximum 50
#property  indicator_color1  White
#property  indicator_color2  Red
#property  indicator_width1 2
#property  indicator_width2 2
#property  indicator_buffers 2

double M30_1[];
double M30_2[];
extern int Periode=34;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(3);
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID);
   SetIndexDrawBegin(0,38);
   SetIndexBuffer(0,M30_1);
   SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID);
   SetIndexDrawBegin(1,38);
   SetIndexBuffer(1,M30_2);
//   SetIndexLabel(0,NULL);
//   SetIndexLabel(1,NULL);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int limit;
   int nilai;
//----
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//---- macd counted in the 1-st buffer
for(int i=0; i<limit; i++)
{
nilai=(iCustom(NULL,0,"!WA D1 Slope_Direction_Line",Periode,3,0,2,i)-iCustom(NULL,0,"!WA D1 Slope_Direction_Line",Periode,3,0,2,i+1))*MathPow(10,Digits);
if (nilai>0.0)
{   
   M30_1[i]=nilai;
   M30_2[i]=0.0;
}
else{
   M30_2[i]=nilai;
   M30_1[i]=0.0;
}
   IndicatorShortName("SDL Angle: ("+Periode+" Box)");
}
//----
   return(0);
  }
//+------------------------------------------------------------------+