Speed_WABSV
Download scriptThis tool is designed to provide traders with a visual representation of market sentiment by analyzing the relationship between price movement and trading volume. Instead of just looking at how high or low the price goes, it focuses on the "effort" behind the price—essentially trying to determine if buyers or sellers are currently dominating the market.
How the Logic Works
The script operates by scanning through one-minute price data to build a cumulative picture of market activity. It categorizes every single transaction into three distinct scenarios based on how the price moved compared to the previous candle:
- Bullish Activity (Buying Pressure): If the price closes higher than it did in the previous candle, the script identifies this as buying pressure. It takes the volume from that period and adds it to a positive tally.
- Bearish Activity (Selling Pressure): If the price closes lower than the previous candle, the script identifies this as selling pressure. It takes that volume and subtracts it from the total calculation.
- Neutral Activity: In instances where the price remains unchanged (flat), the script treats the volume as a split, distributing half of the activity to the buyers and half to the sellers.
Visual Representation
The data is then processed to create three distinct visual components in a separate window on your trading chart:
- Positive Momentum: A histogram representing the accumulated buying strength.
- Negative Momentum: A histogram representing the accumulated selling strength.
- Net Sentiment: A final calculation that combines both the buying and selling totals to show the overall "net" balance of the market.
Purpose for the Trader
By using this logic, traders can see more than just a price line. It helps to identify whether a move in price is being backed by significant volume (indicating a strong trend) or if the market is experiencing indecision. It effectively separates the "noise" of the market from the actual weight of the buying and selling forces at play.
//+------------------------------------------------------------------+
//| 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);
SetIndexEmptyValue(0,0);
SetIndexBuffer(1, P2Buffer);
SetIndexEmptyValue(1,0);
SetIndexBuffer(2, P3Buffer);
SetIndexEmptyValue(2,0);
//----
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++)
i=iBars(Symbol(),PERIOD_M1);
while(i>=0)
{
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;
P1Buffer[ii]-=P1Buffer[ii+1];
P2Buffer[ii]-=P2Buffer[ii+1];
P3Buffer[ii]-=P3Buffer[ii+1];
i--;
}
//----
return(0);
}
Comments