Author: Copyright � 2005, MetaQuotes Software Corp.
Speed3_001

This technical tool is designed to analyze market momentum by calculating the "speed" of price movement relative to trading volume. Instead of looking at price alone, it evaluates how aggressively the market is moving in relation to the amount of activity occurring during specific timeframes.

Core Methodology

The script operates by examining a window of historical data to establish a baseline for market behavior. Specifically, it looks back at the last six price candles to gather information on several key metrics:

  • Price Action: It tracks the opening, closing, high, and low points for each candle.
  • Trading Volume: It records the total amount of activity (volume) for those same periods.
  • Relative Position: It calculates "pips" to understand the actual distance moved in the market.

How the Data is Processed

To provide a smoother and more accurate reading, the logic follows these steps:

  1. Averaging Trends: The script calculates the average closing price, average volume, and average pips across the six-candle window. This creates a "median" snapshot of what normal market behavior looks like over that period.
  2. Velocity Calculation: It compares the current candle's volume against this calculated median. By dividing the change in volume by the average volume, the indicator identifies whether the current activity is significantly higher or lower than the recent trend.
  3. Momentum Smoothing: Depending on the user settings, the script can provide a cumulative view of these values. This allows traders to see not just a snapshot of the current speed, but a continuous flow of market momentum.

Visual Output

The final result is displayed as a dedicated line in a separate window below your main price chart. This visual aid helps identify:

  • Strength: Rapid movements supported by high volume.
  • Exhaustion: When price moves significantly but volume begins to drop relative to the average.
  • Trend Changes: Shifts in the "speed" of the market that may precede a change in direction.
Miscellaneous
Implements a curve of type %1
13 Views
0 Downloads
0 Favorites
Speed3_001
//+------------------------------------------------------------------+
//|                                                 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 1
#property indicator_color1 LightSeaGreen

extern bool cumulat=true;
//---- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorShortName("Speed3(V0-V1)/Vm");
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
//----
   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)   
   {
      double high0 =High[i];
      double low0  =Low[i];
      double open0 =Open[i];
      double close0=Close[i];
      double pips0=close0/Point;
      double vol0=Volume[i];
      
      double high1 =High[i+1];
      double low1  =Low[i+1];
      double open1 =Open[i+1];
      double close1=Close[i+1];
      double pips1=close1/Point;
      double vol1=Volume[i+1];
      
      double high2 =High[i+2];
      double low2  =Low[i+2];
      double open2 =Open[i+2];
      double close2=Close[i+2];
      double pips2=close2/Point;
      double vol2=Volume[i+2];    

      double high3 =High[i+3];
      double low3  =Low[i+3];
      double open3 =Open[i+3];
      double close3=Close[i+3];
      double pips3=close0/Point;
      double vol3=Volume[i+3];
      
      double high4 =High[i+4];
      double low4  =Low[i+4];
      double open4 =Open[i+4];
      double close4=Close[i+4];
      double pips4=close1/Point;
      double vol4=Volume[i+4];
      
      double high5 =High[i+5];
      double low5  =Low[i+5];
      double open5 =Open[i+5];
      double close5=Close[i+5];
      double pips5=close5/Point;
      double vol5=Volume[i+5];    

      double close_med = (close0+close1+close2+close3+close4+close5)/6;
      double vol_med= (vol0+vol1+vol2+vol3+vol4+vol5)/6;
      double pips_med= (pips0+pips1+pips2+pips3+pips4+pips5)/6;

      
      double vit1=(close0-close1)/(vol0-vol1);  
      double vit2=(close1-close2)/(vol1-vol2);  
      //ExtMapBuffer1[i]=ExtMapBuffer1[i+1]+Volume[i];             
      ExtMapBuffer1[i]=(vol0-vol1)/vol_med;  //(close-low)-(high-close);
      /*
      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) && cumulat) 
        ExtMapBuffer1[i]-=ExtMapBuffer1[i+1];
      
      
      i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments