Author: mladen
All_ADX

This tool is designed to provide traders with a comprehensive, multi-timeframe view of market momentum and trend strength in a single visual window. Rather than looking at just the current price action, it gathers data from several different time horizons simultaneously to help identify broader market trends.

Core Functionality

The script utilizes the ADX (Average Directional Index), which is a standard technical indicator used to measure the strength of a trend. It specifically tracks three components:

  • ADX: The overall strength of the trend (regardless of direction).
  • +DI: The upward momentum of the market.
  • -DI: The downward momentum of the market.

How it Works for the User

Instead of showing you a single line for your current chart, this script automatically pulls and organizes data from up to seven different timeframes (ranging from short-term views like M1/M5 to long-term views like Weekly or Monthly, depending on your settings).

Key features include:

  • Multi-Timeframe Synthesis: The tool scans multiple timeframes at once. This allows you to see if a "bullish" move on a 15-minute chart is supported by the larger trends on the Hourly or Daily charts, helping to filter out "fake" signals.
  • Dynamic Scaling: To keep the visual interface clean, the script automatically calculates the highest and lowest values across all gathered timeframes. It then anchors the visual elements within this range so that data from different periods can be compared side-by-side without overlapping or cluttering the screen.
  • Visual Organization: The tool places text labels on your chart to identify which line belongs to which timeframe (e.g., "H1", "D1"). It uses specific visual markers to separate these timeframes, making it easy to distinguish between a short-term spike and a long-term trend shift.
  • Customizable Visibility: You can choose whether to focus on short-term fluctuations (M1 through D1) or higher-level trends (M15 through Monthly). It also includes an option to "shift" the data slightly to the right, which can be helpful for traders who prefer to see the data with a small buffer from the current live price candle.

Summary of Benefit

By consolidating these various timeframes into one window, the script removes the need to constantly flip between different charts. It provides a "big picture" perspective, allowing you to see how momentum is evolving across the entire market structure at a single glance.

