RSI Laguerre with Fractal Energy for ThinkorSwim

thanks for the qucik reply @BenTen i did a google search but there are so many out there was wondering if there was one official by Mobius or replicated... I'll do a deeper dive.
 
thanks for the qucik reply @BenTen i did a google search but there are so many out there was wondering if there was one official by Mobius or replicated... I'll do a deeper dive.
@NickC I use the following for TradingView: Laguerre RSI by "The Lark" along with their built in Chop indicator.
Different math but same result. You can look them up on their site. Mobius won't waste his time on non-TOS scripts and never wrote one per my search.
 
RSI Line disappearing randomly: RSI_Laguerre With FE_AutoAdj_v2018_10_12_Mobius_JQvisuals indicator

Hi all,
I was hoping someone would be able to chk out this script and see if there would be any reason why the RSI line would randomly disappear.
I'm generally able to get it back but I have to offload the script and reload it into my studies.
Any help would be greatly appreciated!


Code:
## OneNote Archive Name: RSI_Laguerre With FE_AutoAdj_v2018_10_12_Mobius_JQvisuals

## Archive Section: 

## Suggested Tos Name: RSI_LaguerreWithFE_AutoAdj_v2018_10_12_Mobius_JQvisuals

## Archive Date: 5.15.2018

## Archive Notes: 

 

## "##" indicates an addition or adjustment by the OneNote Archivist

 

## Modified Code Follows

## 5.15.2018  JQ added code to permit user to disable bull and or bear alerts

## 5.19.2018  JQ added AddChartBubbble code on FE plot

## 9.19.2018  JQ added color to RSI Line 

##  10.9.2018 JQ added FE dots   

## 10.12.2018 JQ added takevaluecolor statements

 

# RSI in Laguerre Time Self Adjusting With Fractal Energy

# Mobius

# V03.06.15.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.

 

    ## Lounge Notes

#15:51 Mobius©: Short trade setup I look for with RSI Laguerre adjusted with FE. 

#1) Polarity Change - Equity has gone from making higher highs and higher lows to making a lower high and lower low and is now putting in another lower high 

#2) RSI Laguerrer is above .8 and descending from 1 

#3) Fractal Energy is below .38 and nose down or above .6 and rolling over. In the first case, below .38, FE is indicating trend exahustion and RSI is likely showing as a peak and not running across pegged at 1. In the second case Price has risen to a lower resistance and has been rolling slowly over building energy. 

 

#Mobius©: I use a very simple method – RSI Laguerre and Fractal Energy on a list of very liquid stocks. I look for polarity change and trade when both RSI and FE are in “confluence”. If volatility is high enough I sell spreads if not I buy them. Other than hedging (which I do a lot of) that's it. I like it simple. 

 

#The typical base setting I like to use for the FE is a length of 8. If I'm trading options I like to look at it about the length of time I'm buying or selling the option for. I want to know if it's reverting and where the energy is so I'll use a longer length for reversion and a shorter length to see if energy is building or waning. 

 

#If RSI Laguerre is descending and FE over .6, that tells me something is changing and I'm already looking at an equity I've determined is about to make a polarity change. So the worse case that happens is that the security grinds sideways for a few days. 

  

#A reading of the FE over .6 is an indication that energy has been built up. If the FE is high (over .6) and RSI LaGuerre is breaking lower FE will follow suit. If RSI reverses and goes above .8 I'm outa there, with the assumption I have a short position. 

  

#FE is a gauge of both mean reverting and linearity. Descending readings indicate a trend is on. A reading below .3 indicates exhaustion in trend or near exhaustion. A reading above .6 indicates moving sideways with rapid reversion and energy building for a move again. 

  

#Above .6 - Think price compression or squeeze 

#Below .3 - Think running out of gas 

  

    # Here's an example: 

#FE at 60 periods is oscillating around .5 tightly while FE at 8 periods is over .6. Zscore is over 2 and is starting to roll over. That is a good short to the mean. 

 

#Short trade setup I look for with RSI Laguerre adjusted with FE. 

 

#1) Polarity Change - Equity has gone from making higher highs and higher lows to making a lower high and lower low and is now putting in another lower high 

 

#2) RSI Laguerrer is above .8 and descending from 1 

 

#3) Fractal Energy is below .38 and nose down or above .6 and rolling over. In the first case, below .38, FE is indicating trend exahustion and RSI is likely showing as a peak and not running across pegged at 1. In the second case price has risen to a lower resistance and has been rolling slowly over building energy. 

 

 

declare lower;

 

    #Inputs: 

input RSI_BullishTrigger = .1;

input RSI_BearishTrigger = .9;

input soundBullAlerts = no; ## 5.15.2018 new code

input soundBearAlerts = no; ## 5.15.2018 new code

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.SetDefaultColor(Color.YELLOW);

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);  #JQ mobius oiginal code

# RSI Painting code by JQ 2018.07.30

RSI.AssignValueColor(

        if (RSI > RSI_BearishTrigger) or ((RSI >= RSI[1]) and (RSI > RSI_BullishTrigger))

            then Color.GREEN 

        else if (RSI < RSI_BullishTrigger) or ((RSI < RSI[1]) and (RSI < RSI_BearishTrigger))

            then Color.RED 

        else Color.WHITE);

RSI.SetLineWeight(2);

 

 

    # Plot fixed value horizontal lines

OS = if IsNaN(close) then Double.NaN else 0.2;

OS.SetDefaultColor(Color.GRAY);

OS.HideBubble();

OS.HideTitle();

OB = if IsNaN(close) then Double.NaN else 0.8;

OB.SetDefaultColor(Color.GRAY);

OB.HideBubble();

OB.HideTitle();

plot FEh = if IsNaN(close) then Double.NaN else .618;

FEh.SetStyle(Curve.LONG_DASH);

FEh.HideBubble();

FEh.SetDefaultColor(Color.DARK_GRAY);

FEh.HideTitle();

plot FEl = if IsNaN(close) then Double.NaN else .382;

FEl.SetStyle(Curve.LONG_DASH);

FEl.SetDefaultColor(Color.DARK_GRAY);

FEl.HideBubble();

FEl.HideTitle();

AddCloud(0, OS, Color.GREEN, Color.GREEN);

AddCloud(OB, 1, Color.RED, Color.RED);

Alert(soundBearAlerts and RSI crosses below .9, "", Alert.BAR, Sound.Ding); ## 5.15.2018 JQ added Boolean

Alert(soundBullAlerts and RSI crosses above .1, "", Alert.BAR, Sound.Ding) ;## 5.15.2018 JQ added Boolean

 

#  Labels below added by Johnny Quotron based on zztop notes above  2018-04-11

 

def FE = gamma;

#addlabel (FE < .382, " FE is Linear (Price Trending) = " + FE, Color.light_GREEN);

#addlabel (FE > .618, " FE is Non-Linear/Random (Trendless) = " + FE, Color.Light_GRAY);

#addlabel (FE <= .618 and FE >= .382, " FE is transitioning = " + FE, Color.Light_orange);

#AddChartBubble(!IsNaN(close) and IsNaN(close[-1]), FE, if FE < .382 then "Trending" else "Not Trending", Color.WHITE, yes);

#AddChartBubble(!IsNaN(close) and IsNaN(close[-1]), FE, if FE < .382 then "Trending" else if FE < .618 then "Transitioning" else "Building Energy", gamma.#takeValueColor(), yes); ## 5.19.2018 JQ

 

# End Code RSI_Laguerre Self Adjusting with Fractal Energy

 

 

 

 

# Fractal Linear Energy

# Mobius

# 5.16.2016

# zztop Notes

 

# This indicator does NOT indicate OB or OS but linear or non-linear

# The closer to 1 the more non-linear (compressed or random) price is. 

# The closer to 0 the more linear (trending) price is.

 

# Fractal Energy isn't an indicator - it's a way of looking at price 

# to see if it's linear or random. There are NO trading signals on the 

# FE study. Only signals NOT to trade. 

#

# If the FE is at extremes, something is about to change. It's leading

# you to a conclusion. If the FE is below .382, price is parabolic and 

# cannot maintain that. But you may not want to sell because it may 

# still go further in it's trend and it may not change direction right 

# away. It's telling you though that it's not going to stay trending 

# at the current rate of speed. If it's over .618 it telling you price 

# is compressing and going sideways rebuilding energy getting ready for 

# another run one way ot the other.

#

# Using price in fractals and different times, or ORB with FE and 

# supertrend or some way to measure when price expansion is contracting 

# or expanding is all you need. Any more than that and you'll be 

# paralyzed by information overload

#

# FE does not indicate direction at all. It simply shows linearity or 

# non-linearity. Trend or non-trend. It has nothing that determines 

# which way trend is going, as in up or down.

#

# Lets say you want to buy ABC company. FE on a monthly, weekly and daily 

# shows values of 40, 35 and 30. Price is showing lower lows but random 

# lower high. You would know ABC company is close to selling exhaustion 

# and it's time to look for a few higher highs to a near term fractal 

# pivot then look for short reversal to a higher low over the previous 

# recent low and when the bars start setting high highs and lower lows 

# again it's time to go long. The FE is what tells you to start looking 

# for those signals

 

def dot_nFE = nFE;

input valueFEnonlinear = 0.618;

input valueFElinear = .382;

 

    # dot plots

plot pointsLinear = if FE < valueFElinear

             then -.05 

             else Double.NaN;

pointsLinear.SetPaintingStrategy(PaintingStrategy.POINTS);

pointsLinear.SetLineWeight(2);

pointsLinear.SetDefaultColor(Color.CYAN);

 

plot BigpointsLinear = if FE < valueFElinear *.90

             then -.05 

             else Double.NaN;

BigpointsLinear.SetPaintingStrategy(PaintingStrategy.POINTS);

BigpointsLinear.SetLineWeight(5);

BigpointsLinear.SetDefaultColor(Color.CYAN);

 

plot pointsLinear2 = if FE < valueFElinear

             then 1.05 

             else Double.NaN;

pointsLinear2.SetPaintingStrategy(PaintingStrategy.POINTS);

pointsLinear2.SetLineWeight(2);

pointsLinear2.AssignValueColor(pointsLinear.TakeValueColor());

 

plot BigpointsLinear2 = if FE < valueFElinear * .90

             then 1.05 

             else Double.NaN;

BigpointsLinear2.SetPaintingStrategy(PaintingStrategy.POINTS);

BigpointsLinear2.SetLineWeight(5);

BigpointsLinear2.AssignValueColor(pointsLinear.TakeValueColor());

 

plot pointsNonLinear = if FE > valueFEnonlinear

             then -.05   

             else Double.NaN;

pointsNonLinear.SetPaintingStrategy(PaintingStrategy.POINTS);

pointsNonLinear.SetLineWeight(2);

pointsNonLinear.SetDefaultColor(Color.ORANGE);

 

plot BigpointsNonLinear = if FE > (valueFEnonlinear * 1.03)

             then -.05   

             else Double.NaN;

BigpointsNonLinear.SetPaintingStrategy(PaintingStrategy.POINTS);

BigpointsNonLinear.SetLineWeight(5);

BigpointsNonLinear.SetDefaultColor(Color.ORANGE);

 

plot pointsNonLinear2 = if FE > valueFEnonlinear

             then 1.05 

             else Double.NaN;

pointsNonLinear2.SetPaintingStrategy(PaintingStrategy.POINTS);

pointsNonLinear2.SetLineWeight(2);

pointsNonLinear2.AssignValueColor(pointsNonLinear.TakeValueColor());

 

plot BigpointsNonLinear2 = if FE > (valueFEnonlinear * 1.03)

             then 1.05 

             else Double.NaN;

BigpointsNonLinear2.SetPaintingStrategy(PaintingStrategy.POINTS);

BigpointsNonLinear2.SetLineWeight(5);

BigpointsNonLinear2.AssignValueColor(pointsNonLinear.TakeValueColor());

 

 

#AddLabel (yes, " Trend Exhaustion " , Color.YELLOW);

#AddLabel (yes, " Price Compression " , Color.CYAN);

 

#addChartBubble(BarNumber() == 1, -0.05, "Trend Exhaustion", pointslinear.takevaluecolor());

#addChartBubble(BarNumber() == 1, -0.05, "Price Compression",pointsNonLinear.takevaluecolor());

 

#addChartBubble( if FE == LowestAll(FE) then 1 else 0 , -0.05, "Trend Exhaustion", pointslinear.takevaluecolor());

#AddChartBubble( if FE == HighestAll(FE) then 1 else 0 , -0.05, "Price Compression", pointsNonLinear.TakeValueColor());

 

#def count1 = if barNumber() > 1 and FE < valueFElinear    # from Mobius in Chatroom

#             then compoundValue(1, count1[1] + 1, 1)

#             else count1[1];

#addChartBubble(count1 == 1, 0, "Linear", color.cyan, yes);

 

 

def count1 = if barNumber() > 1 and FE < valueFElinear

             then compoundValue(1, count1[1] + 1, 1)

             else count1[1];

addChartBubble(count1 == 2, -0.05, "Linear - Trend Exhaustion", color.cyan, yes);

 

def count2 = if barNumber() > 1 and FE > valueFENonlinear

             then compoundValue(1, count2[1] + 1, 1)

             else count2[1];

addChartBubble(count2 == 2, -0.05, " Non-Linear - Range Compression", color.orange, yes);

#addlabel(1,"valueFELinear: " + valueFElinear, color.WHITE);

#addlabel(1,"valueFENonLinear: " + valueFEnonlinear, color.WHITE);

#addlabel(1,"count1: " + count1, color.WHITE);

#addlabel(1,"count2: " + count2, color.WHITE);

 

 

# End of Fractal Linear Energy Dot Code
 
Hello Traders,

I've being observing very significant scalping patterns when I combined RSI Laguerre and TakeProfit. Just wondering if is possible to combine these two as one single indicator?
Kind regards
 
Hi, I had an idea for a watchlist column that turns green when the RSI Laguerre is greater than or equal to 0.9. Can someone help me code this? Here's the link for the RSI Laguerre thread: https://usethinkscript.com/threads/rsi-laguerre-with-fractal-energy-for-thinkorswim.116/

I tried giving it a go but I can't really code so I sorta pieced together some stuff from other watchlist columns I had. Here is what I have so far:

Code:
input nFE = 8;#hint nFE: length for Fractal Energy calculation.
input AlertOn = no;
input Glength  = 13;
input betaDev =  8;
input data = close;

