Speedometer_v1_mod_v01





//+------------------------------------------------------------------+
//|                                               Speedometer_v1.mq4 |
//|                                  Copyright © 2006, Forex-TSD.com |
//|                         Written by IgorAD,igorad2003@yahoo.co.uk |   
//|            http://finance.groups.yahoo.com/group/TrendLaboratory |                                      
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Forex-TSD.com "
#property link      "http://www.forex-tsd.com/"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 Tomato

#property indicator_width1 1
#property indicator_width2 1

#property indicator_level1 0

extern int SpeedLimit=0;

double UpSpeed[];
double DnSpeed[];

//double price,prevprice,MaxUpSpeed=-1;

int init()
{
   string short_name;

   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,UpSpeed);
   
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,DnSpeed);

   short_name="Speedometer";
   IndicatorShortName(short_name);  
   SetIndexLabel(0,"Up");
   SetIndexLabel(1,"Down");
   
return(0);
}

int start()
{
   int    i, counted_bars=IndicatorCounted(),limit;
         
   if ( counted_bars > 0 )  limit=Bars-counted_bars;
   if ( counted_bars < 0 )  return(0);
   if ( counted_bars ==0 )  limit=Bars-1; 

   //for(i=0;i<limit;i++)
   //for(i=limit;i>0;i--)
   i=limit;
   while(i>=0)
   {
   double dTime = Period();
   if (i==0) dTime = (TimeCurrent()-Time[i])/60.0; 
   
   if(dTime > 0)
   double Speed = (Close[i]-Open[i])/dTime/Point;  
   
   if ( Speed >= 0) {UpSpeed[i]=Speed; DnSpeed[i] = 0;}
   else if ( Speed<0) {DnSpeed[i] = Speed; UpSpeed[i] = 0;}
   
   
   UpSpeed[i]-=UpSpeed[i+1];
   DnSpeed[i]-=DnSpeed[i+1];
    i--;
   }
   
//----------   
//   string Message;  
//   if ( SpeedLimit>0 && UpSpeed[0] > SpeedLimit && Volume[0]>1/*&& !UpTrendAlert*/)
//	{
//	Message = " "+Symbol()+" M"+Period()+": Exceeding of Speed Limit - BUY";
//	Alert (Message); 
	//UpTrendAlert=true; DownTrendAlert=false;
//	} 	 	  
//	if ( SpeedLimit>0 && DnSpeed[0] < -SpeedLimit && Volume[0]>1/*&& !DownTrendAlert*/)
//	{
//	Message = " "+Symbol()+" M"+Period()+": Exceeding of Speed Limit - SELL";
//	Alert (Message); 
	//DownTrendAlert=true; UpTrendAlert=false;
//	}	

 	         
//----




return(0);
}



Sample





Analysis



Market Information Used:

Series array that contains open time of each bar
Series array that contains close prices for each bar
Series array that contains open prices of each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: