Back to TS code links
Laguerre RSI from John Ehlers
Back to Ehlers links


Anyone using information or codes on these pages does so at their own risk - no guarantees of stability or profitability are claimed. These codes are all for testing purposes only.

{Laguerre RSI (four elements) - //// From 'Cybernetic Analysis for Stocks and Futures' by John Ehlers //// code compiled by dn}
// the mmillar-compiled filter below displays exactly the same as above but calls the ocillators function.

// plot in the price region

Input: Dampen(.5);
Var: L0(0), L1(0), L2(0), L3(0), CU(0), CD(0), RSI(0);

L0=(1-Dampen)*Close+Dampen*L0[1];
L1=-Dampen*L0+L0[1]+Dampen*L1[1];
L2=-Dampen*L1+L1[1]+Dampen*L2[1];
L3=-Dampen*L2+L2[1]+Dampen*L3[1];
CU=0; CD=0;
If L0>=L1 then CU = L0-L1 Else CD = L1-L0;
If L1>=L2 then CU=CU+L1-L2 Else CD=CD+L2-L1;
If L2>=L3 then CU=CU+L2-L3 Else CD=CD+L3-L2;
If CU+CD<>0 then RSI=CU/(CU+CD);
Plot1(RSI,"RSI",Blue); Plot2(.8,"UpperLine",yellow); Plot3(.2,"LowerLine",yellow);

{Note: This RSI is calculated over Laguerre time rather than regular time.
This is a time-warped RSI which causes the excursions typically to be lock to lock
Time-warped indicators react faster because a shorter amount data is used.
The Laguerre filter can also be used to decrease the reaction time of other indicators.
The "Dampen" factor - suggested setting .5 - can be adjusted to suit your data.
}

{BELOW Laguerre RSI From the book 'Cybernetic Analysis for Stocks and Futures' by John Ehlers
compiled by mmillar, July 2004
- this filter displays the same as above but calls the ocillators function.
vGamma - set the gamma for the Laguerre filter
}
{
Inputs: vGamma(0.5);
Vars: oResult1(0), oResult2(0);
value1=_Oscillators(15, 0, 0, vGamma, 1, 0, 1, oResult1, oResult2);
Plot11(oResult1, "LaguerreRSI",green);
Plot12(oResult2, "Trigger",red);
}