def w = (2 * Double.Pi / Glength);
def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / betaDev) - 1 );
def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
def Go = Power(alpha, 4) * open +
             4 * (1 – alpha) * Go[1] – 6 * Power( 1 - alpha, 2 ) * Go[2] +
             4 * Power( 1 - alpha, 3 ) * Go[3] - Power( 1 - alpha, 4 ) * Go[4];
def Gh = Power(alpha, 4) * high +
             4 * (1 – alpha) * Gh[1] – 6 * Power( 1 - alpha, 2 ) * Gh[2] +
             4 * Power( 1 - alpha, 3 ) * Gh[3] - Power( 1 - alpha, 4 ) * Gh[4];
def Gl = Power(alpha, 4) * low +
             4 * (1 – alpha) * Gl[1] – 6 * Power( 1 - alpha, 2 ) * Gl[2] +
             4 * Power( 1 - alpha, 3 ) * Gl[3] - Power( 1 - alpha, 4 ) * Gl[4];
def Gc = Power(alpha, 4) * data +
             4 * (1 – alpha) * Gc[1] – 6 * Power( 1 - alpha, 2 ) * Gc[2] +
             4 * Power( 1 - alpha, 3 ) * Gc[3] - Power( 1 - alpha, 4 ) * Gc[4];
# 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;
plot M;

# Calculations
o = (Go + Gc[1]) / 2;
h = Max(Gh, Gc[1]);
l = Min(Gl, Gc[1]);
c = (o + h + l + Gc) / 4;
plot gamma = Log(Sum((Max(Gh, Gc[1]) - Min(Gl, Gc[1])), nFE) /
        (Highest(gh, nFE) - Lowest(Gl, nFE)))
            / Log(nFE);
gamma.SetDefaultColor(Color.Yellow);
L0 = (1 – gamma) * Gc + 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(c) then Double.NaN else 0.2;
OS.SetDefaultColor(Color.RED);
OS.HideBubble();
OS.HideTitle();
OB = if IsNaN(c) then Double.NaN else 0.8;
OB.SetDefaultColor(Color.GREEN);
OB.HideBubble();
OB.HideTitle();
M = if IsNaN(c) then Double.NaN else 0.5;
M.SetStyle(Curve.long_dash);
M.SetDefaultColor(Color.Gray);
M.HideBubble();
M.HideTitle();
plot FEh = if isNaN(c) then double.nan else .618;
FEh.SetStyle(Curve.short_DASH);
FEh.HideBubble();
FEh.SetDefaultColor(Color.GRAY);
FEh.HideTitle();
plot FEl = if isNaN(c) then double.nan else .382;
FEl.SetStyle(Curve.short_DASH);
FEl.SetDefaultColor(Color.GRAY);
FEl.HideBubble();
FEl.HideTitle();
AddCloud(0, OS, Color.RED, Color.RED);
AddCloud(OB, 1, Color.Green, Color.Green);

#My attempt
plot isTrue = if RSI >= 0.9 then 1 else 0;
AssignBackgroundColor(if RSI >= 0.9
                           then color.dark_green
                           else color.dark_red);


It says "at least one plot expected" in the error. Not sure what that means. I'd appreciate if someone could help me figure this out.
 
@fungus12 The error code is "Exactly one plot expected". Totally different, change the other plots to def.
I'm not sure what exactly you mean. Do you mean replace every "plot" variable with "def"? Just tried that but it didn't work. Also tried just replacing the "plot" in my code with "def" and that didn't work either.
 
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
# Adjusted for compatability with scanner based on Mobius' notes. 7-14-19 Markos

input nFE = 8;#hint nFE: length for Fractal Energy calculation.
input AlertOn = no;
input Glength  = 13;
input betaDev =  8;
input data = close;

def w = (2 * Double.Pi / Glength);
def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / betaDev) - 1 );
def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
def Go = Power(alpha, 4) * open +
             4 * (1 – alpha) * Go[1] – 6 * Power( 1 - alpha, 2 ) * Go[2] +
             4 * Power( 1 - alpha, 3 ) * Go[3] - Power( 1 - alpha, 4 ) * Go[4];
def Gh = Power(alpha, 4) * high +
             4 * (1 – alpha) * Gh[1] – 6 * Power( 1 - alpha, 2 ) * Gh[2] +
             4 * Power( 1 - alpha, 3 ) * Gh[3] - Power( 1 - alpha, 4 ) * Gh[4];
def Gl = Power(alpha, 4) * low +
             4 * (1 – alpha) * Gl[1] – 6 * Power( 1 - alpha, 2 ) * Gl[2] +
             4 * Power( 1 - alpha, 3 ) * Gl[3] - Power( 1 - alpha, 4 ) * Gl[4];
def Gc = Power(alpha, 4) * data +
             4 * (1 – alpha) * Gc[1] – 6 * Power( 1 - alpha, 2 ) * Gc[2] +
             4 * Power( 1 - alpha, 3 ) * Gc[3] - Power( 1 - alpha, 4 ) * Gc[4];
# 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;
def RSI;
def OS;
def OB;
def M;

# Calculations
o = (Go + Gc[1]) / 2;
h = Max(Gh, Gc[1]);
l = Min(Gl, Gc[1]);
c = (o + h + l + Gc) / 4;
def gamma = Log(Sum((Max(Gh, Gc[1]) - Min(Gl, Gc[1])), nFE) /
        (Highest(gh, nFE) - Lowest(Gl, nFE)))
            / Log(nFE);

L0 = (1 – gamma) * Gc + 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;

OS = if IsNaN(c) then Double.NaN else 0.2;

OB = if IsNaN(c) then Double.NaN else 0.8;

M = if IsNaN(c) then Double.NaN else 0.5;

def FEh = if isNaN(c) then double.nan else .618;

def FEl = if isNaN(c) then double.nan else .382;

AddCloud(0, OS, Color.RED, Color.RED);
AddCloud(OB, 1, Color.Green, Color.Green);

#My attempt
plot isTrue = if RSI >= 0.9 then 1 else 0;
AssignBackgroundColor(if RSI >= 0.9
                           then color.dark_green
                           else color.dark_red);
 
Last edited by a moderator:
Code:
input nFE = 8;#hint nFE: length for Fractal Energy calculation.
input AlertOn = no;
input Glength  = 13;
input betaDev =  8;
input data = close;

def w = (2 * Double.Pi / Glength);
def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / betaDev) - 1 );
def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
def Go = Power(alpha, 4) * open +
             4 * (1 – alpha) * Go[1] – 6 * Power( 1 - alpha, 2 ) * Go[2] +
             4 * Power( 1 - alpha, 3 ) * Go[3] - Power( 1 - alpha, 4 ) * Go[4];
def Gh = Power(alpha, 4) * high +
             4 * (1 – alpha) * Gh[1] – 6 * Power( 1 - alpha, 2 ) * Gh[2] +
             4 * Power( 1 - alpha, 3 ) * Gh[3] - Power( 1 - alpha, 4 ) * Gh[4];
def Gl = Power(alpha, 4) * low +
             4 * (1 – alpha) * Gl[1] – 6 * Power( 1 - alpha, 2 ) * Gl[2] +
             4 * Power( 1 - alpha, 3 ) * Gl[3] - Power( 1 - alpha, 4 ) * Gl[4];
