#property copyright "Copyright © 2008, FOREXflash Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Lime

double b_Spr_Clear[];

int init() 
{
   SetIndexBuffer(0, b_Spr_Clear);
   SetIndexLabel(0, "Clear Spread");
   SetIndexStyle(0, DRAW_HISTOGRAM);
    
   string ls_12 = "VSA© Clear Spread";
   IndicatorShortName(ls_12);
   IndicatorDigits(1);
   return (1);
}

int deinit() {
   return (0);
}

int start() {
   double ld_28;
   double ld_36;
   double ld_44;
  
   int li_20 = IndicatorCounted();
   if (li_20 < 0) return (-1);
   if (li_20 > 0) li_20--;
   for (int nB = Bars - li_20; nB >= 0; nB--) {
      ld_28 = iHigh(NULL, 0, nB) - iLow(NULL, 0, nB);
      if (iOpen(NULL, 0, nB) >  iClose(NULL, 0, nB)) 
      {  ld_36 = iHigh(NULL, 0, nB) - iOpen (NULL, 0, nB);
         ld_44 = iLow (NULL, 0, nB) - iClose(NULL, 0, nB);
      }
      else
      {  ld_36 = iHigh(NULL, 0, nB) - iClose(NULL, 0, nB);
         ld_44 = iLow (NULL, 0, nB) - iOpen (NULL, 0, nB);
      }
      b_Spr_Clear[nB] = ( ld_36 + ld_44 ) / _Point ;
   }
   return (0);
}