#TickLaguerre-ACS1
Download scriptThis technical indicator is designed to provide traders with a smoothed visual representation of market momentum, specifically utilizing the Laguerre RSI logic. Unlike standard indicators that might react too quickly or stay too sluggish, this tool aims to balance responsiveness with stability to help identify overbought and oversold conditions more clearly.
How the Logic Works
The indicator operates through a multi-step mathematical process to transform raw price data into a readable momentum line:
1. Price Averaging and Smoothing The script begins by looking at the current market price (the average of the Ask and Bid prices). It applies a "Gamma" factor—a user-adjustable setting—to calculate a series of moving components. Think of this as a sophisticated weighting system where the tool remembers previous price states to ensure that sudden, erratic price spikes don't cause the indicator to jump erratically.
2. Momentum Calculation (Laguerre Logic) The core of the script involves calculating four distinct components ($L0$ through $L3$). These components interact with each other to determine the "velocity" of the market. By comparing these values against one another, the script determines whether the momentum is currently moving upward or downward. It calculates the cumulative difference between these movements to derive a specialized RSI (Relative Strength Index).
3. Final Smoothing (Moving Average) To make the data even more reliable for visual analysis, the script applies an additional layer of smoothing known as a Moving Average (MA). This acts as a secondary filter, "rounding off" any remaining minor fluctuations in the momentum line. It ensures that the final line shown on your chart represents the consistent trend rather than momentary noise.
Visual Interpretation
The indicator is displayed in a separate window and typically moves between the values of 0 and 1. Based on the predefined levels:
- Overbought/Oversold Zones: The tool features specific threshold levels (such as 0.85 and 0.15). When the momentum line reaches these extremes, it suggests that the market may be stretched in one direction and could be due for a reversal.
- Trend Identification: By observing the slope of the line, traders can see if the current momentum is accelerating or decelerating.
Summary of Key Inputs
- Gamma: Controls the sensitivity. Adjusting this changes how "heavy" or "light" the indicator reacts to new price changes.
- MaxBars: Determines how much historical data the script processes.
- MA: Sets the final smoothing period; a higher number results in a smoother, slower line, while a lower number makes it more responsive to immediate changes.
//+------------------------------------------------------------------+
//| Laguerre.mq4 |
//| Emerald King |
//| mailto:info@emerald-king.com |
//+------------------------------------------------------------------+
// Modified and simplified by ACS. 03-Oct-07. Added MA for Laguerre! 25-Oct-07. This code was released on 21-JUL-08 in FF.
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_minimum 0
#property indicator_maximum 1
#property indicator_width1 2
#property indicator_level1 0.85
#property indicator_level2 0.50
#property indicator_level3 0.15
//---- input parameters
extern double gamma=0.6;
extern int MaxBars=1000;
extern int MA = 2;
int LastTm;
double L0 = 0, L1 = 0, L2 = 0, L3 = 0, L0A = 0, L1A = 0, L2A = 0, L3A = 0, LRSI = 0, CU = 0, CD = 0;
double Buffer1[], dummy[];
//+------------------------------------------------------------------+
int init() {
IndicatorDigits(2);
IndicatorBuffers(2);
SetIndexBuffer(0,Buffer1);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(1,dummy);
//SetIndexStyle(1,DRAW_LINE);
SetIndexEmptyValue(1,0.5);
SetIndexStyle(1,DRAW_NONE);
SetIndexLabel(1,NULL);
string shortname="Laguerre-ACS("+DoubleToStr(gamma,2); if (MA < 2) shortname = shortname+")"; else shortname = shortname+"-MA"+MA+")";
IndicatorShortName(shortname);
//SetIndexLabel(0,shortname+"-"+Period()+"M");
return(0); }
//+------------------------------------------------------------------+
int deinit() { return(0); }
//+------------------------------------------------------------------+
int start() {
int i,j;
double sum1=0;
sum1=0;
L0A = L0; L1A = L1; L2A = L2; L3A = L3;
L0 = (1 - gamma)*((Ask+Bid)/2) + 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);
if (LastTm < Time[0]) {
for (i = 0;i<1000;i++) {
dummy[i] = dummy[i+1];
Buffer1[i] = Buffer1[i+1];
}
LastTm = Time[0];
}
for(i=MaxBars-1;i>=0;i--) {
dummy[i+1] = dummy[i];
Buffer1[i+1] = Buffer1[i];
}
dummy[0] = LRSI;
if (MA < 2) Buffer1[0] = dummy[0]; else { for (j=0; j < 0+MA; j++) sum1 += dummy[j]; Buffer1[0] = sum1/MA; }
return(0);
}
//+------------------------------------------------------------------+
Comments