def Gc = Power(alpha, 4) * data +
             4 * (1 – alpha) * Gc[1] – 6 * Power( 1 - alpha, 2 ) * Gc[2] +
             4 * Power( 1 - alpha, 3 ) * Gc[3] - Power( 1 - alpha, 4 ) * Gc[4];
# 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;
def RSI;
def OS;
def OB;
def M;

# Calculations
o = (Go + Gc[1]) / 2;
h = Max(Gh, Gc[1]);
l = Min(Gl, Gc[1]);
c = (o + h + l + Gc) / 4;
def gamma = Log(Sum((Max(Gh, Gc[1]) - Min(Gl, Gc[1])), nFE) /
        (Highest(gh, nFE) - Lowest(Gl, nFE)))
            / Log(nFE);

L0 = (1 – gamma) * Gc + 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;

OS = if IsNaN(c) then Double.NaN else 0.2;

OB = if IsNaN(c) then Double.NaN else 0.8;

M = if IsNaN(c) then Double.NaN else 0.5;

def FEh = if isNaN(c) then double.nan else .618;

def FEl = if isNaN(c) then double.nan else .382;

AddCloud(0, OS, Color.RED, Color.RED);
AddCloud(OB, 1, Color.Green, Color.Green);

#My attempt
plot isTrue = if RSI >= 0.9 then 1 else 0;
AssignBackgroundColor(if RSI >= 0.9
                           then color.dark_green
                           else color.dark_red);
Awesome. Thanks dude.
 
Anyone have a watchlist column for this indicator? I looked around this thread but didn't find one. Something that shows when the RSI Laguerre is above 0.8.
I have a watchlist column here if anyone is interested. All credit goes to @generic. It shows a "1" in green if an instrument has the RSI above 0.9. Feel free to change it to whatever you want.

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
# Adjusted for compatability with scanner based on Mobius' notes.  7-14-19 Markos
#
declare lower;
#

input nFE = 8;#hint nFE: length for Fractal Energy calculation.
input AlertOn = no;
input Glength  = 13;
input betaDev =  8;
input data = close;

def w = (2 * Double.Pi / Glength);
def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / betaDev) - 1 );
def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
def Go = Power(alpha, 4) * open +
             4 * (1 – alpha) * Go[1] – 6 * Power( 1 - alpha, 2 ) * Go[2] +
             4 * Power( 1 - alpha, 3 ) * Go[3] - Power( 1 - alpha, 4 ) * Go[4];
def Gh = Power(alpha, 4) * high +
             4 * (1 – alpha) * Gh[1] – 6 * Power( 1 - alpha, 2 ) * Gh[2] +
             4 * Power( 1 - alpha, 3 ) * Gh[3] - Power( 1 - alpha, 4 ) * Gh[4];
def Gl = Power(alpha, 4) * low +
             4 * (1 – alpha) * Gl[1] – 6 * Power( 1 - alpha, 2 ) * Gl[2] +
             4 * Power( 1 - alpha, 3 ) * Gl[3] - Power( 1 - alpha, 4 ) * Gl[4];
def Gc = Power(alpha, 4) * data +
             4 * (1 – alpha) * Gc[1] – 6 * Power( 1 - alpha, 2 ) * Gc[2] +
             4 * Power( 1 - alpha, 3 ) * Gc[3] - Power( 1 - alpha, 4 ) * Gc[4];
# 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;
def RSI;
def OS;
def OB;
def M;

# Calculations
o = (Go + Gc[1]) / 2;
h = Max(Gh, Gc[1]);
l = Min(Gl, Gc[1]);
c = (o + h + l + Gc) / 4;
def gamma = Log(Sum((Max(Gh, Gc[1]) - Min(Gl, Gc[1])), nFE) /
        (Highest(gh, nFE) - Lowest(Gl, nFE)))
            / Log(nFE);

L0 = (1 – gamma) * Gc + 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;

OS = if IsNaN(c) then Double.NaN else 0.2;

OB = if IsNaN(c) then Double.NaN else 0.8;

M = if IsNaN(c) then Double.NaN else 0.5;

def FEh = if isNaN(c) then double.nan else .618;

def FEl = if isNaN(c) then double.nan else .382;

AddCloud(0, OS, Color.RED, Color.RED);
AddCloud(OB, 1, Color.Green, Color.Green);

#Watchlist column
plot isTrue = if RSI >= 0.9 then 1 else 0;
AssignBackgroundColor(if RSI >= 0.9
                           then color.dark_green
                           else color.dark_red);
 
Last edited:
I have a watchlist column here if anyone is interested. All credit goes to @generic. It shows a "1" in green if an instrument has the RSI above 0.9. Feel free to change it to whatever you want.

Code:
input nFE = 8;#hint nFE: length for Fractal Energy calculation.
input AlertOn = no;
input Glength  = 13;
input betaDev =  8;
input data = close;

def w = (2 * Double.Pi / Glength);
def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / betaDev) - 1 );
def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
def Go = Power(alpha, 4) * open +
             4 * (1 – alpha) * Go[1] – 6 * Power( 1 - alpha, 2 ) * Go[2] +
             4 * Power( 1 - alpha, 3 ) * Go[3] - Power( 1 - alpha, 4 ) * Go[4];
def Gh = Power(alpha, 4) * high +
             4 * (1 – alpha) * Gh[1] – 6 * Power( 1 - alpha, 2 ) * Gh[2] +
             4 * Power( 1 - alpha, 3 ) * Gh[3] - Power( 1 - alpha, 4 ) * Gh[4];
def Gl = Power(alpha, 4) * low +
             4 * (1 – alpha) * Gl[1] – 6 * Power( 1 - alpha, 2 ) * Gl[2] +
             4 * Power( 1 - alpha, 3 ) * Gl[3] - Power( 1 - alpha, 4 ) * Gl[4];
def Gc = Power(alpha, 4) * data +
             4 * (1 – alpha) * Gc[1] – 6 * Power( 1 - alpha, 2 ) * Gc[2] +
             4 * Power( 1 - alpha, 3 ) * Gc[3] - Power( 1 - alpha, 4 ) * Gc[4];
# 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;
def RSI;
def OS;
def OB;
def M;

# Calculations
o = (Go + Gc[1]) / 2;
h = Max(Gh, Gc[1]);
l = Min(Gl, Gc[1]);
c = (o + h + l + Gc) / 4;
def gamma = Log(Sum((Max(Gh, Gc[1]) - Min(Gl, Gc[1])), nFE) /
        (Highest(gh, nFE) - Lowest(Gl, nFE)))
            / Log(nFE);

L0 = (1 – gamma) * Gc + 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;

OS = if IsNaN(c) then Double.NaN else 0.2;

OB = if IsNaN(c) then Double.NaN else 0.8;

M = if IsNaN(c) then Double.NaN else 0.5;

def FEh = if isNaN(c) then double.nan else .618;

def FEl = if isNaN(c) then double.nan else .382;

AddCloud(0, OS, Color.RED, Color.RED);
AddCloud(OB, 1, Color.Green, Color.Green);

#Watchlist column
plot isTrue = if RSI >= 0.9 then 1 else 0;
AssignBackgroundColor(if RSI >= 0.9
                           then color.dark_green
                           else color.dark_red);
Thanks @fungus12, glad you found this.
By the way the Header is missing. Please edit the script and put the following at the beginning.
This was there when I originally posted it. Thanks again.
#
# 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
# Adjusted for compatability with scanner based on Mobius' notes. 7-14-19 Markos
#
declare lower;
#
 
Last edited:
Code:
input nFE = 8;#hint nFE: length for Fractal Energy calculation.
input AlertOn = no;
input Glength  = 13;
input betaDev =  8;
input data = close;

def w = (2 * Double.Pi / Glength);
def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / betaDev) - 1 );
def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
def Go = Power(alpha, 4) * open +
             4 * (1 – alpha) * Go[1] – 6 * Power( 1 - alpha, 2 ) * Go[2] +
             4 * Power( 1 - alpha, 3 ) * Go[3] - Power( 1 - alpha, 4 ) * Go[4];
def Gh = Power(alpha, 4) * high +
             4 * (1 – alpha) * Gh[1] – 6 * Power( 1 - alpha, 2 ) * Gh[2] +
             4 * Power( 1 - alpha, 3 ) * Gh[3] - Power( 1 - alpha, 4 ) * Gh[4];
def Gl = Power(alpha, 4) * low +
             4 * (1 – alpha) * Gl[1] – 6 * Power( 1 - alpha, 2 ) * Gl[2] +
             4 * Power( 1 - alpha, 3 ) * Gl[3] - Power( 1 - alpha, 4 ) * Gl[4];
def Gc = Power(alpha, 4) * data +
             4 * (1 – alpha) * Gc[1] – 6 * Power( 1 - alpha, 2 ) * Gc[2] +
             4 * Power( 1 - alpha, 3 ) * Gc[3] - Power( 1 - alpha, 4 ) * Gc[4];
# 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;
def RSI;
def OS;
def OB;
def M;

# Calculations
o = (Go + Gc[1]) / 2;
h = Max(Gh, Gc[1]);
l = Min(Gl, Gc[1]);
c = (o + h + l + Gc) / 4;
def gamma = Log(Sum((Max(Gh, Gc[1]) - Min(Gl, Gc[1])), nFE) /
        (Highest(gh, nFE) - Lowest(Gl, nFE)))
            / Log(nFE);

L0 = (1 – gamma) * Gc + 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;

OS = if IsNaN(c) then Double.NaN else 0.2;

OB = if IsNaN(c) then Double.NaN else 0.8;

M = if IsNaN(c) then Double.NaN else 0.5;

def FEh = if isNaN(c) then double.nan else .618;

def FEl = if isNaN(c) then double.nan else .382;

AddCloud(0, OS, Color.RED, Color.RED);
AddCloud(OB, 1, Color.Green, Color.Green);

#My attempt
plot isTrue = if RSI >= 0.9 then 1 else 0;
AssignBackgroundColor(if RSI >= 0.9
                           then color.dark_green
                           else color.dark_red);
@generic Please put this header back above the script.

# 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
# Adjusted for compatability with scanner based on Mobius' notes. 7-14-19 Markos

declare lower;

#Inputs:
 
Aloha, I was hoping someone can point me in the right direction. I have been using the Mobius RSI Laguerre FE and like it very much. I am looking to create a signal when the RSI plot crosses ABOVE the fractal energy plot (preferably, a signal when the crossover occurs below the .6). I am currently able to receive a signal when RSI crosses above the "overbought" zone at .2. Both the study and the scan codes I use are below. Perhaps @markos or @BenTen can guide me in the right direction. Many thanks in advance.



STUDY

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
# Adjusted for compatability with scanner based on Mobius' notes.  7-14-19 Markos

declare lower;

#Inputs:
input nFE = 8;#hint nFE: length for Fractal Energy calculation.
input AlertOn = no;
input Glength  = 13;
input betaDev =  8;
input data = close;

def w = (2 * Double.Pi / Glength);
def beta = (1 - Cos(w)) / (Power(1.414, 2.0 / betaDev) - 1 );
def alpha = (-beta + Sqrt(beta * beta + 2 * beta));
def Go = Power(alpha, 4) * open +
             4 * (1 – alpha) * Go[1] – 6 * Power( 1 - alpha, 2 ) * Go[2] +
             4 * Power( 1 - alpha, 3 ) * Go[3] - Power( 1 - alpha, 4 ) * Go[4];
def Gh = Power(alpha, 4) * high +
             4 * (1 – alpha) * Gh[1] – 6 * Power( 1 - alpha, 2 ) * Gh[2] +
             4 * Power( 1 - alpha, 3 ) * Gh[3] - Power( 1 - alpha, 4 ) * Gh[4];
def Gl = Power(alpha, 4) * low +
             4 * (1 – alpha) * Gl[1] – 6 * Power( 1 - alpha, 2 ) * Gl[2] +
             4 * Power( 1 - alpha, 3 ) * Gl[3] - Power( 1 - alpha, 4 ) * Gl[4];
def Gc = Power(alpha, 4) * data +
             4 * (1 – alpha) * Gc[1] – 6 * Power( 1 - alpha, 2 ) * Gc[2] +
             4 * Power( 1 - alpha, 3 ) * Gc[3] - Power( 1 - alpha, 4 ) * Gc[4];
# 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;
plot M;

# Calculations
o = (Go + Gc[1]) / 2;
h = Max(Gh, Gc[1]);
l = Min(Gl, Gc[1]);
c = (o + h + l + Gc) / 4;
plot gamma = Log(Sum((Max(Gh, Gc[1]) - Min(Gl, Gc[1])), nFE) /
        (Highest(Gh, nFE) - Lowest(Gl, nFE)))
            / Log(nFE);
gamma.SetDefaultColor(Color.YELLOW);
L0 = (1 – gamma) * Gc + 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(c) then Double.NaN else 0.2;
OS.SetDefaultColor(Color.RED);
OS.HideBubble();
OS.HideTitle();
OB = if IsNaN(c) then Double.NaN else 0.8;
OB.SetDefaultColor(Color.GREEN);
OB.HideBubble();
OB.HideTitle();
M = if IsNaN(c) then Double.NaN else 0.5;
M.SetStyle(Curve.LONG_DASH);
M.SetDefaultColor(Color.GRAY);
M.HideBubble();
M.HideTitle();
plot FEh = if IsNaN(c) then Double.NaN else .618;
FEh.SetStyle(Curve.SHORT_DASH);
FEh.HideBubble();
FEh.SetDefaultColor(Color.GRAY);
FEh.HideTitle();
plot FEl = if IsNaN(c) then Double.NaN else .382;
FEl.SetStyle(Curve.SHORT_DASH);
FEl.SetDefaultColor(Color.GRAY);
FEl.HideBubble();
FEl.HideTitle();
AddCloud(0, OS, Color.RED, Color.RED);
AddCloud(OB, 1, Color.GREEN, Color.GREEN);
Alert(AlertOn and RSI crosses below .8, "", Alert.BAR, Sound.Bell);
Alert(AlertOn and RSI crosses above .2, "", Alert.BAR, Sound.Bell);

SCAN

