//+------------------------------------------------------------------+
//|                                                 Speed.mq4        |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 LightSeaGreen
#property indicator_color2 Red
#property indicator_level1 10
#property indicator_level2 -10
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName("");
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Accumulation/Distribution                                        |
//+------------------------------------------------------------------+
int start()
  {
   int i,n,Bars1,counted_bars=IndicatorCounted();
   RefreshRates();
//----
   //i=0;
   //n=Bars-counted_bars-1;
   //while(i<=n)
   Bars1=Bars/2;
   i=Bars1;//Bars-counted_bars-1;
   while(i>=0)   
   {
     
      
      
      //ExtMapBuffer1[i]=ExtMapBuffer1[i+1]+Volume[i];             
      ExtMapBuffer1[i]=(iCustom(NULL,0,"adaptive rsi",0,i)*10000)-(iCustom(NULL,0,"adaptive rsi",0,i+1)*10000);
     // ExtMapBuffer2[i]=(iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,i)-iMACD(NULL,0,14,26,9,PRICE_CLOSE,MODE_MAIN,i+1));//sell
      /*
      if(ExtMapBuffer1[i]!=0)
      {
         double diff=high-low;
         if(0==diff)
            ExtMapBuffer1[i]=0;
         else
         {
            ExtMapBuffer1[i]/=diff;
            ExtMapBuffer1[i]*=Volume[i];
         }
      }*/
      if(i<Bars1-1) 
      {
     // ExtMapBuffer1[i]-=ExtMapBuffer1[i+1];
       // ExtMapBuffer2[i]-=ExtMapBuffer2[i+1];
      }  
      
      
      i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+