Advanced_ADX_WithAlert

Download script
Author: Waddah Attar
Advanced_ADX_WithAlert

Overview of the Advanced ADX Indicator

The Advanced ADX is a specialized technical analysis tool designed to help traders identify market trends and momentum by filtering price action into clear visual signals. Unlike standard indicators that might show a cluttered view of all market movements, this script focuses on distinguishing between bullish (upward) and bearish (downward) strength.

How the Logic Works

The core functionality of this script relies on analyzing three specific components of the Average Directional Index (ADX). While a standard ADX measures the overall strength of a trend, this tool looks deeper by comparing two internal sub-components:

  • The Plus Directional Indicator (+DI): This tracks the intensity of upward price movement.
  • The Minus Directional Indicator (-DI): This tracks the intensity of downward price movement.
  • The Main ADX Line: This represents the overall "power" or velocity of the current trend.

Visual Representation and Filtering

The script processes these values in real-time to provide a simplified visual output on your chart:

  1. Trend Differentiation: The tool compares the Plus DI against the Minus DI at every moment.
    • If the upward momentum is stronger than the downward momentum, it highlights the trend strength using a green visual signal.
    • If the downward momentum becomes dominant, it shifts the visual focus to a red signal.
  2. Momentum Mapping: By displaying these results as a histogram in a separate window, the script allows you to see exactly when the market's "power" is shifting from one direction to another. It essentially clears out the "noise," showing you only the prevailing strength of the current move.

Automated Alerts

To ensure you don't miss critical shifts in market sentiment, the script includes an integrated notification system. When the logic detects a crossover—meaning the dominant direction has switched from bullish to bearish (or vice versa)—the script can trigger an audible alert. This allows traders to react immediately to changes in trend direction without needing to constantly watch the screen.

Summary for Traders

Essentially, this tool takes complex directional data and translates it into a binary visual cue: Green for upward pressure and Red for downward pressure. It tells you not just if the market is moving, but which side of the market holds the most power at any given time.

Indicators Used
Movement directional index
Miscellaneous
Implements a curve of type %1It plays sound alerts
16 Views
0 Downloads
0 Favorites
Advanced_ADX_WithAlert
//+------------------------------------------------------------------+
//|                                                 Advanced_ADX.mq4 |
//|                              Copyright © 2006, Eng. Waddah Attar |
//|                                          waddahattar@hotmail.com |
//|                                          alert by tcl            |
//+------------------------------------------------------------------+
#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;
extern bool alert_ON=true; // ON=true, OFF=false
//----
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;
           if(alert_ON)
           {
            PlaySound("alert.wav");   //  <<<<========
           }
         }
       else
         {
           ExtBuffer1[i] = 0;
           ExtBuffer2[i] = ADX0;
           if(alert_ON)
           {
             PlaySound("alert.wav");   //  <<<<========
           }
         }
     }
   return(0);
  }
//+------------------------------------------------------------------+

Comments