Code:
# Crossover for RSI in Laguerre Time With Fractal Energy
input nFE = 8;
# 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;
def RSI;
# Calculations
o = (open + close[1]) / 2;
h = Max(high, close[1]);
l = Min(low, close[1]);
c = (o + h + l + close) / 4;
def gamma = Log(Sum((Max(high, close[1]) - Min(low, close[1])), nFE) /
        (Highest(high, nFE) - Lowest(low, nFE)))
            / Log(nFE);
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;
# Note Comment-Out (#) whichever scan not being used.
# Long Scan
# plot Long = RSI crosses above .2 and gamma > .6;
# Short Scan
#p lot Short = RSI crosses below .8 and gamma > .6;

#input crossingType = {default above, below};

def GREEN = if RSI crosses above .2 and gamma > .6 then yes else 0;

def RED = if RSI crosses below .8 and gamma > .6 then yes else 0;

plot CrossingUp = if GREEN then close[-1] else 0;
CrossingUp.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
CrossingUp.setdefaultcolor(color.Green);


plot CrossingDown = if RED then close[-1] else 0;
CrossingDown.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
CrossingDown.setdefaultcolor(color.RED);;
 
Last edited:
Aloha, I was hoping someone can point me in the right direction. I have been using the Mobius RSI Laguerre FE and like it very much. I am looking to create a signal when the RSI plot crosses ABOVE the fractal energy plot (preferably, a signal when the crossover occurs below the .6).
The syntax would be:
plot RSIgamma_cross = RSI crosses above gamma;
 
Last edited:
RSI Line disappearing randomly: RSI_Laguerre With FE_AutoAdj_v2018_10_12_Mobius_JQvisuals indicator

Hi all,
I was hoping someone would be able to chk out this script and see if there would be any reason why the RSI line would randomly disappear.
I'm generally able to get it back but I have to offload the script and reload it into my studies.
Any help would be greatly appreciated!


Code:
## OneNote Archive Name: RSI_Laguerre With FE_AutoAdj_v2018_10_12_Mobius_JQvisuals

## Archive Section:

## Suggested Tos Name: RSI_LaguerreWithFE_AutoAdj_v2018_10_12_Mobius_JQvisuals

## Archive Date: 5.15.2018

## Archive Notes:

 

## "##" indicates an addition or adjustment by the OneNote Archivist

 

## Modified Code Follows

## 5.15.2018  JQ added code to permit user to disable bull and or bear alerts

## 5.19.2018  JQ added AddChartBubbble code on FE plot

## 9.19.2018  JQ added color to RSI Line

##  10.9.2018 JQ added FE dots  

## 10.12.2018 JQ added takevaluecolor statements

 

# RSI in Laguerre Time Self Adjusting With Fractal Energy

# Mobius

# V03.06.15.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.

 

    ## Lounge Notes

#15:51 Mobius©: Short trade setup I look for with RSI Laguerre adjusted with FE.

#1) Polarity Change - Equity has gone from making higher highs and higher lows to making a lower high and lower low and is now putting in another lower high

#2) RSI Laguerrer is above .8 and descending from 1

#3) Fractal Energy is below .38 and nose down or above .6 and rolling over. In the first case, below .38, FE is indicating trend exahustion and RSI is likely showing as a peak and not running across pegged at 1. In the second case Price has risen to a lower resistance and has been rolling slowly over building energy.

 

#Mobius©: I use a very simple method – RSI Laguerre and Fractal Energy on a list of very liquid stocks. I look for polarity change and trade when both RSI and FE are in “confluence”. If volatility is high enough I sell spreads if not I buy them. Other than hedging (which I do a lot of) that's it. I like it simple.

 

#The typical base setting I like to use for the FE is a length of 8. If I'm trading options I like to look at it about the length of time I'm buying or selling the option for. I want to know if it's reverting and where the energy is so I'll use a longer length for reversion and a shorter length to see if energy is building or waning.

 

#If RSI Laguerre is descending and FE over .6, that tells me something is changing and I'm already looking at an equity I've determined is about to make a polarity change. So the worse case that happens is that the security grinds sideways for a few days.

 

#A reading of the FE over .6 is an indication that energy has been built up. If the FE is high (over .6) and RSI LaGuerre is breaking lower FE will follow suit. If RSI reverses and goes above .8 I'm outa there, with the assumption I have a short position.

 

#FE is a gauge of both mean reverting and linearity. Descending readings indicate a trend is on. A reading below .3 indicates exhaustion in trend or near exhaustion. A reading above .6 indicates moving sideways with rapid reversion and energy building for a move again.

 

#Above .6 - Think price compression or squeeze

#Below .3 - Think running out of gas

 

    # Here's an example:

#FE at 60 periods is oscillating around .5 tightly while FE at 8 periods is over .6. Zscore is over 2 and is starting to roll over. That is a good short to the mean.

 

#Short trade setup I look for with RSI Laguerre adjusted with FE.

 

#1) Polarity Change - Equity has gone from making higher highs and higher lows to making a lower high and lower low and is now putting in another lower high

 

#2) RSI Laguerrer is above .8 and descending from 1

 

#3) Fractal Energy is below .38 and nose down or above .6 and rolling over. In the first case, below .38, FE is indicating trend exahustion and RSI is likely showing as a peak and not running across pegged at 1. In the second case price has risen to a lower resistance and has been rolling slowly over building energy.

 

 

declare lower;

 

    #Inputs:

input RSI_BullishTrigger = .1;

input RSI_BearishTrigger = .9;

input soundBullAlerts = no; ## 5.15.2018 new code

input soundBearAlerts = no; ## 5.15.2018 new code

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.SetDefaultColor(Color.YELLOW);

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);  #JQ mobius oiginal code

# RSI Painting code by JQ 2018.07.30

RSI.AssignValueColor(

        if (RSI > RSI_BearishTrigger) or ((RSI >= RSI[1]) and (RSI > RSI_BullishTrigger))

            then Color.GREEN

        else if (RSI < RSI_BullishTrigger) or ((RSI < RSI[1]) and (RSI < RSI_BearishTrigger))

            then Color.RED

        else Color.WHITE);

RSI.SetLineWeight(2);

 

 

    # Plot fixed value horizontal lines

OS = if IsNaN(close) then Double.NaN else 0.2;

OS.SetDefaultColor(Color.GRAY);

OS.HideBubble();

OS.HideTitle();

OB = if IsNaN(close) then Double.NaN else 0.8;

OB.SetDefaultColor(Color.GRAY);

OB.HideBubble();

OB.HideTitle();

plot FEh = if IsNaN(close) then Double.NaN else .618;

FEh.SetStyle(Curve.LONG_DASH);

FEh.HideBubble();

FEh.SetDefaultColor(Color.DARK_GRAY);

FEh.HideTitle();

plot FEl = if IsNaN(close) then Double.NaN else .382;

FEl.SetStyle(Curve.LONG_DASH);

FEl.SetDefaultColor(Color.DARK_GRAY);

FEl.HideBubble();

FEl.HideTitle();

AddCloud(0, OS, Color.GREEN, Color.GREEN);

AddCloud(OB, 1, Color.RED, Color.RED);

Alert(soundBearAlerts and RSI crosses below .9, "", Alert.BAR, Sound.Ding); ## 5.15.2018 JQ added Boolean

Alert(soundBullAlerts and RSI crosses above .1, "", Alert.BAR, Sound.Ding) ;## 5.15.2018 JQ added Boolean

 

#  Labels below added by Johnny Quotron based on zztop notes above  2018-04-11

 

def FE = gamma;

#addlabel (FE < .382, " FE is Linear (Price Trending) = " + FE, Color.light_GREEN);

#addlabel (FE > .618, " FE is Non-Linear/Random (Trendless) = " + FE, Color.Light_GRAY);

#addlabel (FE <= .618 and FE >= .382, " FE is transitioning = " + FE, Color.Light_orange);

#AddChartBubble(!IsNaN(close) and IsNaN(close[-1]), FE, if FE < .382 then "Trending" else "Not Trending", Color.WHITE, yes);

#AddChartBubble(!IsNaN(close) and IsNaN(close[-1]), FE, if FE < .382 then "Trending" else if FE < .618 then "Transitioning" else "Building Energy", gamma.#takeValueColor(), yes); ## 5.19.2018 JQ

 

# End Code RSI_Laguerre Self Adjusting with Fractal Energy

 

 

 

 

# Fractal Linear Energy

# Mobius

# 5.16.2016

# zztop Notes

 

# This indicator does NOT indicate OB or OS but linear or non-linear

# The closer to 1 the more non-linear (compressed or random) price is.

# The closer to 0 the more linear (trending) price is.

 

# Fractal Energy isn't an indicator - it's a way of looking at price

# to see if it's linear or random. There are NO trading signals on the

# FE study. Only signals NOT to trade.

#

# If the FE is at extremes, something is about to change. It's leading

# you to a conclusion. If the FE is below .382, price is parabolic and

# cannot maintain that. But you may not want to sell because it may

# still go further in it's trend and it may not change direction right

# away. It's telling you though that it's not going to stay trending

# at the current rate of speed. If it's over .618 it telling you price

# is compressing and going sideways rebuilding energy getting ready for

# another run one way ot the other.

#

# Using price in fractals and different times, or ORB with FE and

# supertrend or some way to measure when price expansion is contracting

# or expanding is all you need. Any more than that and you'll be

# paralyzed by information overload

#

# FE does not indicate direction at all. It simply shows linearity or

# non-linearity. Trend or non-trend. It has nothing that determines

# which way trend is going, as in up or down.

#

# Lets say you want to buy ABC company. FE on a monthly, weekly and daily

# shows values of 40, 35 and 30. Price is showing lower lows but random

# lower high. You would know ABC company is close to selling exhaustion

# and it's time to look for a few higher highs to a near term fractal

# pivot then look for short reversal to a higher low over the previous

# recent low and when the bars start setting high highs and lower lows

# again it's time to go long. The FE is what tells you to start looking

# for those signals

 

def dot_nFE = nFE;

input valueFEnonlinear = 0.618;

input valueFElinear = .382;

 

    # dot plots

plot pointsLinear = if FE < valueFElinear

             then -.05

             else Double.NaN;

pointsLinear.SetPaintingStrategy(PaintingStrategy.POINTS);

pointsLinear.SetLineWeight(2);

pointsLinear.SetDefaultColor(Color.CYAN);

 

plot BigpointsLinear = if FE < valueFElinear *.90

             then -.05

             else Double.NaN;

BigpointsLinear.SetPaintingStrategy(PaintingStrategy.POINTS);

BigpointsLinear.SetLineWeight(5);

BigpointsLinear.SetDefaultColor(Color.CYAN);

 

plot pointsLinear2 = if FE < valueFElinear

             then 1.05

             else Double.NaN;

pointsLinear2.SetPaintingStrategy(PaintingStrategy.POINTS);

pointsLinear2.SetLineWeight(2);

pointsLinear2.AssignValueColor(pointsLinear.TakeValueColor());

 

plot BigpointsLinear2 = if FE < valueFElinear * .90

             then 1.05

             else Double.NaN;

BigpointsLinear2.SetPaintingStrategy(PaintingStrategy.POINTS);

BigpointsLinear2.SetLineWeight(5);

BigpointsLinear2.AssignValueColor(pointsLinear.TakeValueColor());

 

plot pointsNonLinear = if FE > valueFEnonlinear

             then -.05  

             else Double.NaN;

pointsNonLinear.SetPaintingStrategy(PaintingStrategy.POINTS);

pointsNonLinear.SetLineWeight(2);

pointsNonLinear.SetDefaultColor(Color.ORANGE);

 

plot BigpointsNonLinear = if FE > (valueFEnonlinear * 1.03)

             then -.05  

             else Double.NaN;

BigpointsNonLinear.SetPaintingStrategy(PaintingStrategy.POINTS);

BigpointsNonLinear.SetLineWeight(5);

BigpointsNonLinear.SetDefaultColor(Color.ORANGE);

 

plot pointsNonLinear2 = if FE > valueFEnonlinear

             then 1.05

             else Double.NaN;

pointsNonLinear2.SetPaintingStrategy(PaintingStrategy.POINTS);

pointsNonLinear2.SetLineWeight(2);

pointsNonLinear2.AssignValueColor(pointsNonLinear.TakeValueColor());

 

plot BigpointsNonLinear2 = if FE > (valueFEnonlinear * 1.03)

             then 1.05

             else Double.NaN;

BigpointsNonLinear2.SetPaintingStrategy(PaintingStrategy.POINTS);

BigpointsNonLinear2.SetLineWeight(5);

BigpointsNonLinear2.AssignValueColor(pointsNonLinear.TakeValueColor());

 

 

#AddLabel (yes, " Trend Exhaustion " , Color.YELLOW);

#AddLabel (yes, " Price Compression " , Color.CYAN);

 

#addChartBubble(BarNumber() == 1, -0.05, "Trend Exhaustion", pointslinear.takevaluecolor());

#addChartBubble(BarNumber() == 1, -0.05, "Price Compression",pointsNonLinear.takevaluecolor());

 

#addChartBubble( if FE == LowestAll(FE) then 1 else 0 , -0.05, "Trend Exhaustion", pointslinear.takevaluecolor());

#AddChartBubble( if FE == HighestAll(FE) then 1 else 0 , -0.05, "Price Compression", pointsNonLinear.TakeValueColor());

 

#def count1 = if barNumber() > 1 and FE < valueFElinear    # from Mobius in Chatroom

#             then compoundValue(1, count1[1] + 1, 1)

#             else count1[1];

#addChartBubble(count1 == 1, 0, "Linear", color.cyan, yes);

 

 

def count1 = if barNumber() > 1 and FE < valueFElinear

             then compoundValue(1, count1[1] + 1, 1)

             else count1[1];

addChartBubble(count1 == 2, -0.05, "Linear - Trend Exhaustion", color.cyan, yes);

 

def count2 = if barNumber() > 1 and FE > valueFENonlinear

             then compoundValue(1, count2[1] + 1, 1)

             else count2[1];

addChartBubble(count2 == 2, -0.05, " Non-Linear - Range Compression", color.orange, yes);

#addlabel(1,"valueFELinear: " + valueFElinear, color.WHITE);

#addlabel(1,"valueFENonLinear: " + valueFEnonlinear, color.WHITE);

#addlabel(1,"count1: " + count1, color.WHITE);

#addlabel(1,"count2: " + count2, color.WHITE);

 

 

# End of Fractal Linear Energy Dot Code
Can somebody explain what is the difference between Count 1 & Count 2? How would you interpret the bubbles?
 
