Author: Kalenzo
Alert_DMI

This tool is designed to provide traders with real-time notifications regarding specific shifts in market momentum. It works by analyzing the Directional Movement Index (DMI), a common technical analysis framework used to determine whether a market is trending and in which direction.

How it Works

The script focuses on two primary components of the DMI: the Plus Directional Indicator (+DI) and the Minus Directional Indicator (-DI). These two lines represent the strength of upward price movement versus downward price movement, respectively.

Rather than just looking at the current values, the logic compares the behavior of these indicators between the most recent completed data point and the current live price action.

The Core Logic: "The Crossover"

The primary purpose of this script is to identify a Crossover Event. This occurs when the two indicators switch their relative positions—meaning the lead changes from one direction to another.

  • Bullish Shift: If the Plus DI was previously below the Minus DI but moves above it, the tool identifies a potential shift toward upward momentum.
  • Bearish Shift: If the Plus DI was previously above the Minus DI but moves below it, the tool identifies a potential shift toward downward momentum.

Action and Notification

Every time the script detects one of these "crosses" occurring on the live chart, it triggers an immediate pop-up alert on your trading platform. This allows you to react instantly to changes in market direction without having to manually watch the charts for every small movement.

In summary, this is a momentum-tracking alert system that notifies you the moment the trend's "lead" switches from positive to negative or vice versa.

Indicators Used
Movement directional index
Miscellaneous
It issuies visual alerts to the screen
9 Views
0 Downloads
0 Favorites
Alert_DMI
//+------------------------------------------------------------------+
//|                                                    Alert_DMI.mq4 |
//|                                                          Kalenzo |
//|                                      bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link      "bartlomiej.gorski@gmail.com"
extern int period = 14;
extern int applied_price = PRICE_CLOSE;

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   
//----
   double dip = iADX(Symbol(),0,period,applied_price,MODE_PLUSDI,0);
   double dim = iADX(Symbol(),0,period,applied_price,MODE_MINUSDI,0);
   double pdip = iADX(Symbol(),0,period,applied_price,MODE_PLUSDI,1);
   double pdim = iADX(Symbol(),0,period,applied_price,MODE_MINUSDI,1); 
   
   if((pdip >= pdim && dip < dim) || (pdip <= pdim && dip > dim) )
   Alert(Symbol()+" DMI CROSS");
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments