//+------------------------------------------------------------------+ 
//|   $ROLLING_RANGE                                                 | 
//|                                                                  | 
//|                                                                  | 
//|   Copyright � 2008, Avery T. Horton, Jr. aka TheRumpledOne       |
//|                                                                  |
//|   PO BOX 43575, TUCSON, AZ 85733                                 |
//|                                                                  |
//|   GIFT AND DONATIONS ACCEPTED                                    | 
//|                                                                  |
//|   therumpldone@gmail.com                                         |  
//+------------------------------------------------------------------+ 
//|                                                                  |
//| go to www.kreslik.com for the latest indicator updates           |  
//+------------------------------------------------------------------+ 
//|                                                                  |
//| Use www.efxgroup.com as your forex broker...                     |  
//| ...tell them therumpledone sent you!                             |  
//+------------------------------------------------------------------+ 


#property copyright "Avery T. Horton, Jr. aka TheRumpledOne � 2008" 

#property link      "www.kreslik.com" 

#property indicator_chart_window

#property indicator_buffers 1
#property indicator_color1 White  

//---- input parameters 

//extern int myPeriod   = 5 ;
extern int myBarsAgo  = 5 ;

//---- buffers

double _Value[];

double   cClose, pOpen, xDiff;

//+------------------------------------------------------------------+ 
//| Custom indicator initialization function                         | 
//+------------------------------------------------------------------+ 
int init() 
  { 
   IndicatorBuffers(1);
   SetIndexBuffer(0,_Value);  
   SetIndexStyle(0,DRAW_LINE);  
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| Custom indicator deinitialization function                       | 
//+------------------------------------------------------------------+ 
int deinit() 
  { 
//---- 
    
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| Custom indicator iteration function                              | 
//+------------------------------------------------------------------+ 


int start() 
{ 

cClose = iClose(NULL,0,0) ;
pOpen  = iOpen(NULL,0,myBarsAgo) ;

xDiff  = (cClose - pOpen) / Point ;

/* 
    if ( xDiff > myBarsAgo   ) _Value[0] = 1;     else {
    if ( xDiff < myBarsAgo  )  _Value[0] = -1;    else  _Value[0] = 0;  }
*/
  _Value[0] = xDiff;  
    
   return( 0 ); 
} 
//+------------------------------------------------------------------+