Speed_Kharko

Download script
Author: Copyright � 2007, Kharko
Speed_Kharko

This script functions as a momentum and trend analysis tool designed to measure the "speed" of price movements on a trading chart. Rather than simply showing where the price is, it focuses on how aggressively the price is moving over a specific period, helping traders identify acceleration or deceleration in market trends.

Core Logic & Functionality

1. Price Source Customization The tool allows users to define exactly which price data point should be used to calculate "speed." You can choose from various common metrics, including:

  • Opening and Closing prices.
  • High and Low extremes.
  • Mathematical averages of the bar (such as the midpoint or the average of all four price points).

2. Velocity Calculation (The "Speed") The indicator takes the chosen price value from the current moment and compares it against a price value from a set number of bars back (defined by the user). By calculating this difference, the tool reveals whether the market is gaining momentum or losing steam.

3. Visual Representation and Offsets The script produces two distinct visual outputs to provide a comprehensive view of market dynamics:

  • Standard Speed: A direct representation of the current momentum.
  • Offset Speed: A "shifted" version of the speed graph that compares the current data against a historical point even further back in time.

Key Features for Traders

  • Trend Identification: By observing the lines, traders can see if the price is moving faster or slower than it was previously.
  • Customizable Sensitivity: Users can adjust the "Bar" setting to change the look-back period, allowing the tool to be tuned for different timeframes (e.g., short-term scalping vs. long-term swing trading).
  • Visibility Toggles: The script includes built-in options to turn specific lines on or off, allowing you to declutter your chart and focus only on the data most relevant to your strategy.

In summary, this tool acts like a speedometer for the financial markets, translating raw price action into a readable visual of how fast the market is moving in a given direction.

Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
Speed_Kharko
//+------------------------------------------------------------------+
//|                                                 Speed_Kharko.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, Kharko"

//---- indicator settings
#property  indicator_chart_window
#property  indicator_buffers 4
#property  indicator_color1  Yellow
#property  indicator_color2  Yellow
#property  indicator_style2  STYLE_DOT
#property  indicator_color3  Aqua
#property  indicator_color4  Aqua
#property  indicator_style4  STYLE_DOT

//---- indicator parameters
extern int    Bar          = 24;       // Ïåðèîä
extern int    Cena         = 0;        // Öåíà: 1 - îòêðûòèÿ; 2 - çàêðûòèÿ; 3 - ìàêñèìóì; 4 - ìèíèìóì;
                                       //       5 - (H + L)/2; 6 - (H+L+C)/3; 7 - (H+L+C+O)/4;
                                       //       0 - (H+L+C+O)/4
extern bool   Sp_vis        = true;    // ïîêàçàòü/ñïðÿòàòü ãðàôèê ñêîðîñòè
extern bool   SpOf_vis      = true;    // ïîêàçàòü/ñïðÿòàòü ãðàôèê ñêîðîñòè ñî ñäâèãîì âíóòðü èñòîðèè

//---- indicator buffers
double     ExtBuffer0[];
double     ExtBuffer1[];
double     ExtBuffer2[];
double     ExtBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexStyle(3,DRAW_LINE);
//---- 4 indicator buffers mapping
   SetIndexBuffer(0,ExtBuffer0);
   SetIndexBuffer(1,ExtBuffer1);
   SetIndexBuffer(2,ExtBuffer2);
   SetIndexBuffer(3,ExtBuffer3);
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("Speed");
   SetIndexLabel(0,"Speed");
   SetIndexLabel(1,"SpeedNULL");
   SetIndexLabel(2,"Speed+Offset");
   SetIndexLabel(3,"SpeedNULL+Offset");
//---- initialization done

   return(0);
  }
//+------------------------------------------------------------------+
//| Accelerator/Decelerator Oscillator                               |
//+------------------------------------------------------------------+
int start()
  {
   int    limit,Error;
//---- last counted bar will be recounted
   int counted_bars=IndicatorCounted();
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars-Bar;
   if(limit<1)limit=1;
//---- 
   if(ExtBuffer0[0]!=0)ExtBuffer0[0]=0;
   if(ExtBuffer2[Bar]!=0)ExtBuffer2[Bar]=0;
   for(int i=0; i<limit; i++)
   {
      ExtBuffer0[i]=value(i);
      ExtBuffer1[i]=value(i+Bar);
      ExtBuffer2[i+Bar]=ExtBuffer0[i];
      ExtBuffer3[i+Bar]=value(i+Bar);
   }
   if(!Sp_vis)
   {
      ArrayInitialize(ExtBuffer0,0);
      ArrayInitialize(ExtBuffer1,0);
   }
   if(!SpOf_vis)
   {
      ArrayInitialize(ExtBuffer2,0);
      ArrayInitialize(ExtBuffer3,0);
   }

   Error=GetLastError();
   if(Error!=0 && Error!=1) {Print("Error START : ",Error);RefreshRates();}
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double value(int i)
{
  switch(Cena)
  {
      case 1:
         return(Open[i]);
      case 2:
         return(Close[i]);
      case 3:
         return(High[i]);
      case 4:
         return(Low[i]);
      case 5:
         return((High[i]+Low[i])/2);
      case 6:
         return((High[i]+Low[i]+Close[i])/3);
      case 7:
         return((High[i]+Low[i]+Close[i]+Open[i])/4);
      default:
         return((High[i]+Low[i]+Close[i]+Open[i])/4);
  }

}

Comments