Waddah_Attar_BUY_SELL_Vol
Download scriptThis tool is designed to help traders visualize the underlying momentum of the market by analyzing trading volume in relation to price movement. Instead of just looking at how much volume was traded, it separates that volume into "Buying" and "Selling" forces to provide a clearer picture of who is currently in control of the market.
How the Logic Works
The script operates by scanning every individual one-minute price candle on your chart and categorizing the volume based on three specific scenarios:
- Bullish Movement: If the closing price of a candle is higher than the previous one, the tool treats the entire volume of that candle as "Buying Volume." This suggests that buyers are pushing the price upward.
- Bearish Movement: If the closing price of a candle is lower than the previous one, the tool treats the volume as "Selling Volume." This indicates that sellers are exerting downward pressure on the market.
- Neutral Movement: In the event that the price remains unchanged between two candles, the script intelligently splits the volume 50/50 between both buying and selling forces.
Visual Representation
The data is displayed in a separate window as a histogram using three distinct components:
- Buying Pressure (Green): This tracks the cumulative buildup of buying force.
- Selling Pressure (Red): This tracks the cumulative buildup of selling force.
- Net Momentum (Yellow): By adding the Buying and Selling values together, the tool creates a third indicator that represents the total combined intensity of the market activity.
Key Purpose for Traders
The primary goal of this logic is to help traders identify "market conviction." Rather than looking at price alone, which can sometimes be misleading, this script allows you to see if a price move is being backed by significant volume (strong conviction) or if it is happening on low participation. By observing the relationship between the Green and Red histograms, you can better gauge whether the bulls or the bears are currently dominating the trend.
//+------------------------------------------------------------------+
//| Waddah Attar Buy Sell Volume |
//| Copyright © 2007, ww.metaforex.net |
//| Waddah Attar www.metaforex.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, www.metaforex.net"
#property link "www.metaforex.net"
//----
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Yellow
//---- buffers
double P1;
double P2;
double P1Buffer[];
double P2Buffer[];
double P3Buffer[];
//----
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0, P1Buffer);
SetIndexBuffer(1, P2Buffer);
SetIndexBuffer(2, P3Buffer);
//----
SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 2);
SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, 2);
//----
IndicatorDigits(0);
Comment("Waddah Attar Buy Sell Volume www.metaforex.net");
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
Comment("");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i,ii;
static int pii=-1;
for(i = 0; i <iBars(Symbol(),PERIOD_M1) ; i++)
{
ii = iBarShift(Symbol(), Period(), iTime(Symbol(),PERIOD_M1,i), true);
//----
if (pii!=ii)
{
P1=0;
P2=0;
P1Buffer[ii]=0;
P2Buffer[ii]=0;
P3Buffer[ii]=0;
}
if (ii != -1)
{
if (iClose(Symbol(),PERIOD_M1,i)>iClose(Symbol(),PERIOD_M1,i+1))
{
P1 = P1+(iVolume(Symbol(),PERIOD_M1,i));
}
if (iClose(Symbol(),PERIOD_M1,i)<iClose(Symbol(),PERIOD_M1,i+1))
{
P2 = P2-(iVolume(Symbol(),PERIOD_M1,i));
}
if (iClose(Symbol(),PERIOD_M1,i)==iClose(Symbol(),PERIOD_M1,i+1))
{
P1 = P1+(iVolume(Symbol(),PERIOD_M1,i)/2);
P2 = P2-(iVolume(Symbol(),PERIOD_M1,i)/2);
}
}
P1Buffer[ii]=P1;
P2Buffer[ii]=P2;
P3Buffer[ii]=P1+P2;
pii=ii;
}
//----
return(0);
}
Comments