In this indicator I have modified the Laguerre to show only momentum and have removed divergence. It only shows TrendUp/TrendDown as a Red/Green Squared Histogram. Here is the code:
Code:
# RSI-Laguerre Self Adjusting With Fractal Energy Gaussian Price Filter # Mobius # V01.12.2016
# Both Fractal Energy and RSI are plotted. RSI in cyan and FE in yellow. Look for trend exhaustion in the FE and a reversal of RSI or Price compression in FE and an RSI reversal.
# Rename Study to RSILg_FE_Gssn1 for compatability with Scanning
#Modieied by C. Ricks 5-2-23 to remove divergence and only show flow. I also made this into a squared.Histogram showing only Red/Green forceIndex Short/Long
script ModifiedLaguerre {
declare lower;
#Inputs:
input nFE = 13;#hint nFE: length for Fractal Energy calculation.
# Variables:
def o;
def h;
def l;
def c;
def CU1;
def CU2;
def CU;
def CD1;
def CD2;
def CD;
def L0;
def L1;
def L2;
def L3;
plot RSI;
plot OS;
plot OB;
# Calculations
o = (open + close[1]) / 2;
h = Max(high, close[1]);
l = Min(low, close[1]);
c = (o + h + l + close) / 4;
plot gamma = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE) /
(Highest(high, nFE) - Lowest(low, nFE)))
/ Log(nFE);
gamma.Hide();
L0 = (1 – gamma) * c + gamma * L0[1];
L1 = -gamma * L0 + L0[1] + gamma * L1[1];
L2 = -gamma * L1 + L1[1] + gamma * L2[1];
L3 = -gamma * L2 + L2[1] + gamma * L3[1];
if L0 >= L1
then {
CU1 = L0 - L1;
CD1 = 0;
} else {
CD1 = L1 - L0;
CU1 = 0;
}
if L1 >= L2
then {
CU2 = CU1 + L1 - L2;
CD2 = CD1;
} else {
CD2 = CD1 + L2 - L1;
CU2 = CU1;
}
if L2 >= L3
then {
CU = CU2 + L2 - L3;
CD = CD2;
} else {
CU = CU2;
CD = CD2 + L3 - L2;
}
RSI = if CU + CD <> 0 then CU / (CU + CD) else 0;
RSI.SetDefaultColor(Color.CYAN);
OS = if IsNaN(close) then Double.NaN else 0.2;
OS.HideBubble();
OS.HideTitle();
OB = if IsNaN(close) then Double.NaN else 0.8;
OB.HideBubble();
OB.HideTitle();
plot FEh = if IsNaN(close) then Double.NaN else .618;
FEh.HideBubble();
FEh.HideTitle();
plot FEl = if IsNaN(close) then Double.NaN else .382;
FEl.HideBubble();
FEl.HideTitle();
}
declare lower;
input nFE = 13;
plot SignalB = if IsNaN (ModifiedLaguerre(nFE).RSI) then Double.NaN else 1;
SignalB.DefineColor("DOWN", Color.RED);
SignalB.DefineColor("TRENDDOWN", Color.RED);
SignalB.DefineColor("TRENDUP", Color.Green);
SignalB.DefineColor("UP", Color.GREEN);
SignalB.SetLineWeight(1);
SignalB.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
SignalB.AssignValueColor(if ModifiedLaguerre(nFE).RSI > 0.800 then
SignalB.Color("UP")
else if ModifiedLaguerre(nFE).RSI < 0.200 then
SignalB.Color("DOWN")
else if ModifiedLaguerre(nFE).RSI > 0.200 and ModifiedLaguerre(nFE).RSI[1] < ModifiedLaguerre(nFE).RSI then
SignalB.Color("TRENDUP")
else if ModifiedLaguerre(nFE).RSI < 0.800 and ModifiedLaguerre(nFE).RSI[1] > ModifiedLaguerre(nFE).RSI then
SignalB.Color("TRENDDOWN")
else
SignalB.Color("TRENDDOWN"));
Last edited by a moderator: