xpVolume

This tool is designed to analyze trading volume to help identify significant shifts in market activity. Rather than looking at raw price movements, it focuses on the intensity of trading—essentially measuring how much "effort" is being put into the market by participants.

Core Logic Overview

The script functions by evaluating two different moving averages based on trading volume. Think of a moving average as a way to "smooth out" erratic data to see a clearer trend. By comparing two different timeframes of smoothed volume, the tool determines if current trading activity is accelerating or decelerating compared to recent history.

How it Works

  1. Volume Tracking: The script first gathers the raw volume data for each period on the chart.
  2. Dual Analysis: It calculates two separate averages from this volume data:
    • A Short-Term Average: This looks at very recent trading activity to capture immediate momentum.
    • A Long-Term Average: This looks at a broader window of time to establish the "normal" background level of trading.
  3. The Comparison: The script then compares these two averages against each other. It is specifically looking for moments where the short-term activity significantly outweighs the long-term average by a specific margin.

Visual Representation

The result of this calculation is displayed as a histogram in a separate window below your main chart.

  • Positive Signal: When the short-term volume surge exceeds the long-term average by a set threshold, the indicator triggers a positive value (displayed in red). This suggests a notable spike in market participation.
  • Neutral/Negative Signal: If the volume activity does not meet that specific high-intensity threshold, the indicator remains at a baseline negative value.

In essence, this tool acts as a "volume filter," highlighting only those moments where trading activity becomes unusually intense relative to the recent past, allowing you to spot significant market interests more clearly.

Price Data Components
Series array that contains tick volumes of each bar
Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
11 Views
0 Downloads
0 Favorites
xpVolume
//Version: 1
//Time: November 30, 2006
//+------------------------------------------------------------------+
//|                              xpVolume                            | 
//|                                                     xpVolume.mq4 |
//|                                         Developed by Coders Guru |
//|                                            http://www.xpworx.com |
//+------------------------------------------------------------------+

#property link      "http://www.xpworx.com"


#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_maximum  1
#property indicator_minimum -1


 
extern   int      MA_Period_1               = 6;
extern   int      MA_Period_2               = 24;
extern   int      MA_Type_1                 = MODE_SMA;
extern   int      MA_Type_2                 = MODE_SMA;

double UpBuffer[];
double Vol[];

int init()
{
   IndicatorBuffers(2); 

   SetIndexStyle(0,DRAW_HISTOGRAM, STYLE_SOLID,2);
   SetIndexBuffer(0,UpBuffer);
   SetIndexBuffer(1,Vol);
   return(0);
}

int deinit()
{
   return(0);
}



void start()
{
   int limit;
   double ma_1,ma_2;
   
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   limit=Bars-counted_bars-1;
   

   for(int shift=0; shift<limit; shift++)
       Vol[shift] = iVolume(NULL,0,shift);

   for(shift=0; shift<limit; shift++)
   {       
      ma_1 = iMAOnArray(Vol,0,MA_Period_1,0,MA_Type_1,shift);
      ma_2 = iMAOnArray(Vol,0,MA_Period_2,0,MA_Type_2,shift);
       
       if(ma_1-ma_2>=10)
       { 
         UpBuffer[shift] = 1 ;
       }
       else
       { 
         UpBuffer[shift] = -1 ;
       }
   }                   

   

   return(0);
}


Comments