NormalizedVolumeOscillator_v2_v1
Download scriptThe Normalized Volume Oscillator (NVO) is a technical analysis tool designed to help traders understand market activity by comparing current trading volume against historical averages. Unlike standard volume indicators that simply show how much trading occurred, this script "normalizes" the data into a percentage-based scale, making it easier to identify whether current market interest is overactive, underactive, or following a trend.
How the Logic Works
The core functionality of the script can be broken down into three main stages:
1. Data Collection and Smoothing The tool starts by looking at the raw trading volume over a specific period (which you can customize). To prevent "noisy" data from creating misleading signals, the script applies a moving average to this volume. Users can choose different types of averages (such as Simple, Exponential, or Linear Weighted) depending on how quickly they want the indicator to react to new price action.
2. The Normalization Process Once the average is established, the script performs a calculation to determine the "Normalized Volume Oscillator" value. It takes the current volume and compares it against the calculated average. By converting this relationship into a percentage, the tool centers the data around a zero point:
- Negative values indicate that current volume is lower than the historical average.
- Positive values indicate that current volume is higher than the historical average.
3. Visual Feedback via Color Coding To make the information instantly readable at a glance, the script translates these percentages into a multi-colored histogram. The colors change dynamically based on the intensity of the volume:
- Blue: Represents negative values (volume below average).
- Green: Represents low positive volume (between 0% and 38.2%).
- Lime: Represents moderate positive volume (between 38.2% and 61.8%).
- Yellow: Represents high positive volume (between 61.8% and 100%).
- Red: Highlights extreme surges where volume exceeds 100% of the normalized benchmark.
Summary for the User
Essentially, this tool acts as a "thermometer" for market activity. Instead of looking at raw numbers, you can use the colors to quickly see if the market is cooling down (Blue/Green) or heating up significantly (Yellow/Red). It allows you to distinguish between steady, standard trading and sudden bursts of high-intensity participation.
//+------------------------------------------------------------------+
//| Normalized Volume Oscillator v2.mq4 |
//| Vadim Shumiloff |
//| shumiloff@mail.ru |
//| ICQ 84796634 |
//+------------------------------------------------------------------+
#property copyright "Vadim Shumiloff"
#property link "shumiloff@mail.ru"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Blue // Çàêðàñêà îòðèöàòåëüíûõ áàðîâ
#property indicator_color2 Green // Çàêðàñêà áàðîâ 0 - 38.2
#property indicator_color3 Lime // Çàêðàñêà áàðîâ 38.2 - 61.8
#property indicator_color4 Yellow // Çàêðàñêà áàðîâ 61.8 - 100
#property indicator_color5 Red // Çàêðàñêà áàðîâ ñâûøå 100
#property indicator_width1 2
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 2
/*
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 VolBufferH1[];
double VolBufferH2[];
double VolBufferH3[];
double VolBufferH4[];
double VolBufferH5[];
double Buffer[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
string short_name;
IndicatorBuffers(5);
SetIndexBuffer(0,VolBufferH1);
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,VolBufferH1);
SetIndexDrawBegin(0, VolumePeriod);
SetIndexBuffer(1,VolBufferH2);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,VolBufferH2);
SetIndexDrawBegin(1, VolumePeriod);
SetIndexBuffer(2,VolBufferH3);
SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexBuffer(2,VolBufferH3);
SetIndexDrawBegin(2, VolumePeriod);
SetIndexBuffer(3,VolBufferH4);
SetIndexStyle(3,DRAW_HISTOGRAM);
SetIndexBuffer(3,VolBufferH4);
SetIndexDrawBegin(3, VolumePeriod);
SetIndexBuffer(4,VolBufferH5);
SetIndexStyle(4,DRAW_HISTOGRAM);
SetIndexBuffer(4,VolBufferH5);
SetIndexDrawBegin(4, VolumePeriod);
short_name="NVO ("+VolumePeriod+")";
IndicatorShortName(short_name);
SetIndexLabel(0,short_name);
ArrayResize(Buffer,Bars);
ArrayInitialize(Buffer,0);
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int i,limit;
double nvo;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
if(counted_bars==0) limit--;
ArrayResize(Buffer,Bars);
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) nvo=NormalizeDouble((Buffer[i]/d)*100-100,4);
if(nvo<0)
VolBufferH1[i]=nvo;
else
{
if(nvo<38.2)
VolBufferH2[i]=nvo;
else
{
if(nvo<61.8)
VolBufferH3[i]=nvo;
else
{
if(nvo<100)
{
VolBufferH4[i]=nvo;
}
else VolBufferH5[i]=nvo;
}
}
}
}
return(0);
}
//+------------------------------------------------------------------+
Comments