MTF_ADX_WildersDMI_v1m

Download script
Author: Copyright � 2007, TrendLaboratory Ltd.
MTF_ADX_WildersDMI_v1m

This tool is designed as a sophisticated technical analysis indicator for the MetaTrader platform. It provides traders with visual data regarding market trend strength and direction by pulling information from multiple timeframes simultaneously.

Core Functionality

The primary purpose of this script is "Multi-Timeframe" (MTF) analysis. Instead of only showing you what is happening on the specific chart you are currently viewing, this tool allows you to overlay data from higher timeframes (such as Daily or Weekly trends) onto your current smaller timeframe (like 5-minute or 1-hour charts). This helps traders see the "big picture" without having to constantly switch back and forth between different windows.

Key Data Components

The script visualizes four specific types of market information:

  • Trend Strength (ADX): It tracks the overall momentum of the market to help determine if a trend is strong or if the market is moving sideways.
  • Bullish/Bearish Direction (+DI and -DI): It separates the movement into two components—one representing upward pressure (buying) and one representing downward pressure (selling). This helps in identifying which side of the market currently holds the advantage.
  • Smoothed Momentum (ADXR): It provides a secondary, smoothed version of the trend data to help filter out "noise" or minor price fluctuations that might lead to false signals.

How it Works Internally

  1. Timeframe Synchronization: The script automatically aligns the data from the selected higher timeframe with your current chart's timeline. It ensures that the information stays synchronized as new candles form.
  2. Custom Calculations: It calls upon a specific mathematical model (Wilders DMI) to process price history. This specific method is known for its ability to provide smoother, more reliable trend readings compared to standard calculations.
  3. Visual Feedback: The results are plotted on a separate window in your trading platform. You can see these values interact as lines; when they cross or move away from certain levels (like the 20-level threshold), they provide visual cues about potential shifts in market behavior.

Practical Use

For a trader, this means you can stay on a fast-moving chart to find precise entries while simultaneously keeping an eye on the broader trend of the market. It simplifies complex data by consolidating multiple indicators and timeframes into one clear, cohesive visual display.

Miscellaneous
Implements a curve of type %1
18 Views
0 Downloads
0 Favorites
MTF_ADX_WildersDMI_v1m
//+------------------------------------------------------------------+
//|                                      MTF_WildersDMI_v1.mq4       |
//|                           Copyright © 2007, TrendLaboratory Ltd. |
//|            http://finance.groups.yahoo.com/group/TrendLaboratory |
//|              www.forex-tsd.com        E-mail: igorad2004@list.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, TrendLaboratory Ltd."
#property link      "http://finance.groups.yahoo.com/group/TrendLaboratory"

#property indicator_separate_window
#property indicator_buffers   4
#property indicator_color1    LightBlue
#property indicator_width1    2 
#property indicator_color2    Lime
#property indicator_width2    1
#property indicator_style2    2
#property indicator_color3    Tomato
#property indicator_width3    1
#property indicator_style3    2
#property indicator_color4    Orange
#property indicator_width4    2 
#property indicator_level1    20
//---- input parameters
extern int       TimeFrame    =  0;
extern int       MA_Length    =  1; // Period of additional smoothing 
extern int       DMI_Length   = 14; // Period of DMI
extern int       ADX_Length   = 14; // Period of ADX
extern int       ADXR_Length  = 14; // Period of ADXR
extern int       UseADX       =  1; // Use ADX: 0-off,1-on
extern int       UseADXR      =  1; // Use ADXR: 0-off,1-on
//---- buffers
double ExtMapBufferADX[];
double ExtMapBufferPDI[];
double ExtMapBufferMDI[];
double ExtMapBufferADXR[];
double sPDI[];
double sMDI[];
double STR[];
double DX[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
   IndicatorBuffers(8);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBufferADX);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBufferPDI);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBufferMDI);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ExtMapBufferADXR);
   //---- name for DataWindow and indicator subwindow label
   string short_name="MTF ADXWildersDMI("+MA_Length+","+DMI_Length+","+ADX_Length+","+ADXR_Length+";TF("+TimeFrame+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"MTF_ADX ("+ADX_Length+"("+TimeFrame+")");
   SetIndexLabel(1,"MTF_ADX+DI ("+ADX_Length+"("+TimeFrame+"");
   SetIndexLabel(2,"MTF_ADX-DI("+ADX_Length+"("+TimeFrame+"");
   SetIndexLabel(3,"MTF_ADXR("+ADXR_Length+"("+TimeFrame+"");
//----
   SetIndexDrawBegin(0,DMI_Length+MA_Length);
   SetIndexDrawBegin(1,DMI_Length+MA_Length);
   SetIndexDrawBegin(2,DMI_Length+MA_Length);
   SetIndexDrawBegin(3,DMI_Length+MA_Length);  
//---- name for DataWindow and indicator subwindow label
   switch(TimeFrame)
   {
      case 1 : string TimeFrameStr="Period_M1"; break;
      case 5 : TimeFrameStr="Period_M5"; break;
      case 15 : TimeFrameStr="Period_M15"; break;
      case 30 : TimeFrameStr="Period_M30"; break;
      case 60 : TimeFrameStr="Period_H1"; break;
      case 240 : TimeFrameStr="Period_H4"; break;
      case 1440 : TimeFrameStr="Period_D1"; break;
      case 10080 : TimeFrameStr="Period_W1"; break;
      case 43200 : TimeFrameStr="Period_MN1"; break;
      default : TimeFrameStr="Current Timeframe";
   }
   return(0);
}
//+------------------------------------------------------------------+
//| MTF                                                              |
//+------------------------------------------------------------------+
int start()
  {
   datetime TimeArray[];
   int    i,limit,y=0,counted_bars=IndicatorCounted();
 
// Plot defined time frame on to current time frame
   ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame); 
   limit=Bars-counted_bars+TimeFrame/Period();
   for(i=0,y=0;i<counted_bars;i++)
   {
   if (Time[i]<TimeArray[y]) y++;

/***********************************************************   
   Add your main indicator loop below.  You can reference an existing
      indicator with its iName  or iCustom.
   Rule 1:  Add extern inputs above for all neccesary values   
   Rule 2:  Use 'TimeFrame' for the indicator time frame
   Rule 3:  Use 'y' for your indicator's shift value
 **********************************************************/  
 
  ExtMapBufferADX [i]=iCustom(NULL,TimeFrame,"ADX_WildersDMI_v1m",MA_Length,DMI_Length,ADX_Length,ADXR_Length,0,y) ; 
  ExtMapBufferPDI [i]=iCustom(NULL,TimeFrame,"ADX_WildersDMI_v1m",MA_Length,DMI_Length,ADX_Length,ADXR_Length,1,y) ; 
  ExtMapBufferMDI [i]=iCustom(NULL,TimeFrame,"ADX_WildersDMI_v1m",MA_Length,DMI_Length,ADX_Length,ADXR_Length,2,y) ;    
  ExtMapBufferADXR[i]=iCustom(NULL,TimeFrame,"ADX_WildersDMI_v1m",MA_Length,DMI_Length,ADX_Length,ADXR_Length,3,y) ;    
   }  
   return(0);
  }
//+------------------------------------------------------------------+



Comments