Can somebody explain what is the difference between Count 1 & Count 2? How would you interpret the bubbles?
## OneNote Archive Name: RSI_Laguerre With FE_AutoAdj_v2018_10_12_Mobius_JQvisuals

## Archive Section:

## Suggested Tos Name: RSI_LaguerreWithFE_AutoAdj_v2018_10_12_Mobius_JQvisuals

## Archive Date: 5.15.2018

## Archive Notes:



## "##" indicates an addition or adjustment by the OneNote Archivist



## Modified Code Follows

## 5.15.2018 JQ added code to permit user to disable bull and or bear alerts

## 5.19.2018 JQ added AddChartBubbble code on FE plot

## 9.19.2018 JQ added color to RSI Line

## 10.9.2018 JQ added FE dots

## 10.12.2018 JQ added takevaluecolor statements



# RSI in Laguerre Time Self Adjusting With Fractal Energy

# Mobius

# V03.06.15.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.



## Lounge Notes

#15:51 Mobius©: Short trade setup I look for with RSI Laguerre adjusted with FE.

#1) Polarity Change - Equity has gone from making higher highs and higher lows to making a lower high and lower low and is now putting in another lower high

#2) RSI Laguerrer is above .8 and descending from 1

#3) Fractal Energy is below .38 and nose down or above .6 and rolling over. In the first case, below .38, FE is indicating trend exahustion and RSI is likely showing as a peak and not running across pegged at 1. In the second case Price has risen to a lower resistance and has been rolling slowly over building energy.



#Mobius©: I use a very simple method – RSI Laguerre and Fractal Energy on a list of very liquid stocks. I look for polarity change and trade when both RSI and FE are in “confluence”. If volatility is high enough I sell spreads if not I buy them. Other than hedging (which I do a lot of) that's it. I like it simple.



#The typical base setting I like to use for the FE is a length of 8. If I'm trading options I like to look at it about the length of time I'm buying or selling the option for. I want to know if it's reverting and where the energy is so I'll use a longer length for reversion and a shorter length to see if energy is building or waning.



#If RSI Laguerre is descending and FE over .6, that tells me something is changing and I'm already looking at an equity I've determined is about to make a polarity change. So the worse case that happens is that the security grinds sideways for a few days.



#A reading of the FE over .6 is an indication that energy has been built up. If the FE is high (over .6) and RSI LaGuerre is breaking lower FE will follow suit. If RSI reverses and goes above .8 I'm outa there, with the assumption I have a short position.



#FE is a gauge of both mean reverting and linearity. Descending readings indicate a trend is on. A reading below .3 indicates exhaustion in trend or near exhaustion. A reading above .6 indicates moving sideways with rapid reversion and energy building for a move again.



#Above .6 - Think price compression or squeeze

#Below .3 - Think running out of gas



# Here's an example:

#FE at 60 periods is oscillating around .5 tightly while FE at 8 periods is over .6. Zscore is over 2 and is starting to roll over. That is a good short to the mean.



#Short trade setup I look for with RSI Laguerre adjusted with FE.



#1) Polarity Change - Equity has gone from making higher highs and higher lows to making a lower high and lower low and is now putting in another lower high



#2) RSI Laguerrer is above .8 and descending from 1



#3) Fractal Energy is below .38 and nose down or above .6 and rolling over. In the first case, below .38, FE is indicating trend exahustion and RSI is likely showing as a peak and not running across pegged at 1. In the second case price has risen to a lower resistance and has been rolling slowly over building energy.



# Labels below added by Johnny Quotron based on zztop notes above 2018-04-11



def FE = gamma;

#addlabel (FE < .382, " FE is Linear (Price Trending) = " + FE, Color.light_GREEN);

#addlabel (FE > .618, " FE is Non-Linear/Random (Trendless) = " + FE, Color.Light_GRAY);

#addlabel (FE <= .618 and FE >= .382, " FE is transitioning = " + FE, Color.Light_orange);

#AddChartBubble(!IsNaN(close) and IsNaN(close[-1]), FE, if FE < .382 then "Trending" else "Not Trending", Color.WHITE, yes);

#AddChartBubble(!IsNaN(close) and IsNaN(close[-1]), FE, if FE < .382 then "Trending" else if FE < .618 then "Transitioning" else "Building Energy", gamma.#takeValueColor(), yes); ## 5.19.2018 JQ



# End Code RSI_Laguerre Self Adjusting with Fractal Energy









# Fractal Linear Energy

# Mobius

# 5.16.2016

# zztop Notes



# This indicator does NOT indicate OB or OS but linear or non-linear

# The closer to 1 the more non-linear (compressed or random) price is.

# The closer to 0 the more linear (trending) price is.



# Fractal Energy isn't an indicator - it's a way of looking at price

# to see if it's linear or random. There are NO trading signals on the

# FE study. Only signals NOT to trade.

#

# If the FE is at extremes, something is about to change. It's leading

# you to a conclusion. If the FE is below .382, price is parabolic and

# cannot maintain that. But you may not want to sell because it may

# still go further in it's trend and it may not change direction right

# away. It's telling you though that it's not going to stay trending

# at the current rate of speed. If it's over .618 it telling you price

# is compressing and going sideways rebuilding energy getting ready for

# another run one way ot the other.

#

# Using price in fractals and different times, or ORB with FE and

# supertrend or some way to measure when price expansion is contracting

# or expanding is all you need. Any more than that and you'll be

# paralyzed by information overload

#

# FE does not indicate direction at all. It simply shows linearity or

# non-linearity. Trend or non-trend. It has nothing that determines

# which way trend is going, as in up or down.

#

# Lets say you want to buy ABC company. FE on a monthly, weekly and daily

# shows values of 40, 35 and 30. Price is showing lower lows but random
# lower high. You would know ABC company is close to selling exhaustion

# and it's time to look for a few higher highs to a near term fractal

# pivot then look for short reversal to a higher low over the previous

# recent low and when the bars start setting high highs and lower lows

# again it's time to go long. The FE is what tells you to start looking

# for those signals
The utilization of Fractals in Technical Analysis is an advance concept. No one can explain it better than Mobius does in the above notes.
It is important to note:
This study:
  • is not an oscillator. There is no top or bottom. It does NOT indicate OB or OS
  • it denotes: linear or non-linear
  • the closer to 1, the more non-linear (compressed or random) price is.
  • the closer to 0, the more linear (trending) price is.
Count1 is the total number of linear dots on your chart
Count2 is the total number of non-linear dots on your chart
  • Fractal Energy isn't an indicator - it's a way of looking at price to see if it's linear or random.
  • There are NO trading signals on this study
  • FE does not indicate direction at all.
  • It simply shows linearity or non-linearity
The labels on the bottom are commented out. If you remove the hashtags you will see the counts:
DQ5OCKz.png
 
Last edited:
Hey everyone. Happy Thanksgiving!
I've been trying to read as much as possible and there's so much to take in but I haven't found any answers to the following:

1. Are there any other Gaussian RSI Laguerre Indicators out there? I love the original Mobius V01.12.2016 filter as it removes so much unwanted noise, but I'm interested in tinkering around further.

2. Is there any way to get the upper chart "painted" with arrows as the RSI leaves their upper and lower channels? with the original Gaussian filter?
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
493 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top