The Laguerre filter is a mathematical filter used to have a better idea of price direction while denoising it. It were made by John Ehlers. Everything can be denoised by applying this filter, from oscillator like RSI to any others trend indicators. This one is only for price purpose, so I think that someone can adapt it for other things of interest of the community.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
//parameters : //length = 20 //Elements = 5 Price = (High+Low+Open+Close)/4 Diff = ABS(Price - Filt[1]) HH = Diff LL = Diff FOR count = 0 TO Length - 1 IF Diff[count] > HH THEN HH = Diff[count] ENDIF IF Diff[count] < LL THEN LL = Diff[count] ENDIF NEXT If Barindex > Length AND HH - LL <> 0 THEN Calcul = (Diff - LL) / (HH - LL) // Calculate MEDIAN with 5 Elements. Vary at will Data = Calcul NrElements = Elements FOR X = 0 TO NrElements-1 M = Data[X] SmallPart = 0 LargePart = 0 FOR Y = 0 TO NrElements-1 IF Data[Y] < M THEN SmallPart = SmallPart + 1 ELSIF Data[Y] > M THEN LargePart = LargePart + 1 ENDIF IF LargePart = SmallPart AND Y = NrElements-1 THEN Median = M BREAK ENDIF NEXT NEXT alpha = Median L0 = alpha*Price + (1 - alpha)*L0[1] L1 = -(1 - alpha)*L0 + L0[1] + (1 - alpha)*L1[1] L2 = -(1 - alpha)*L1 + L1[1] + (1 - alpha)*L2[1] L3 = -(1 - alpha)*L2 + L2[1] + (1 - alpha)*L3[1] FILT = (L0 + 2*L1 + 2*L2 + L3) / 6 ENDIF IF Barindex < 1 THEN FILT = Price ENDIF RETURN Filt AS "Laguerre1" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Buenos dias, m’he descargado el indicador pero no me aparece en el precio. Tengo la versión 11, habrá algún problema de compatibilidad? Muchas grácias.
Buenas tardes, para la versión 12 tiene un par de errores por lo que no se puede ejecutar , alguien que lo tenga solucionado? Muchas gracias
https://www.prorealcode.com/topic/error-al-anadir-el-indicador-laguerre-filter-on-price-en-plataforma/#post-228907