[unknown]
Hej - en snabb översättning här - har ej testat dock - men du kan ju se hur funkar:
(se inställning L0, L1, L2, L3, globala dataserier)
// Laguerre RSI
local alpha = 0.2;
local LaRSI = 0;
// L0, L1, L2, L3 -> Global dataseries
local gamma = 1.0 - alpha;
// Laguerre-filter
L0[0] = (1 - gamma) * Close[0] + gamma * L0[-1];
L1[0] = -gamma * L0[0]+ L0[-1] + gamma * L1[-1];
L2[0] = -gamma * L1[0]+ L1[-1] + gamma * L2[-1];
L3[0] = -gamma * L2[0]+ L2[-1] + gamma * L3[-1];
// Uppgångar och nedgångar
local cu = 0;
if (L0 > L1) cu = cu + (L0 - L1);
if (L1 > L2) cu = cu + (L1 - L2);
if (L2 > L3) cu = cu + (L2 - L3);
local cd = 0;
if (L0 < L1) cd = cd + (L1 - L0);
if (L1 < L2) cd = cd + (L2 - L1);
if (L2 < L3) cd = cd + (L3 - L2);
// RSI-beräkning
if (cu + cd != 0)
LaRSI = cu / (cu + cd)
else
LaRSI = 0;
// Summering
plot1[0] = LaRSI * 100.0;
//plot2[0] = 20; // Lower Threshold
//plot2[0] = 80; // Upper Threshold