Waddah_Attar_Trend
Download scriptThis indicator is designed to provide a visual representation of market momentum and trend direction by combining two distinct types of technical analysis. Instead of showing complex price lines on your main chart, it creates a dedicated histogram at the bottom of your screen to help you identify the strength and flow of the market.
How the Logic Works
The script functions by calculating two specific mathematical components of the current market:
- Trend Momentum: The tool first analyzes the "MACD" (Moving Average Convergence Divergence) indicator. It specifically looks at the rate of change between two different moving averages. This tells the script whether the price is accelerating upwards or downwards and how fast that movement is happening.
- Market Volatility/Range: Simultaneously, the tool looks at "Bollinger Bands." It measures the distance between the upper and lower boundaries of these bands. This provides a snapshot of the current market's volatility—essentially determining how much room the price has to move within its current range.
The Visual Output
By multiplying these two components together, the indicator produces a single value that represents both the direction and the power of the trend. This result is then displayed as a histogram:
- Positive Values (Green): When the math results in a positive number, it indicates an upward trend with significant momentum. The histogram will appear above the zero line in green.
- Negative Values (Red): When the math results in a negative number, it indicates a downward trend. The histogram will appear below the zero line in red.
Summary for Traders
Essentially, this script filters out the "noise" of the market by combining speed (Momentum) with space (Volatility). It allows you to see at a glance whether the current price movement is backed by strong underlying strength or if the trend is weakening. A tall histogram bar suggests a powerful move in that direction, while smaller bars may suggest a period of consolidation or cooling interest.
//+------------------------------------------------------------------+
//| Waddah_Attar_Trend.mq4 |
//| Copyright © 2007, Eng. Waddah Attar |
//| waddahattar@hotmail.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, Eng. Waddah Attar"
#property link "waddahattar@hotmail.com"
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
//----
double ind_buffer1[];
double ind_buffer2[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, 2);
SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, 2);
//----
SetIndexBuffer(0, ind_buffer1);
SetIndexBuffer(1, ind_buffer2);
//----
IndicatorShortName("Waddah Attar Trend");
Comment("copyright waddahwttar@hotmail.com");
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
Comment("");
//----
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
double Trend,Explo,val;
int limit, i, counted_bars = IndicatorCounted();
//----
if(counted_bars < 0)
return(-1);
//----
if(counted_bars > 0)
counted_bars--;
limit = Bars - counted_bars;
//----
for(i = limit - 1; i >= 0; i--)
{
Trend = (iMACD(NULL, 0, 20, 40, 9, PRICE_CLOSE, MODE_MAIN, i) -
iMACD(NULL, 0, 20, 40, 9, PRICE_CLOSE, MODE_MAIN, i + 1)) / Point;
Explo = (iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_UPPER, i) -
iBands(NULL, 0, 20, 2, 0, PRICE_CLOSE, MODE_LOWER, i)) / Point;
ind_buffer1[i] = 0;
ind_buffer2[i] = 0;
val=Trend*Explo;
if(val >= 0)
ind_buffer1[i] = val;
if(val < 0)
ind_buffer2[i] = val;
}
return(0);
}
//+------------------------------------------------------------------+
Comments