NormalizedVolume_v2_v1
Download scriptOverview of the Normalized Volume Indicator
This technical tool is designed to help traders interpret market activity by providing a "normalized" view of trading volume. In many markets, raw volume numbers can be difficult to compare across different timeframes or assets because the sheer quantity of trades can vary wildly. This script solves that problem by comparing current trading volume against a moving average, creating a relative value that is easier to read and analyze.
How the Logic Works
The indicator operates through three primary logical steps:
1. Data Collection The script first identifies the raw volume for each period on your chart. It creates an internal map of these volume figures so it can perform calculations based on historical data.
2. Calculating the Benchmark (Moving Average) To understand if current volume is "high" or "low," the script needs a baseline. It calculates this baseline using a Moving Average based on a specific period (which you can customize). The logic allows for different types of averages, such as:
- Simple Moving Averages: A straightforward average of past volume.
- Exponential/Weighted Averages: Methods that give more importance to recent data to make the benchmark more reactive to current market trends.
3. Normalization (The Final Calculation) This is the core "intelligence" of the script. Instead of simply showing you the moving average line, the script divides the current volume by the calculated benchmark.
- Result > 1.0: This indicates that current trading activity is higher than the recent average.
- Result < 1.0: This indicates that trading activity is lower than the recent average.
- Result = 1.0: This indicates that volume is exactly in line with the average.
Practical Application
By using this normalization logic, the indicator transforms raw data into a comparative ratio. Rather than looking at thousands of contracts or shares traded, you are looking at a relative intensity score. It helps traders identify "volume spikes" or periods of exhaustion more clearly, as the resulting values are scaled to a consistent format regardless of the asset's actual trading size.
//+------------------------------------------------------------------+
//| NormalizedVolume_v2.mq4 |
//| Copyright © Vadim Shumilov (DrShumiloff) |
//| shumiloff@mail.ru |
//| ICQ 84796634 |
//+------------------------------------------------------------------+
#property copyright "Vadim Shumilov (DrShumiloff)"
#property link "shumiloff@mail.ru"
//----
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 LightSeaGreen
#property indicator_width1 2
#property indicator_level1 1.0
#property indicator_level2 2.0
#property indicator_minimum 0
/*
Method:
0 - MODE_SMA
1 - MODE_EMA
2 - MODE_SMMA
3 - MODE_LWMA
4 - MODE_LRMA
*/
extern int Method = 0;
extern int VolumePeriod = 21;
extern int Shift = 1;
double Buffer[];
double ExtBuffer[];
int init()
{
IndicatorBuffers(1);
SetIndexStyle(0, DRAW_LINE);
SetIndexBuffer(0, ExtBuffer);
SetIndexDrawBegin(0, VolumePeriod);
string short_name = "NV (" + VolumePeriod + ")";
IndicatorShortName(short_name);
SetIndexLabel(0, short_name);
ArrayResize(Buffer, Bars); ArrayInitialize(Buffer, 0);
ArrayResize(ExtBuffer, Bars); ArrayInitialize(ExtBuffer, 0);
return(0);
}
int start()
{
int i;
int counted_bars = IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
int limit = Bars - counted_bars;
if(counted_bars==0) limit--;
ArraySetAsSeries(Buffer, true);
for(i = 0; i < limit; i++) Buffer[i] = Volume[i];
for(i = 0; i < limit; i++)
{
double d=0;
if (Method < 4)
d=iMAOnArray(Buffer, 0, VolumePeriod, 0, Method, i+Shift);
else
d=3*iMAOnArray(Buffer, 0, VolumePeriod, 0, MODE_LWMA, i+Shift) - 2*iMAOnArray(Buffer, 0, VolumePeriod, 0, MODE_SMA, i+Shift);
if (d!=0) ExtBuffer[i] = NormalizeDouble(Buffer[i]/d,4);
}
return(0);
}
Comments