ADX_AdvancedX_WA_mtf_v1
Download scriptThis tool is designed to provide traders with a clear visual representation of market momentum and the strength of price trends. By utilizing the Average Directional Index (ADX)—a standard technical analysis metric—the script filters out market noise to help identify which direction the current trend is moving.
Core Functionality
The primary purpose of this indicator is to distinguish between bullish (upward) and bearish (downward) momentum. Instead of showing a single overlapping line, it separates these movements into two distinct visual components:
- Bullish Momentum: When the upward pressure in the market exceeds the downward pressure, the tool highlights the trend strength in green.
- Bearish Momentum: When the downward pressure outweighs the upward movement, the tool reflects that trend strength in red.
By splitting these forces, the indicator allows you to see at a glance whether the current market "strength" is being driven by buyers or sellers.
Multi-Timeframe Analysis
One of the standout features of this script is its ability to perform Multi-Timeframe (MTF) analysis. This means that even if you are looking at a small, fast-moving chart (like a 1-minute chart), the tool can calculate and display trend data from much larger perspectives, such as the Hourly, Daily, or Weekly charts.
This is particularly useful for traders who want to ensure that their short-term trades are aligned with the "big picture" of the overall market direction. The logic automatically handles these calculations behind the scenes, ensuring the data remains synchronized with your current view.
Visual Indicators and Thresholds
The indicator provides several visual aids to assist in decision-making:
- Histogram Bars: Rather than a continuous line, the data is presented as bars, making it easier to see the volume of momentum at specific points in time.
- Reference Levels: The tool includes specific horizontal threshold levels (20 and 30). These serve as benchmarks; generally, when the trend strength rises above these levels, it indicates that a trend is becoming sufficiently strong to potentially act upon.
Summary for the User
In short, this script acts as a "trend filter." It tells you not just how much the market is moving, but in which direction that movement is gaining power. By combining multi-timeframe capabilities with clear color-coded visuals, it helps traders stay on the right side of the market trend while filtering out insignificant price fluctuations.
//+------------------------------------------------------------------+
//| ADX_Advanced_WA.mq4 |
//| Copyright © 2006, Eng. Waddah Attar |
//| mtf 2007forextsd.com keris ki waddahattar@hotmail.com |
//+------------------------------------------------------------------+
#property copyright "Waddah Attar"
#property link "waddahattar@hotmail.com"
//----
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_style1 0
#property indicator_width1 2
#property indicator_style2 0
#property indicator_width2 2
#property indicator_level1 20
#property indicator_level2 30
#property indicator_levelcolor DodgerBlue
//----
extern int ADXPeriod = 14; //wa13
extern int MaxBarsToCount =1500;
extern int TimeFrame = 0;
extern string note_TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-currentTF";
//----
double ExtBuffer1[];
double ExtBuffer2[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0, ExtBuffer1);
SetIndexStyle(0, DRAW_HISTOGRAM);
//----
SetIndexBuffer(1, ExtBuffer2);
SetIndexStyle(1, DRAW_HISTOGRAM);
//----
switch(TimeFrame)
{
case 1: string TimeFrameStr = "M1"; break;
case 5 : TimeFrameStr = "M5"; break;
case 15 : TimeFrameStr = "M15"; break;
case 30 : TimeFrameStr = "M30"; break;
case 60 : TimeFrameStr = "H1"; break;
case 240 : TimeFrameStr = "H4"; break;
case 1440 : TimeFrameStr = "D1"; break;
case 10080 : TimeFrameStr = "W1"; break;
case 43200 : TimeFrameStr = "MN1"; break;
default : TimeFrameStr = "TF 0";
}
IndicatorShortName("ADX_Adv ("+ADXPeriod+") ["+TimeFrameStr+"]");
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
double ADX0,ADX1,ADX2;
if(counted_bars < 0)
return(-1);
if(counted_bars > 0)
counted_bars--;
//----
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit= Bars-counted_bars;
limit= MathMax(limit,TimeFrame/Period());
limit= MathMin(limit,MaxBarsToCount);
//----
for(i=0,y=0;i<limit;i++)
{
if (TimeFrame<Period()) TimeFrame=Period();
if (Time[i]<TimeArray[y]) y++;
ADX0 = iADX(NULL, TimeFrame, ADXPeriod, PRICE_CLOSE, MODE_MAIN, y);
ADX1 = iADX(NULL, TimeFrame, ADXPeriod, PRICE_CLOSE, MODE_PLUSDI, y);
ADX2 = iADX(NULL, TimeFrame, ADXPeriod, PRICE_CLOSE, MODE_MINUSDI, y);
//----
if(ADX1 >= ADX2)
{
ExtBuffer1[i] = ADX0;
ExtBuffer2[i] = 0;
}
else
{
ExtBuffer1[i] = 0;
ExtBuffer2[i] = ADX0;
}
}
return(0);
}
//+------------------------------------------------------------------+
Comments