#### J007RMC

##### Active member

**2019 Donor**

**VIP**

Gaussian Laguerre that works on mobile finally.

Applied Gaussian RSI Laguerre to AlphaInvestors input selectable Volatility Measure

Gaussian Filtered Price and Volatility RSI in Laguerre Time

Applied Gaussian RSI Laguerre to AlphaInvestors input selectable Volatility Measure

Gaussian Filtered Price and Volatility RSI in Laguerre Time

Code:

```
# Mobius Gaussian RSI Laguerre
# Nube applied Gaussian RSI Laguerre to AlphaInvestors input selectable Volatility Measure
# Gaussian Filtered Price and Volatility RSI in Laguerre Time
# 4.24.18
# https://tos.mx/hbY7BG
# Correct poor alternate aggregation logic - now works on mobile
# 4.24.18
# https://tos.mx/OCPIDa
# IV now recursive
# 4.25.18
declare lower;
input length = 4;
input whichVix = {default "VixFix", "ATR", "IV"};
input altVixAgg = no;
input VixAgg = AggregationPeriod.Five_Min;
input Cloud = no;
input Alerts = yes;
def na = Double.NaN;
# Mobius Gaussian Filter
# Nube changed to use length input as a filter length setting
script p {
input data = close;
input length = 20;
def w = (2 * Double.Pi / length);
def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / length) - 1);
def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
def a = Power(alpha, 4) * data + 4 * (1 - alpha) * a[1] - 6 * Power(1 - alpha, 2) * a[2] + 4 * Power(1 - alpha, 3) * a[3] - Power(1 - alpha, 4) * a[4];
plot line = a;
}
def o = p(open, length);
def h = p(high, length);
def l = p(low, length);
def c = p(close, length);
def aggregation = if altVixAgg
then VixAgg
else GetAggregationPeriod();
def vo = p(open(period = aggregation), Length = Length);
def vl = p(low(period = aggregation), Length = Length);
def vh = p(high(period = aggregation), Length = Length);
def vc = p(close(period = aggregation), Length = Length);
# Sometimes impl_volatility data is voidish
def ImpliedVol = if !IsNaN(imp_volatility(period = aggregation))
then imp_volatility(period = aggregation)
else ImpliedVol[1];
def Vix;
switch (whichVix) {
case "VixFix":
Vix = (Highest(vc, length) - vl) / (Highest(vc, length));
case "ATR":
Vix = Average(TrueRange(vh, vc, vl), length);
case "IV":
Vix = ImpliedVol;
}
# Mobius Fractal Energy Equation
def gamma = Log(Sum(Max(h, c[1]) - Min(l, c[1]), length) /
(Highest(h, length) - Lowest(l, length))) /
Log(length);
# end Mobius Fractal Energy Equation
# RSI in Laguerre Time Self Adjusting With Fractal Energy
# Mobius
# V02.07.2014
# Variables:
def CU1;
def CU2;
def CU;
def CD1;
def CD2;
def CD;
def L0;
def L1;
def L2;
def L3;
plot RSI;
# Calculations
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(CreateColor(225, 225, 175));
def vCU1;
def vCU2;
def vCU;
def vCD1;
def vCD2;
def vCD;
def vL0;
def vL1;
def vL2;
def vL3;
plot vRSI;
# Calculations
vL0 = (1 – gamma) * Vix + gamma * vL0[1];
vL1 = -gamma * vL0 + vL0[1] + gamma * vL1[1];
vL2 = -gamma * vL1 + vL1[1] + gamma * vL2[1];
vL3 = -gamma * vL2 + vL2[1] + gamma * vL3[1];
if vL0 >= vL1
then {
vCU1 = vL0 - vL1;
vCD1 = 0;
} else {
vCD1 = vL1 - vL0;
vCU1 = 0;
}
if vL1 >= vL2
then {
vCU2 = vCU1 + vL1 - vL2;
vCD2 = vCD1;
} else {
vCD2 = vCD1 + vL2 - vL1;
vCU2 = vCU1;
}
if vL2 >= vL3
then {
vCU = vCU2 + vL2 - vL3;
vCD = vCD2;
} else {
vCU = vCU2;
vCD = vCD2 + vL3 - vL2;
}
vRSI = if vCU + vCD <> 0 then vCU / (vCU + vCD) else 0;
vRSI.SetDefaultColor(CreateColor(225, 125, 125));
AddCloud(If(Cloud, RSI, na), vRSI,
CreateColor(40, 100, 40), CreateColor(120, 40, 40));
Alert(Alerts && RSI crosses below vRSI,
" Cross Below ", Alert.ONCE, Sound.Chimes);
Alert(Alerts && RSI crosses above vRSI,
" Crosses Above ", Alert.ONCE, Sound.Chimes);
# f/ Gaussian Filtered Price and Volatility RSI in Laguerre Time
```

Last edited: