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"
You must be logged in to post a comment.
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"
hello Nicolas how can i get this indicator i tried copy and paste the code but i didn't work