Q(VolumeNorm_High)
Download scriptThis tool is designed as a specialized visual indicator for the MetaTrader platform, primarily focused on analyzing trading volume in relation to price movement. Rather than simply showing how much volume is traded, it attempts to normalize and interpret that volume to provide more clarity on market momentum.
Core Logic and Functionality
1. Price-Volume Normalization The script starts by calculating a specific value based on the relationship between the high price, the opening price, and the total volume of a given candle. By subtracting the opening price from the high price and dividing it by the volume (multiplied by a customizable scaling factor), the indicator identifies how much "effort" is being exerted to move the price at specific moments.
2. Trend Smoothing (Moving Average) To filter out erratic market noise, the script applies a Moving Average calculation to the normalized data described above. This creates a "Signal Line." By smoothing the raw data, the tool helps identify the underlying direction of the volume-driven momentum rather than reacting to every minor price fluctuation.
3. Dynamic Visual Segmentation (Histogram) The most distinct feature of this script is how it visually organizes the data into two separate histograms:
- Positive Momentum: When the calculated value is positive, the tool highlights the data in one visual format (the first histogram).
- Negative Momentum: When the calculated value drops below zero, the logic automatically switches the display to a second histogram.
This binary separation allows a trader to quickly distinguish between periods of upward-leaning momentum and downward-leaning momentum at a glance.
Summary for the User
Essentially, this script takes raw market volume and "normalizes" it against price action. It then filters that information through a moving average to create a steady signal line. Finally, it separates the results into two distinct visual histograms, allowing you to see clearly when the volume-to-price relationship shifts from one direction to another.
//+------------------------------------------------------------------+
//| 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]= ((High[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