RSI Laguerre with Fractal Energy for ThinkorSwim

No Good @Prison Mike That is a study of the Wilders RSI of the RSI in Laguerre Time study. I could be wrong but Laguerre Time Transform Polynomials are for price. They self adjust with the speed of the stock.
 

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

Hey Mansor,
I personally use the RSI-L with FE that Mobius made for Theotrade. I use it to trade NQ and ES futures intraday on a 2min time frame to enter and exit trades. I also use an anchor chart of 5-10 times higher time frame so that I am trading with the trend. If the longer time frame is heading up then I only take long entries and vice versa for shorts. You can make small scalps trading against the trend using this indicator, but I dont like doing that unless price action tells me otherwise. Also, I dont find fractal energy of much use on the 2min time frame, its really only useful on longer time frames in my opinion.

Hello @BWiz Thank you for the information. It helps a newbie like me. You mentioned that you use this script only for higher time frames and not on 1m or 2m charts. May I please know what other indicator you use for higher time frame to trade futures? Thanks!
 
Hello @BWiz Thank you for the information. It helps a newbie like me. You mentioned that you use this script only for higher time frames and not on 1m or 2m charts. May I please know what other indicator you use for higher time frame to trade futures? Thanks!
Add the RSI-L in your lower study and set the aggregation period to two minutes. Next add the RSI-L to your lower study again, but make sure its in the same rectangle as your first RSI-L Study. Set the aggregation period to 15 minutes. When the 15m RSI-L is in an uptrend place entries using the 2m once the 2m has crossed above the OS line. Do the inverse for you short entries. That way when you enter a trade you will be following the same direction as the longer term trend to give you a better edge. I hope this helps.
 
Add the RSI-L in your lower study and set the aggregation period to two minutes. Next add the RSI-L to your lower study again, but make sure its in the same rectangle as your first RSI-L Study. Set the aggregation period to 15 minutes. When the 15m RSI-L is in an uptrend place entries using the 2m once the 2m has crossed above the OS line. Do the inverse for you short entries. That way when you enter a trade you will be following the same direction as the longer term trend to give you a better edge. I hope this helps.

Hello @BWiz... Your approach is surely promising and I am seeing good results in paper trading. May I please ask how do you determine stop loss? Thanks again!
 
Hello @BWiz... Your approach is surely promising and I am seeing good results in paper trading. May I please ask how do you determine stop loss? Thanks again!
I can read price fairly well, so I don't use specific hard stops. Depending on multiple variables I will manage my trades in numerous ways. You said you were a newbie, so my best advice for you would be to use something like ATR indicator (average true range) to help you place a stop loss. Research the ATR and incorporate it into your trading strategy to help you place a hard stop.
 
Here's a Laguerre that is customized,.....https://tos.mx/kyCs9yK
The settings originally are .08 and .13
 
Here is an indicator that plots labels for the RSI Laguerre , if you add several to the same chart area, you will find out how the higher time frames are doing, just adjust the agg period.

