Nicolas

Laguerre ROC (Rate Of Change)

Category: Indicators By: Nicolas Created: November 16, 2016, 10:07 AM
November 16, 2016, 10:07 AM
Indicators
4 Comments
Laguerre ROC (Rate Of Change)

This indicator code apply a Laguerre filter to the Rate Of Change of price within the last “vPeriod”.

It could be assimilated as a Relative Strength Index (RSI) oscillator because of use of price difference of the ROC formula.

Since a Laguerre filter is used to filter market noises, this oscillator better react to the price change than a typical RSI. The oscillator is made to spot the center of the price, for mean reverting purpose (trade market overbought and oversold levels) or trend change with the middle level crosses (level 50 for this technical oscillator).

 

//PRC_Laguerre ROC | indicator
//16.11.2016
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from Metatrader4 version

// --- parameters
// vPeriod = 5
// gamma = 0.5

L0A = L0
L1A = L1
L2A = L2
L3A = L3

if barindex>vPeriod then
 rROC = (((Close - Close[vPeriod]) / Close[vPeriod]) + Pointsize)
 L0 = ((1 - gamma)*(rROC)) + (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) then
  CU = L0 - L1
 else
  CD = L1 - L0
 endif
 if (L1 >= L2) then
  CU = CU + L1 - L2
 else
  CD = CD + L2 - L1
 endif
 if (L2 >= L3) then
  CU = CU + L2 - L3
 else
  CD = CD + L3 - L2
 endif

 if (CU + CD <> 0) then
  LROC = CU / (CU + CD)
 endif
endif

RETURN LROC as "Laguerre ROC", 0 as "0 level", 0.25 as "0.25 level", 0.5 as "0.5 level", 0.75 as "0.75 level", 1 as "1 level"

 

Download
Filename: PRC_LaguerreROC.itf
Downloads: 278
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

besho
6 years ago
#

hello Nicolas how can i get this indicator i tried copy and paste the code but i didn't work

CarlosFC
10 years ago
#

 Thanks a lot Nicolas.

I posted it.

Carlos.

CarlosFC
10 years ago
#

Hello Nicolas,

I would like to ask you about another indicator derivated from ROC and that I am sure you know, the Smoothed Rate of Change, developped by Fred G. Schutzman and mentioned by Alexander Elder in" Trading for a living". I looked in different places but it seems they're using not exactly the same formula to calculate it. I am using bellow's one. Is it correct?

Many thankd in advance.

Carlos.

media=ExponentialAverage[13](close)
Signal=ROC[21](close)
ROCAL=signal/media*100
Return ROCAL as "ROC Alisado"

 

Nicolas
10 years ago
#

I don't know really, just like you I found a lot of different formulas there and there on the internet. You can open a new request in the probuilder section of the forum and we will investigate and centralize informations there, thank you.

 

ProRealCode ProRealCode
Loading...