Hull_Style_ADX_v3

Hull_Style_ADX_v3

The Hull_Style_ADX_v3 is a custom technical analysis tool designed to provide traders with a smoother, more responsive view of market trends and strength. It modifies the standard Average Directional Index (ADX) logic—a popular indicator used to determine if a market is trending or moving sideways—by applying specific mathematical refinements to reduce "noise" and lag.

Core Functionality

The primary goal of this script is to take raw market data and transform it into four distinct visual components that help identify the direction and intensity of price movements:

  • Trend Strength & Smoothing (ADX Modes): The tool calculates a base trend strength but applies a unique smoothing technique. By combining different timeframes of the ADX calculation, it aims to capture immediate momentum while filtering out minor market fluctuations that often lead to "false signals" in standard indicators.
  • Directional Momentum (Plus-Di and Minus-Di): The script tracks two specific components: the upward momentum (Plus-Di) and the downward momentum (Minus-Di). By modifying these as well, the tool provides a clearer picture of which side of the market is currently dominant.

How it Works for the Trader

Instead of looking at the raw, jagged lines of a standard ADX, this script processes the data through several layers:

  1. Data Input: It looks at specific price points (such as the close, open, high, or low) to determine market movement.
  2. Dynamic Calculation: It calculates the difference between short-term and long-term directional movements.
  3. Refined Smoothing: It applies a specialized moving average (specifically using the Linear Weighted Method by default) to the results. This "Hull-style" approach is designed to make the indicator move more fluidly with the price, ensuring that you see the trend change as it happens without the significant delay often found in traditional tools.

Visual Output

The indicator appears in a separate window below your main chart. It provides four distinct lines:

  • ADX Mode 0 & 1: These represent the refined trend strength and smoothed momentum.
  • Plus-Di & Minus-Di: These show the individual strengths of upward and downward pressure, respectively.

By providing these smoother, more reactive lines, the tool helps traders identify high-probability trend entries and stay in profitable positions longer by clearly defining when a trend is gaining strength or beginning to lose its grip.

Indicators Used
Movement directional indexMoving average indicator
Miscellaneous
Implements a curve of type %1
14 Views
0 Downloads
0 Favorites
Hull_Style_ADX_v3
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                            Hull_Style_ADX_v3.mq4 |
//+------------------------------------------------------------------+

//---- indicator settings

#property  indicator_separate_window

#property  indicator_buffers 4

#property  indicator_color1  White
#property  indicator_color2  LightSeaGreen
#property  indicator_color3  LimeGreen
#property  indicator_color4  Red

//---- indicator parameters

extern int ADX_Period           =  7;
extern int PlusDiMinusDi_Period = 14;
extern int Applied_Price        =  0; // 0 Close , 1 Open , 2 High , 3 Low , 4 Median , 5 Typical , 6 Weighted
extern int LineWidth            =  1;
extern int Ma_Of_Adx            =  8;
extern int MaOfAdx_Shift        =  0;
extern int Ma_Method            =  3; // 0 sma, 1 ema, 2 smma, 3 lwma

//---- indicator buffers

double MaBuffer[];

double adxbuffer[];

double plusdibuffer[];

double minusdibuffer[];

int    draw_begin0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+

int init()
 {

//---- indicator buffers mapping
  
//---- drawing settings
  
  draw_begin0 = ADX_Period+MathFloor(MathSqrt(ADX_Period));
  
  SetIndexEmptyValue(0,0.0000);
  SetIndexStyle(0,DRAW_LINE,STYLE_DOT,LineWidth);
  SetIndexBuffer(0,MaBuffer);
  SetIndexLabel(0,"ADX mode 0");
  SetIndexDrawBegin(0,draw_begin0);
  
  SetIndexEmptyValue(1,0.0000);
  SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,LineWidth);
  SetIndexBuffer(1,adxbuffer);
  SetIndexLabel(1,"ADX mode 1");
  SetIndexDrawBegin(1,draw_begin0);
  
  SetIndexEmptyValue(2,0.0000);
  SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,LineWidth);
  SetIndexBuffer(2,plusdibuffer);
  SetIndexLabel(2,"Plus-Di mode 2");
  SetIndexDrawBegin(2,draw_begin0);
  
  SetIndexEmptyValue(3,0.0000);
  SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,LineWidth);
  SetIndexBuffer(3,minusdibuffer);
  SetIndexLabel(3,"Minus-Di mode 3");
  SetIndexDrawBegin(3,draw_begin0);
  
//---- name for DataWindow and indicator subwindow label
  
  IndicatorShortName("Hull_Style_ADX_v3("+ADX_Period+")");
  
//---- initialization done
  return(0);
 }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

int start()
 {
  int limit,i,shift;
  int counted_bars=IndicatorCounted();

//---- check for possible errors
  if(counted_bars<1)
   {
     for(i=1;i<=draw_begin0;i++) { MaBuffer[Bars-i]=0; adxbuffer[Bars-i]=0; plusdibuffer[Bars-i]=0; minusdibuffer[Bars-i]=0; }
   }

//---- last counted bar will be recounted
  if(counted_bars>0) counted_bars--;
  limit=Bars-counted_bars;

//-----------------------------------------------------------------------------------------------------------------
  
  for(i=0; i<limit; i++)
    { adxbuffer[i] = (iADX(Symbol(),0,MathFloor(ADX_Period/2),Applied_Price,MODE_MAIN,i)*2)
                        - iADX(Symbol(),0,ADX_Period,Applied_Price,MODE_MAIN,i); }
  for(i=0; i<limit; i++)
    { MaBuffer[i] = iMAOnArray(adxbuffer,0,Ma_Of_Adx,MaOfAdx_Shift,Ma_Method,i); }
  
//-----------------------------------------------------------------------------------------------------------------
  
  for(i=0; i<limit; i++)
    { plusdibuffer[i] = (iADX(Symbol(),0,MathFloor(PlusDiMinusDi_Period/2),Applied_Price,MODE_PLUSDI,i)*2)
                           - iADX(Symbol(),0,PlusDiMinusDi_Period,Applied_Price,MODE_PLUSDI,i); }

//-----------------------------------------------------------------------------------------------------------------
  
  for(i=0; i<limit; i++)
    { minusdibuffer[i] = (iADX(Symbol(),0,MathFloor(PlusDiMinusDi_Period/2),Applied_Price,MODE_MINUSDI,i)*2)
                            - iADX(Symbol(),0,PlusDiMinusDi_Period,Applied_Price,MODE_MINUSDI,i); }

//-----------------------------------------------------------------------------------------------------------------

//---- done
  return(0);
 }

Comments