Laguerre MinusDi_v1

Download script
Author: Copyright � 2005
Laguerre MinusDi_v1

This indicator is designed to provide traders with a visual representation of market momentum by blending specific technical analysis concepts into a single, smoothed reading. It functions by analyzing price movements over a defined period to determine the relative strength and direction of the trend.

Core Mechanics

The logic operates through three primary stages:

1. Data Input and Filtering The tool begins by looking at the "Minus Directional Indicator" (MINUSDI), which is a common metric used to measure the presence of downward price pressure. Instead of using this data raw—which can be volatile and jumpy—the script applies a smoothing mathematical filter known as a Laguerre formula. This filter helps reduce market "noise," allowing the user to see the underlying trend more clearly without being distracted by minor, insignificant price flickers.

2. Multi-Layered Smoothing The script creates four distinct layers of data (referred to as L0 through L3). Each layer is calculated based on the previous layer's value combined with the smoothed market data. By layering these calculations, the indicator gains a "memory" of recent price action. This prevents the indicator from reacting too aggressively to single price candles, ensuring that the final output represents a more stable and reliable trend flow.

3. Momentum Calculation Once the four layers are established, the tool compares them against one another to calculate the cumulative difference between upward and downward movements (Upward and Downward components). It then takes these two components and converts them into a ratio.

How to Interpret the Result

The final output is expressed as a percentage-like value (ranging primarily between 0 and 1). This tells the user the current "balance" of market momentum:

  • Higher Values: Indicate stronger upward momentum relative to downward pressure.
  • Lower Values: Indicate stronger downward momentum relative to upward pressure.

By combining directional data with multi-layered smoothing, this tool aims to provide a clearer view of where the market's strength lies, helping traders identify trend direction more effectively than using standard, un-smoothed indicators.

Indicators Used
Movement directional index
18 Views
0 Downloads
0 Favorites
Laguerre MinusDi_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+--------------------------------------------------------------------------+
//| Laguerre MinusDi.mq4                                                     |
//| Emerald King / transport_david                                           |
//| http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/ |
//+--------------------------------------------------------------------------+
#property copyright "Copyright © 2005"
#property link      "http://finance.groups.yahoo.com/group/MetaTrader_Experts_and_Indicators/"

#property indicator_separate_window
#property indicator_minimum -0.05
#property indicator_maximum 1.05
#property indicator_color1 Red
#property indicator_level2 0.75
#property indicator_level3 0.50
#property indicator_level4 0.25
//---- input parameters
extern double periods=14;
extern double timeperiods=0;
extern double gamma=0.764;
extern int CountBars=300;

double L0 = 0;
double L1 = 0;
double L2 = 0;
double L3 = 0;
double L0A = 0;
double L1A = 0;
double L2A = 0;
double L3A = 0;
double LRSI = 0;
double CU = 0;
double CD = 0;

double val1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
      
int init()
  {
//---- indicators
//----
   SetIndexBuffer(0,val1);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   if (CountBars>Bars) CountBars=Bars;
   SetIndexDrawBegin(0,Bars-CountBars);
   
   int i;
   int    counted_bars=IndicatorCounted();

   //if(CountBars<=Lookback) return(0);
   //---- initial zero
   //if(counted_bars<1)
   //{
   //   for(i=1;i<=Lookback;i++) val1[CountBars-i]=0.0;
   //}

   i=CountBars-1;
   while(i>=0)
   {
      L0A = L0;
      L1A = L1;
      L2A = L2;
      L3A = L3;
      L0 = ((1 - gamma)*iADX(NULL,timeperiods,periods,PRICE_LOW,MODE_MINUSDI,i)) + gamma*L0A;
      L1 = ((- gamma *L0) + L0A) + (gamma *L1A);
      L2 = ((- gamma *L1) + L1A) + (gamma *L2A);
      L3 = ((- gamma *L2) + L2A) + (gamma *L3A);

      CU = 0;
      CD = 0;
      
      if (L0 >= L1) CU = L0 - L1; else CD = L1 - L0;
      if (L1 >= L2) CU = CU + L1 - L2; else CD = CD + L2 - L1;
      if (L2 >= L3) CU = CU + L2 - L3; else CD = CD + L3 - L2;

      if (CU + CD != 0) LRSI = CU / (CU + CD);
      val1[i] = LRSI;
	  i--;
	}
   return(0);
 }
//+------------------------------------------------------------------+

Comments