Code:
#########################################
declare lower;
input period = AggregationPeriod.DAY;
input nFE = 13;#hint nFE: length for Fractal Energy calculation. 
input RSI_BullishTrigger = .1;
input RSI_BearishTrigger = .9;
DefineGlobalColor("Long", Color.Green);
DefineGlobalColor("Short", Color.RED);
DefineGlobalColor("Neutral", Color.Yellow);
DefineGlobalColor("arrow Buy", Color.Cyan);
DefineGlobalColor("arrow Sell", Color.Orange);
Script SymbolHK_RSI_L{
input period = AggregationPeriod.DAY;
def OP = Open(period= period);
def CP = Close(Period= period);
def HP = High(period= period);
def LP = Low(Period= period);
input nFE = 13;#hint nFE: length for Fractal Energy calculation. 
input RSI_BullishTrigger = .1;
input RSI_BearishTrigger = .9;
    # 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;

    # Calculations
o = (OP + CP[1]) / 2;
h = Max(HP, CP[1]);
l = Min(LP, CP[1]);
c = (OP + HP + LP + CP) / 4;
    #Self adjusting Gamma code
Def gamma = Log(Sum((Max(HP, CP[1]) - Min(LP, CP[1])), nFE) / 
        (Highest(HP, nFE) - Lowest(LP, 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; }

Def RSIL = if CU + CD <> 0 then CU / (CU + CD) else 0;

Plot result =
        if (RSIL > RSI_BearishTrigger) or ((RSIL >= RSIL[1]) and (RSIL > RSI_BullishTrigger))
            then 1 
        else if (RSIL < RSI_BullishTrigger) or ((RSIL < RSIL[1]) and (RSIL < RSI_BearishTrigger))
            then -1          else 0;}


Script SymbolHK_RSI_LArrows{
input period = AggregationPeriod.DAY;
def OP = Open(period= period);
def CP = Close(Period= period);
def HP = High(period= period);
def LP = Low(Period= period);
input nFE = 13;#hint nFE: length for Fractal Energy calculation. 
input RSI_BullishTrigger = .1;
input RSI_BearishTrigger = .9;
    # 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;

    # Calculations
o = (OP + CP[1]) / 2;
h = Max(HP, CP[1]);
l = Min(LP, CP[1]);
c = (OP + HP + LP + CP) / 4;
    #Self adjusting Gamma code
Def gamma = Log(Sum((Max(HP, CP[1]) - Min(LP, CP[1])), nFE) / 
        (Highest(HP, nFE) - Lowest(LP, 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; }

Def RSI = if CU + CD <> 0 then CU / (CU + CD) else 0;

Plot result =
        if (RSI Crosses Above RSI_BullishTrigger) or ((RSI[2] > RSI[1]) and (RSI[1] <= RSI))
            then 1 
        else if (RSI Crosses below RSI_BearishTrigger) or ((RSI[2] < RSI[1]) and (RSI[1] > RSI))
            then -1          else 0;}
def currentPeriod = GetAggregationPeriod();
def s1;
def h1;

if period >= currentPeriod {
    s1 = SymbolHK_RSI_L(period = period ,nFE = nFE, RSI_BullishTrigger = RSI_BullishTrigger, RSI_BearishTrigger = RSI_BearishTrigger);
    h1 = SymbolHK_RSI_LArrows(period = period, nFE = nFE, RSI_BullishTrigger = RSI_BullishTrigger, RSI_BearishTrigger = RSI_BearishTrigger);
} else {
    s1 = Double.NaN;
    h1 = DOuble.Nan;
}
AddLabel(!IsNaN(s1), "RSIL:" + (if period == AggregationPeriod.MONTH then "M"
else
if period == AggregationPeriod.WEEK then "W"
else
if period == AggregationPeriod.FOUR_DAYS then "4D"
else
if period == AggregationPeriod.THREE_DAYS then "3D"
else
if period == AggregationPeriod.TWO_DAYS then "2D"
else
if period  == AggregationPeriod.DAY then "D"
else
if period == AggregationPeriod.FOUR_HOURS then "4H"
else
if period == AggregationPeriod.TWO_HOURS then "2H"
else
if period == AggregationPeriod.HOUR then "60m"
else
if period == AggregationPeriod.THIRTY_MIN then "30m"
else
if period == AggregationPeriod.TWENTY_MIN then "20m"
else
if period  == AggregationPeriod.FIFTEEN_MIN then "15m"
else
if period == AggregationPeriod.TEN_MIN then "10m"
else
if period == AggregationPeriod.FIVE_MIN then "5m"
else
if period == AggregationPeriod.FOUR_MIN then "4m"
else
if period  == AggregationPeriod.THREE_MIN then "3m"
else
if period == AggregationPeriod.TWO_MIN then "2m"
else
if period  == AggregationPeriod.MIN then "1m"
else ""), if s1 == 1 then GlobalColor("Long") else if s1 == -1 then GlobalColor("Short") else GlobalColor("Neutral"));
AddLabel(!IsNaN(h1) and h1 != 0, If h1 == 1 then "B" else if h1 == -1 then "S" else "-", if h1 == 1 then GlobalColor("arrow Buy") else if h1 == -1 then GlobalColor("arrow Sell") else color.gray);
 
here is the code to add a cloud feature for the FE

Code:
# Cloud feature forceIndex FE by Henry Z Kaczmarczyk 2020-25-07
def FELin =  If FE < .382 then FE else Double.Nan;
def FENonLin = If FE > .618 then FE else Double.Nan;
AddCloud(FELin,.382,Color.Cyan,color.Cyan);
AddCloud(FENonLin ,.618,Color.Dark_Orange,Color.Dark_Orange);
##################################

Just add it to the script after GAMMA around line 180 in the original indicator
 
Add the RSI-L in your lower study and set the aggregation period to two minutes. Next add the RSI-L to your lower study again, but make sure its in the same rectangle as your first RSI-L Study. Set the aggregation period to 15 minutes. When the 15m RSI-L is in an uptrend place entries using the 2m once the 2m has crossed above the OS line. Do the inverse for you short entries. That way when you enter a trade you will be following the same direction as the longer term trend to give you a better edge. I hope this helps.
@BWiz I can't find an RSI-L which enables me to set the aggregate period. Would you be willing to share the study you are using? thank you
 
Hello, I would like have this study as a lower indicator. Whenever I add plot 0 to 100 the chart is off. Not sure what I'm doing wrong. Any assistance would be greatly appreciate.

Code:
# RSI in Laguerre Time Scaled to Price

# Mobius
# V01.08.2016

declare lower;
script Scale {
    input c = close;
    input Min = 0;
    input Max = 1;
    def hh = HighestAll(c);
    def ll = LowestAll(c);

    plot Range = (((Max - Min) * (c - ll)) /  (hh - ll)) + Min;

}

#Inputs:
input gamma = .5;

# Variables:
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 min;
def max;

# Calculations

c = close;
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;
min = Lowest(c);
max = Highest(c);
plot RescaledRSI = Scale(c = RSI, min = min, max = max);
RescaledRSI.SetStyle(Curve.FIRM);
RescaledRSI.SetLineWeight(2);
RescaledRSI.AssignValueColor(if RescaledRSI > RescaledRSI[1]

                                  then Color.CYAN
                                  else Color.YELLOW);

plot line0 = 0;
plot line10 = 10;
plot line20 = 20;
plot line30 = 30;
plot line40 = 40;
plot line50 = 50;
plot line60 = 60;
plot line70 = 70;
plot line80 = 80;
plot line90 = 90;
plot line100 = 100;
 
Last edited:
@markos I am having issues with the scanner. I just have it set for crossing over 0.2 within the last bar (also tried setting it to crossing over OS which is also 0.2) combined with a market cap and volume filter. It sometimes has correct stocks listed but some have not crossed over 0.2 for over a week. For example on the 4 hour aggregation UPS shows up on the scanner as crossing within the last bar but it has not crossed since approximately 25 bars ago. I'll link the scanner and provide a screenshot. I'll also post a screenshot of UPS on the 4 hour aggregation chart showing it hasn't crossed recently. Here is the scanner link: http://tos.mx/7s3U2dP

faqN70w.png

GtnVuR9.png
 
@RyanBGrindin There is a mismatch between your chart's setting and your scanner's setting. Your chart includes extended hours while your scanner does not. I would pick one option and make sure both are aligned with each other. If you prefer to keep the extended hours on, then I would check the box that says, "EXT" in your scanner.
 
I know we already discussed this but just do it doesn't look like this is solved, this wasn't the issue. Using extended hours on the scanner still doesn't always match with the chart. And taking extended hours off the charts doesn't fix the issue either.

Edit: On second consideration, I'm not sure. UPS still doesn't cross but it is around 0.1 but this could be due to the fact that there hasn't been a new bar since 1:30 EST when extended hours is off.
 
Last edited:
@bdbald the plot condition that @horserider posted looked different, so I fixed it up. This version scans for last 4 bars above 0.9 or below 0.1. Make sure you select ONLY one plot and comment the other out as appropriate.

I just ran a scan against the S&P 500 using this code and it returned 96 hits. Feel free to adjust your scan condition as you see fit

# RSI in Laguerre Time With Fractal Energy Scan
# 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 = sum(RSI > .9, 4) >= 4;
# Short Scan
#plot Short = sum(RSI < .1, 4) >= 4;

# END SCAN


I'm trying to use this scan to look for a condition like "RSI>=x and Gamma<=y" so I modified the plot scan line to the following for testing purposes:

Code:
plot scan = RSI<=1 and Gamma>=0;

Having those values in there for testing purposes gives no results. So clearly it isn't working. Does anyone know how to make this scan work for specifying to scan for both an RSI value and a Gamma (Fractal Energy) value?
 
@lmk99 You do not need to modify the code. Just use the regular RSI Laguerre indicator posted on the first page and set up your scanner like this:

ctKIqyT.png


BrpYc6C.png
 
@lmk99 You do not need to modify the code. Just use the regular RSI Laguerre indicator posted on the first page and set up your scanner like this:

ctKIqyT.png


BrpYc6C.png

Hi, I previously tried using this method to make a scan from this study and it wouldn't work for me. I just tested it again using the settings you have above and it's not working. I see a chart in front of me that meets the exact conditions specified in the scanner on 2min period, I'm scanning with extended hours enabled, and I get 0 results. Did the scan you made in the screenshot work for you?
 
Add the RSI-L in your lower study and set the aggregation period to two minutes. Next add the RSI-L to your lower study again, but make sure its in the same rectangle as your first RSI-L Study. Set the aggregation period to 15 minutes. When the 15m RSI-L is in an uptrend place entries using the 2m once the 2m has crossed above the OS line. Do the inverse for you short entries. That way when you enter a trade you will be following the same direction as the longer term trend to give you a better edge. I hope this helps.
Hey man, tried to follow your instructions based on your few posts. I have the TheoTrade RSI in Laguerre Time Self Adjusting With Fractal Energy Mobius V03.06.15.2016, that I think you're referring to in one post, that doesn't have the higher agg. I also have the MTF v3 and the one from page 1 here, with the agg but thats a different style and doesn't seem to anchor differently between the 2 time frames.

I have about 3 billion versions of the RSI LG, just want to make sure I'm using the correct one for the 2m,15 min combo. It sounds like a good play
 
@lmk99 What are the exact values that you're using for both conditions?

EDIT: This is dumb but I realized that sometimes when making a new scan, the "Scan In:" setting defaults to something other than "All Stocks." That was the problem lol, it's working now!
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
512 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