Advanced_ADX_v1

Download script
Author: Waddah Attar
Advanced_ADX_v1

This tool is designed to provide traders with a visual representation of market momentum and the prevailing direction of price movement. Rather than just showing raw data, it simplifies complex technical indicators into a clear, color-coded visual format that helps identify who is currently in control of the market: the buyers or the sellers.

Core Logic and Functionality

The script operates by analyzing three primary components of the ADX (Average Directional Index) indicator. While the standard ADX measures the overall strength of a trend, this specific tool breaks down that strength into two directional components:

  1. Positive Momentum (Buyers): Represented by the "Plus" directional move.
  2. Negative Momentum (Sellers): Represented by the "Minus" directional move.

By comparing these two forces against each other in real-time, the script determines which side is currently dominating the price action.

How it Works on Your Chart

Instead of showing multiple overlapping lines that can clutter your screen, the script uses a histogram format to present a "winner-takes-all" visual:

  • Bullish Signal (Green): When the upward momentum (buyers) is stronger than the downward momentum (sellers), the indicator displays a green histogram. This suggests that the current trend has a bullish bias.
  • Bearish Signal (Red): When the downward momentum (sellers) overtakes the upward momentum, the indicator switches to a red histogram. This indicates that the current trend has a bearish bias.

Key Benefits for Traders

The primary goal of this logic is clarity. By filtering out the "noise" of standard indicators and focusing only on the dominant direction, it allows you to:

  • Identify Trend Direction at a Glance: Quickly see if the market is leaning toward the upside or downside without having to interpret complex overlapping lines.
  • Filter Market Noise: The script focuses on the strength of the trend, helping traders avoid entering positions in markets that lack clear directional conviction.
  • Simplify Decision Making: By providing a binary visual (Green for Bullish / Red for Bearish), it serves as a secondary confirmation tool to help align your trades with the prevailing market sentiment.
Indicators Used
Movement directional index
Miscellaneous
Implements a curve of type %1
12 Views
0 Downloads
0 Favorites
Advanced_ADX_v1
//+------------------------------------------------------------------+
//|                                                 Advanced_ADX.mq4 |
//|                              Copyright © 2006, Eng. Waddah Attar |
//|                                          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
//----
extern int ADXPeriod = 13;
//----
double ExtBuffer1[];
double ExtBuffer2[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexBuffer(0, ExtBuffer1);
   SetIndexStyle(0, DRAW_HISTOGRAM, 0, 2);
//----
   SetIndexBuffer(1, ExtBuffer2);
   SetIndexStyle(1, DRAW_HISTOGRAM, 0, 2);
//----
   IndicatorShortName("Advanced_ADX (" + ADXPeriod + ")");
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   int i, limit;
   double ADX0,ADX1,ADX2;
   int counted_bars = IndicatorCounted();
   if(counted_bars < 0) 
       return(-1);
   if(counted_bars > 0) 
       counted_bars--;
   limit = Bars - counted_bars; 
//----   
   for(i = 0; i < limit ; i++)
     {
       ADX0 = iADX(NULL, 0, ADXPeriod, PRICE_CLOSE, MODE_MAIN, i);
       ADX1 = iADX(NULL, 0, ADXPeriod, PRICE_CLOSE, MODE_PLUSDI, i);
       ADX2 = iADX(NULL, 0, ADXPeriod, PRICE_CLOSE, MODE_MINUSDI, i);
       //----
       if(ADX1 >= ADX2)
         {
           ExtBuffer1[i] = ADX0;
           ExtBuffer2[i] = 0;
         }
       else
         {
           ExtBuffer1[i] = 0;
           ExtBuffer2[i] = ADX0;
         }
     }
   return(0);
  }
//+------------------------------------------------------------------+

Comments