# RSI Laguerre with Fractal Energy for ThinkorSwim

#### markos

##### Well-known member
VIP
Mobius' notes:

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.

RSI Laguerre is one of the all time favorites in the opinion of many in The Thinkscript Lounge. TheoTrade has a YouTube video on this with "indicator finds tops and bottoms" in the description.

Alerts are baked into the new (7-14-19) version below!!

Rich (BB 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 Glength  = 13;
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();

# End Code RSI_Laguerre Self Adjusting with Fractal Energy``````

There are more notes located in Tutorial Section!

Grid Code: https://tos.mx/LldzdS
Scan Code: https://tos.mx/bRLjdq

Scan query RSI Laguerre

Code:
``````# Scan for RSI in Laguerre Time With Fractal Energy
# Mobius
# V02.07.2014
# V03.06.15.2016
#Scan
#Inputs:
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
#plot Short = RSI crosses below .8 and gamma > .6;``````

#### Attachments

• NY4e7pv.png
83 KB · Views: 595
• AFGgK8X.png
101.5 KB · Views: 677
Last edited:
I had a question and I was wondering if anyone has found an answer. First thanks Ben and others(Markos) for all the great info on this site. My question is this, as the title states I'm looking to set up Conditional Study Alerts found under marketwatch tab. In particular I wish to use the Languerre RSI, along with a few other conditions, to trigger alert to phone. The problem is the Rec Coding. If you enter this L-RSI into the study alert tab you get the statement found in the title. I was wondering if there was a work around. Thanks.

I do not see any REC coding in the study above.
1. Is it that code or the one in post #2?
2. What other studies or conditions are you using that might be throwing the error?
please post a "share" of each.
We will get this fixed quickest if I have all the details upfront. What timeframes do you look at? What is your scanning criteria?
Did you try scanning with just the RSI Laguerre or were there other conditions in that scan?
Thanks, Markos

Does anyone have a scan for exhausted signals....Thanks

@Craighaber71 Edited by Markos.
The yellow Gamma line is not an indicator, it is only telling you to trade or not to trade, by probabilities.
Even though I said what I did in the line above, there is a scan for exhaustion. I have listed my study under "FractalEnergy"

What type of companies or lists have you scanned against?

Last edited:
Im having a bit of trouble uploading a screenshot of the problems with the Study alerts. I can try using scans as well, but like the Study alerts as I set up push notifications to my mobile app.

In particular I'm looking to use the L-Rsi on a 15 min time frame. I like to think outside the box and am attempting to build a short term continuation strategy using the L-RSI while its above or below channels. I will be Using the L-RSI to view the overall trend and am looking to add a short term indicator (Such as Ehlers CyberCycles or an ema cross for example) to capture short term moves within the overall trend.

With all this being said. Just using the code you posted above https://tos.mx/A9GycW, and attempting to use any study related criteria under the marketwatch tab, using "study alerts" always states rec usage is not allowed in this context.

To attach a screenshot, go to IMGUR.com. You do not need to set up an account. In the upper left there will be a green box that says "new post". Upload the screenshot, at each screenshot, upper right hand corner of picture, it will say copy post. Click on "post to BB". Next, copy the URL and come back to this site. Then click on insert link above, not picture. Paste in the URL box and click insert. Hopefully those instructions will work, @BenTen had to pound that into my thick skull.

I'm looking to scan for exhaustion signals against my WL

@Brady0524 & @Craighaber71 I am updating the study and re-tooling the scans that I have to match it. I have already created a 2 Grid chart with a 15 minute and 1 hour time frame. I will share everything once it is working again.

Awesome..Thanks so much

Thanks Markos for the help. I will be working on uploading those pics soon. I will wait to see what you come up with. Really do like the indicator.

Thank you @Brady0524 it is excellent across all time frames. Theotrade.com on YouTube has an hourlong class available. It's name is like " Amazing Indicator " when searching for the video.

Last edited:
@Craighaber71 that scan is one that I have seen from Doc at Theotrade. People will have a hard time getting that one to work until I can load Doc's proper FE (Chop) study. If it is one of Doc's, please give him credit.

This scan is Doc's Severson's scan that I've tweeked a little bit for my needs

@Craighaber71 the FE study is now completed. The Thread is Fractal Energy aka Chop. Please take the word "SCAN" out of your setup so that they are compatible. Thanks!

Last edited:
@Brady0524 The RSI Laguerre Study and Scan are complete and can be found at this thread's start. Please load them up and try them out. In the tutorial section there is something called how to drive the scanner, inside that post you will find two videos on working with the scanner and turning a dynamic scan into a watchlist.

Please review those, they should help explain any problems you may have.

Please consider loading the Slim Ribbon study located here in the forum. It's scheme is based on 8-13-21EMA cross for signals. I also got that from Slim at TheoTrade. Once that is loaded, you will find that it matches up very nicely with the RSI Laguerre. Slim Ribbon has alerts baked in.

These are some of the different settings depending on your preference. Try several below your chart and do a comparison on the settings. Some settings will give you more of a whipsaw action. Different day traders have been known to change these around until they're happy, but it is personal preference.

There is no Holy Grail...

#Inputs:
input nFE = 8;#hint nFE: length for Fractal Energy calculation. Mobius default is 8. Alt. is 5.
input Glength = 13;#hint Glength: length for Gaussian Price Filter. Mobius default is 13
input betaDev = 4;#hint BetaDev: Mobius default is 4. Alt is 8.

#### Attachments

• Cu1BFEWl.jpg
58.9 KB · Views: 260
Last edited by a moderator:
@markos The different colors on the gamma line what do they mean....Green....Yellow...Pink

@Craighaber71 I'm not following what you're asking. Please take a closeup screenshot and point to the areas with a Gamma line with Green, Yellow, and Pink. Sorry, to me the whole Gamma line is Yellow. I'm willing to help but I'm not seeing it. Thanks, Markos

87k+ Posts
285 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?