Q(VolumeNorm)

Download script
Author: MNS777
Q(VolumeNorm)

This script is a custom technical analysis tool designed for the MetaTrader platform. Its primary purpose is to visualize and analyze market activity by relating price movement to trading volume, specifically focusing on identifying momentum shifts in a way that differentiates between positive and negative trends.

Core Logic and Functionality

The indicator operates through several distinct layers of data processing:

1. Volume-Adjusted Price Momentum At its foundation, the script calculates a unique value for every price candle. Instead of looking purely at how much the price changed (the difference between opening and closing prices), it divides that change by the volume traded during that period. This "normalizes" the movement, essentially measuring the intensity of the price action relative to the amount of trading activity. A large price move on low volume is treated differently than a large move on high volume.

2. Signal Smoothing The raw data generated in the first step can often be "noisy" or erratic. To smooth out these fluctuations, the script applies a Moving Average (MA). This creates a secondary line that follows the general trend of the volume-adjusted price action, helping traders see the broader direction of the market rather than getting distracted by minor, insignificant price spikes.

3. Trend Separation and Visualization The final stage of the logic involves splitting the data into two distinct visual components:

  • Positive Momentum: When the normalized value is positive, the script highlights this specific data point.
  • Negative Momentum: When the normalized value turns negative, the script captures that data instead.

By separating these two states, the tool creates a clear visual distinction between "upward" and "downward" pressure. Instead of showing everything on one cluttered line, it separates them into different visual elements (histograms and lines) so you can clearly see when the momentum flips from one direction to another.

Summary for the User

Essentially, this tool helps you visualize how much "effort" (volume) is being put behind price changes. It filters out the noise of the market to show you clear trends of momentum, making it easier to identify whether the current price movement is being driven by significant activity or just minor fluctuations.

Indicators Used
Moving average indicator
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
Q(VolumeNorm)
//+------------------------------------------------------------------+
//| Web:                                           Q(VolumeNorm).mq4 |
//|                                                           MNS777 |
//|                                                mns777.ru@mail.ru |
//+------------------------------------------------------------------+
#property copyright "MNS777"
#property link      "Web:" 
//---- îòðèñîâêà èíäèêàòîðà â îòäåëüíîì îêíå
#property  indicator_separate_window
//---- êîëè÷åñòâî èíäèêàòîðíûõ áóôôåðîâ
#property  indicator_buffers 4
//---- öâåòà èíäèêàòîðà 
#property  indicator_color1  Black
#property  indicator_color2  Lime
#property  indicator_color3  Red
#property  indicator_color4  Blue
//---- òîëùèíà èíäèêàòîðíûõ ëèíèé
#property indicator_width1 1
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2

//---- ÂÕÎÄÍÛÅ ÏÀÐÀÌÅÒÐÛ ÈÍÄÈÊÀÒÎÐÀ þþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþææ+
extern int PeriodMA = 24;
extern int ShiftMA = 0;
extern int ModeMA = 0;
extern double K = 1000;
extern int MaxBars = 1000 ; // áàðîâ èñòîðèè
extern string autor="Mns777.ru@mail.ru";
//---- æææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ+

//---- èíäèêàòîðíûå áóôôåðû
double     ExtBuffer0[];
double     ExtBuffer1[];
double     ExtBuffer2[];
double   SignalBuffer[];

//+------------------------------------------------------------------+
//|        indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   //---- ñòèëè èçîáðàæåíèÿ èíäèêàòîðà
   SetIndexStyle(0,DRAW_NONE);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexStyle(3,DRAW_LINE);
   //---- òî÷íîñòü
   IndicatorDigits(Digits+1);
   SetIndexDrawBegin(0,Digits);
   SetIndexDrawBegin(1,Digits);
   SetIndexDrawBegin(2,Digits);
   SetIndexDrawBegin(3,Digits);
//---- 3 èíäèêàòîðíûõ áóôôåðà èñïîëüçîâàíû äëÿ ñ÷¸òà.
   SetIndexBuffer(0,ExtBuffer0);
   SetIndexBuffer(1,ExtBuffer1);
   SetIndexBuffer(2,ExtBuffer2);
   SetIndexBuffer(3,SignalBuffer);
//---- èìåíà äëÿ îêîí äàííûõ è ëýéáû äëÿ ñóáúîêîí.
   IndicatorShortName("Q(VolumeNorm)");
   SetIndexLabel(1,NULL);
   SetIndexLabel(2,NULL);
   SetIndexLabel(3,"MA");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int    limit;
   int    counted_bars=IndicatorCounted();
   double prev,current;
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=MaxBars;
//---- macd
   for(int i=0; i<limit; i++)
      ExtBuffer0[i]= ((Close[i] - Open[i])*K)/ Volume[i];
      
      //---- signal line counted in the 2-nd buffer
   for(i=0; i<limit; i++)
      SignalBuffer[i]=iMAOnArray(ExtBuffer0,Bars,PeriodMA,ShiftMA,ModeMA,i);
    
     
     
     
     
     
     
     
    
      
//---- dispatch values between 2 buffers
   bool up=true;
   for(i=limit-1; i>=0; i--)
     {
      current=ExtBuffer0[i];
     
      if(current>0) up=true;
      if(current<0) up=false;
      if(!up)
        {
         ExtBuffer2[i]=current;
         ExtBuffer1[i]=0.0;
        }
      else
        {
         ExtBuffer1[i]=current;
         ExtBuffer2[i]=0.0;
        }
     }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+



Comments