Indicators Used
Movement directional index
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
All_ADX
//+------------------------------------------------------------------+
//|                                                      All ADX.mq4 |
//|                                                           mladen |
//+------------------------------------------------------------------+
#property copyright   "mladen"
#property link        ""
#define indicatorName "All ADX"
//----
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Gold
#property indicator_color2 Green
#property indicator_color3 Red
//---- input parameters
extern int    ADXPeriod           =14;
extern bool   showHigherTimeframes=true;
extern int    barsPerTimeFrame    =35;
extern bool   shiftRight          =False;
extern color  txtColor            =Silver;
extern color  separatorColor      =DimGray;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
//----
string shortName;
string labelsShort[] ={"M1","M5","M15","M30","H1","H4","D1"};
string labelsLong[]  ={"M15","M30","H1","H4","D1","W1","MN1"};
string labels[];
int    periodsShort[]={PERIOD_M1,PERIOD_M5,PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1};
int    periodsLong[] ={PERIOD_M15,PERIOD_M30,PERIOD_H1,PERIOD_H4,PERIOD_D1,PERIOD_W1,PERIOD_MN1};
int    periods[];
int    Shift;
double minValue;
double maxValue;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   barsPerTimeFrame=MathMax(barsPerTimeFrame,30);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
   //----
   if (shiftRight) Shift=1;
   else            Shift=0;
   SetIndexShift(0,Shift*(barsPerTimeFrame+1));
   SetIndexShift(1,Shift*(barsPerTimeFrame+1));
   SetIndexShift(2,Shift*(barsPerTimeFrame+1));
   //----
   SetIndexLabel(0,"ADX");
   SetIndexLabel(1,"+DI");
   SetIndexLabel(2,"-DI");
   shortName=indicatorName+" ("+ADXPeriod+")";
   IndicatorShortName(shortName);
     if (showHigherTimeframes) 
     {
      ArrayCopy(labels,labelsLong);
      ArrayCopy(periods,periodsLong);
     }
     else  
     {
      ArrayCopy(labels,labelsShort);
      ArrayCopy(periods,periodsShort);
     }
   //----
   for(int i=1;i<7;i++)
      if (Period()==periods[i])
        {
         string tmpLbl=labels[i];
         int    tmpPer=periods[i];
         //----
         for(int k=i ;k>0; k--)
           {
            labels[k] =labels[k-1];
            periods[k]=periods[k-1];
           }
         labels[0] =tmpLbl;
         periods[0]=tmpPer;
        }
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   for(int l=0;l<7;l++)
     {
      ObjectDelete(indicatorName+l);
      ObjectDelete(indicatorName+l+1);
     }
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   string on;
   int    wn=WindowFind(shortName);
   int    k=0;
   //----
   minValue= 999999;
   maxValue=-999999;
   for(int p=0; p<7;p++)
     {
      for(int i=0; i<barsPerTimeFrame;i++,k++)
        {
         ExtMapBuffer1[k] =iADX(NULL,periods[p],ADXPeriod,PRICE_CLOSE,0,i);
         ExtMapBuffer2[k] =iADX(NULL,periods[p],ADXPeriod,PRICE_CLOSE,1,i);
         ExtMapBuffer3[k] =iADX(NULL,periods[p],ADXPeriod,PRICE_CLOSE,2,i);
         checkMinMax(k);
        }
      ExtMapBuffer1[k] =EMPTY_VALUE;
      ExtMapBuffer2[k] =EMPTY_VALUE;
      ExtMapBuffer3[k] =EMPTY_VALUE;
      k+=1;
      //----
      on=indicatorName+p;
      if(ObjectFind(on)==-1)
         ObjectCreate(on,OBJ_TREND,wn,0,0);
      ObjectSet(on,OBJPROP_TIME1,myTime(k-Shift*(barsPerTimeFrame+1)-1));
      ObjectSet(on,OBJPROP_TIME2,myTime(k-Shift*(barsPerTimeFrame+1)-1));
      ObjectSet(on,OBJPROP_COLOR ,separatorColor);
      ObjectSet(on,OBJPROP_WIDTH ,2);
      on=indicatorName+p+1;
      if(ObjectFind(on)==-1)
         ObjectCreate(on,OBJ_TEXT,wn,0,0);
      ObjectSet(on,OBJPROP_TIME1,myTime(k-Shift*(barsPerTimeFrame+1)-6));
      ObjectSetText(on,labels[p],9,"Arial",txtColor);
     }
   for(p=0; p<7;p++)
     {
      on=indicatorName+p;
      ObjectSet(on,OBJPROP_PRICE1,minValue*1.05);
      ObjectSet(on,OBJPROP_PRICE2,maxValue);
      on=indicatorName+p+1;
      ObjectSet(on,OBJPROP_PRICE1,(minValue+maxValue)/2);
     }
   //----
   for(p=0; p<7;p++)
     {
      on=indicatorName+p;
      ObjectSet(on,OBJPROP_PRICE1,maxValue);
      ObjectSet(on,OBJPROP_PRICE2,minValue);
      on=indicatorName+p+1;
      ObjectSet(on,OBJPROP_PRICE1,maxValue);
     }
   //----
   SetIndexDrawBegin(0,Bars-k);
   SetIndexDrawBegin(1,Bars-k);
   SetIndexDrawBegin(2,Bars-k);
   return(0);
  }
//+------------------------------------------------------------------+
//+ Custom functions and procedures                                  +
//+------------------------------------------------------------------+
void checkMinMax(int shift)
  {
   double tmpMin;
   double tmpMax;
//----
   tmpMin=MathMin(ExtMapBuffer1[shift],ExtMapBuffer2[shift]);
   tmpMin=MathMin(ExtMapBuffer3[shift],tmpMin);
   tmpMax=MathMax(ExtMapBuffer1[shift],ExtMapBuffer2[shift]);
   tmpMax=MathMax(ExtMapBuffer3[shift],tmpMax);
   minValue=MathMin(tmpMin,minValue);
   maxValue=MathMax(tmpMax,maxValue);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int myTime(int a)
  {
   if(a<0)
      return(Time[0]+Period()*60*MathAbs(a));
   else  return(Time[a]);
  }
//+------------------------------------------------------------------+

Comments