RSI Laguerre with Fractal Energy for ThinkorSwim

Hey all, cooked up my own variation on RSI Laguerre. Calculations are the same, my thresholds for buy and sell are a bit different and based on my own observations. I flipped over the FE to what I labeled "gamma 2" That way we know that a breakout in FE goes up and not down (always confused my dumb *** at a glance) I personally always keep FE hidden, but you can show them by going to "show plot" on gamma or gamma2. Added vertical lines for my personal buys and sells. WB stands for weak buy, it's simply a different signal for buying and doesn't necessarily have the FE to back up the confirmation. The indicator is only to be used INTRA-DAY. I didn't realize until I watched that hour long Theotrade video that the Laguerre isn't really made to be used for daily and above. Intraday signals are way more accurate. Anyways, hopefully somebody finds some use with it.

edit: almost forgot. I also added separate FE signal dots. The blue dots signal that the FE is compressing below a threshold. Think of that as the same signal as a squeeze. The orange dots indicate a trend exhaustion signal. I use these as a warning sign that a sell signal is about to happen or that it's time to take some profit off the table.

Code:
# TheoTrade RSI in Laguerre Time Self Adjusting With Fractal Energy
# Mobius V03.06.15.2016
# Gamma 2 Inverse variation and Mods by WTF_Dude 9.30.20
#
# 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.

#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 nFE = 13;#hint nFE: length for Fractal Energy calculation.
input FHigh = .7; #Threshold for fractal energy trend exhaustion
input FLow = .4;  #Threshold for fractal energy compression
input Weak_TH = .85;
input Buy_TH = .1;
input Sell_TH =.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;
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);
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;
}
gamma.Hide();

plot Gamma2 = 1 - gamma;
Gamma2.SetDefaultColor(Color.GRAY);
Gamma2.Setlineweight(2);
gamma2.Hide();


RSI = if CU + CD <> 0 then CU / (CU + CD) else 0;
RSI.SetDefaultColor(Color.CYAN);

def Buy =  RSI > RSI[1] and  RSI crosses above Buy_Th and Gamma2 > Gamma2[1]; #and gamma2-gamma2[1]>.01
AddVerticalLine(Buy is true, "Buy", Color.GREEN, Curve.SHORT_DASH );

def WeakBuy =  RSI crosses above Weak_TH and gamma2 <= FHigh;
AddVerticalLine(WeakBuy is true, "WB", CreateColor(0, 153, 0), Curve.SHORT_DASH );

def Sell = RSI crosses below  Sell_TH; # and Gamma2<Gamma2[1]
AddVerticalLine(Sell is true, "Sell", Color.RED, Curve.SHORT_DASH );

#def TE = Gamma2 crosses above .7;
#AddVerticalLine(TE is true, "X", Color.ORANGE, Curve.SHORT_DASH );





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 FHigh;
FEh.SetStyle(Curve.LONG_DASH);
FEh.HideBubble();
FEh.SetDefaultColor(Color.DARK_GRAY);
FEh.HideTitle();
plot FEl = if IsNaN(close) then Double.NaN else FLow;
FEl.SetStyle(Curve.LONG_DASH);
FEl.SetDefaultColor(Color.DARK_GRAY);
FEl.HideBubble();
FEl.HideTitle();
AddCloud(0, OS, Color.RED, Color.RED);
AddCloud(OB, 1, Color.GREEN, Color.GREEN);

########### Central Dots


plot Compress = if gamma2<FLow then .5 else Double.Nan;
Compress.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
Compress.SetLineWeight(1);
Compress.SetDefaultColor(Color.CYAN);
Compress.HideTitle();

plot Exhaust = if gamma2 crosses above FHigh then .5 else Double.NaN;
Exhaust.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
Exhaust.SetLineWeight(2);
Exhaust.SetDefaultColor(Color.ORANGE);
Exhaust.HideTitle();

plot M =if IsNaN(c) then Double.NaN else 0.5;
M.SetPaintingStrategy(PaintingStrategy.Line);
M.SetDefaultColor(Color.Gray);








Alert(RSI crosses below  Sell_TH, "Sell", Alert.BAR, Sound.Bell);
Alert(RSI crosses above  Buy_TH, "Buy", Alert.BAR, Sound.Bell);
Alert(RSI crosses above  Weak_TH, "Buy", Alert.BAR, Sound.Bell);

# End Code RSI_Laguerre Self Adjusting with Fractal Energy
 

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

L0 = (1 gamma) * c + gamma * L0[1];

This line is giving me an invalid statement L0, how do I fix this?

Line 76:

Invalid statement: L0 at 76:1
 
BenTen,

I am trying to get this script to work and it gives me errors

Code:
# TheoTrade RSI in Laguerre Time Self Adjusting With Fractal Energy
# Mobius V03.06.15.2016
# Gamma 2 Inverse variation and Mods by WTF_Dude 9.30.20
#
# 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.

#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 nFE = 13;#hint nFE: length for Fractal Energy calculation.
input FHigh = .7; #Threshold for fractal energy trend exhaustion
input FLow = .4;  #Threshold for fractal energy compression
input Weak_TH = .85;
input Buy_TH = .1;
input Sell_TH =.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;
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);
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;
}
gamma.Hide();

plot Gamma2 = 1 - gamma;
Gamma2.SetDefaultColor(Color.GRAY);
Gamma2.Setlineweight(2);
gamma2.Hide();


RSI = if CU + CD <> 0 then CU / (CU + CD) else 0;
RSI.SetDefaultColor(Color.CYAN);

def Buy =  RSI > RSI[1] and  RSI crosses above Buy_Th and Gamma2 > Gamma2[1]; #and gamma2-gamma2[1]>.01
AddVerticalLine(Buy is true, "Buy", Color.GREEN, Curve.SHORT_DASH );

def WeakBuy =  RSI crosses above Weak_TH and gamma2 <= FHigh;
AddVerticalLine(WeakBuy is true, "WB", CreateColor(0, 153, 0), Curve.SHORT_DASH );

def Sell = RSI crosses below  Sell_TH; # and Gamma2<Gamma2[1]
AddVerticalLine(Sell is true, "Sell", Color.RED, Curve.SHORT_DASH );

#def TE = Gamma2 crosses above .7;
#AddVerticalLine(TE is true, "X", Color.ORANGE, Curve.SHORT_DASH );





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 FHigh;
FEh.SetStyle(Curve.LONG_DASH);
FEh.HideBubble();
FEh.SetDefaultColor(Color.DARK_GRAY);
FEh.HideTitle();
plot FEl = if IsNaN(close) then Double.NaN else FLow;
FEl.SetStyle(Curve.LONG_DASH);
FEl.SetDefaultColor(Color.DARK_GRAY);
FEl.HideBubble();
FEl.HideTitle();
AddCloud(0, OS, Color.RED, Color.RED);
AddCloud(OB, 1, Color.GREEN, Color.GREEN);

########### Central Dots


plot Compress = if gamma2<FLow then .5 else Double.Nan;
Compress.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
Compress.SetLineWeight(1);
Compress.SetDefaultColor(Color.CYAN);
Compress.HideTitle();

plot Exhaust = if gamma2 crosses above FHigh then .5 else Double.NaN;
Exhaust.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
Exhaust.SetLineWeight(2);
Exhaust.SetDefaultColor(Color.ORANGE);
Exhaust.HideTitle();

plot M =if IsNaN(c) then Double.NaN else 0.5;
M.SetPaintingStrategy(PaintingStrategy.Line);
M.SetDefaultColor(Color.Gray);








Alert(RSI crosses below  Sell_TH, "Sell", Alert.BAR, Sound.Bell);
Alert(RSI crosses above  Buy_TH, "Buy", Alert.BAR, Sound.Bell);
Alert(RSI crosses above  Weak_TH, "Buy", Alert.BAR, Sound.Bell);

# End Code RSI_Laguerre Self Adjusting with Fractal Energy
 
@Chuck I don't find an error either
E9yNEIY.png

Could you load a screenshot? (here are directions for adding images to this forum)
 
its better to look at different time frames when it comes to the fractal energy I set mine to 5, 13, 30 min

Code:
declare lower;

input length = 14;

input l2 = 61.8;
input l1 = 38.2;
input l0 = 25.0;
input agg = AggregationPeriod.FIVE_MIN;
def sumTR = Sum (TrueRange(high(period = agg), close(period = agg), low(period = agg)),  length);
def HMax =  Highest (high(period = agg), length);
def LMax =  Lowest (low(period = agg), length);

plot FE = 100 * Log (sumTR / (HMax - LMax)) / Log( length);



input agg2 = AggregationPeriod.FIVE_MIN;
def sumTR2 = Sum (TrueRange(high(period = agg2), close(period = agg2), low(period = agg2)),  length);
def HMax2 =  Highest (high(period = agg2), length);
def LMax2 =  Lowest (low(period = agg2), length);

plot FE2 = 100 * Log (sumTR2 / (HMax2 - LMax2)) / Log( length);



input agg3 = AggregationPeriod.FIVE_MIN;
def sumTR3 = Sum (TrueRange(high(period = agg3), close(period = agg3), low(period = agg3)),  length);
def HMax3 =  Highest (high(period = agg3), length);
def LMax3 =  Lowest (low(period = agg3), length);

plot FE3 = 100 * Log (sumTR3 / (HMax3 - LMax3)) / Log( length);

FE.SetDefaultColor(Color.ORANGE);
FE.SetStyle (Curve.FIRM);
FE.SetLineWeight(2);

plot line0 = l0;
line0.SetDefaultColor(Color.RED);
#line0.SetStyle (Curve.FIRM);
plot line1 = l1;
line1.SetDefaultColor(Color.CYAN);
#line1.SetStyle (Curve.FIRM);
plot line2 = l2;
line2.SetDefaultColor(Color.BLUE);
#line2.SetStyle (Curve.FIRM);
 
I've been experimenting with this since Sept. 29. I have it on a 15 minute chart of the NQ. 15 minute charts are the longest time frame that I use in trading the NQs. My settings for this indicator are 5 - 5 - 20, which turned out to be the only acceptable settings for being somewhat in sync with the actual market action. Any other settings on the 15 minute chart turned out to not be of much use. To be honest, I use other more simple indicators that generate much more accurate analysis. I'm at a point now where I will probably discontinue experimentation with this. If other traders have had luck with it, that is fantastic. But for ST futures trading, there are much better alternatives.... Wild, quick moves in the markets lately. Lots of money to be made...and lost....everyone be careful, and don't get greedy or anxious....
 
@BenTen,

Line number 76:


L0 = (1 gamma) * c + gamma * L0[1];

Error:
Invalid statement: L0 at 76:1
Re-copy the entire code from the earlier post. I just double checked and I can't get this error to reproduce on my end. You had to have added an extra character somewhere
 
Re-copy the entire code from the earlier post. I just double checked and I can't get this error to reproduce on my end. You had to have added an extra character somewhere

Code:
# TheoTrade RSI in Laguerre Time Self Adjusting With Fractal Energy
# Mobius V03.06.15.2016
# Gamma 2 Inverse variation and Mods by WTF_Dude 9.30.20
#
# 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.

#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 nFE = 13;#hint nFE: length for Fractal Energy calculation.
input FHigh = .7; #Threshold for fractal energy trend exhaustion
input FLow = .4;  #Threshold for fractal energy compression
input Weak_TH = .85;
input Buy_TH = .1;
input Sell_TH =.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;
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);
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;
}
gamma.Hide();

plot Gamma2 = 1 - gamma;
Gamma2.SetDefaultColor(Color.GRAY);
Gamma2.Setlineweight(2);
gamma2.Hide();


RSI = if CU + CD <> 0 then CU / (CU + CD) else 0;
RSI.SetDefaultColor(Color.CYAN);

def Buy =  RSI > RSI[1] and  RSI crosses above Buy_Th and Gamma2 > Gamma2[1]; #and gamma2-gamma2[1]>.01
AddVerticalLine(Buy is true, "Buy", Color.GREEN, Curve.SHORT_DASH );

def WeakBuy =  RSI crosses above Weak_TH and gamma2 <= FHigh;
AddVerticalLine(WeakBuy is true, "WB", CreateColor(0, 153, 0), Curve.SHORT_DASH );

def Sell = RSI crosses below  Sell_TH; # and Gamma2<Gamma2[1]
AddVerticalLine(Sell is true, "Sell", Color.RED, Curve.SHORT_DASH );

#def TE = Gamma2 crosses above .7;
#AddVerticalLine(TE is true, "X", Color.ORANGE, Curve.SHORT_DASH );





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 FHigh;
FEh.SetStyle(Curve.LONG_DASH);
FEh.HideBubble();
FEh.SetDefaultColor(Color.DARK_GRAY);
FEh.HideTitle();
plot FEl = if IsNaN(close) then Double.NaN else FLow;
FEl.SetStyle(Curve.LONG_DASH);
FEl.SetDefaultColor(Color.DARK_GRAY);
FEl.HideBubble();
FEl.HideTitle();
AddCloud(0, OS, Color.RED, Color.RED);
AddCloud(OB, 1, Color.GREEN, Color.GREEN);

########### Central Dots


plot Compress = if gamma2<FLow then .5 else Double.Nan;
Compress.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
Compress.SetLineWeight(1);
Compress.SetDefaultColor(Color.CYAN);
Compress.HideTitle();

plot Exhaust = if gamma2 crosses above FHigh then .5 else Double.NaN;
Exhaust.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
Exhaust.SetLineWeight(2);
Exhaust.SetDefaultColor(Color.ORANGE);
Exhaust.HideTitle();

plot M =if IsNaN(c) then Double.NaN else 0.5;
M.SetPaintingStrategy(PaintingStrategy.Line);
M.SetDefaultColor(Color.Gray);








Alert(RSI crosses below  Sell_TH, "Sell", Alert.BAR, Sound.Bell);
Alert(RSI crosses above  Buy_TH, "Buy", Alert.BAR, Sound.Bell);
Alert(RSI crosses above  Weak_TH, "Buy", Alert.BAR, Sound.Bell);

# End Code RSI_Laguerre Self Adjusting with Fractal Energy
 
haha I meant recopy the code on your end, not recopy to here. Either way, I copy pasted what you just pasted here and still no error. Just to make sure you're starting this out correctly: you go to studies, then "create". then wipe out the default line of code before you paste.
 
haha I meant recopy the code on your end, not recopy to here. Either way, I copy pasted what you just pasted here and still no error. Just to make sure you're starting this out correctly: you go to studies, then "create". then wipe out the default line of code before you paste.
Finally got it to work, I always create study , then erase existing snippet and then paste. Don't know why it worked now and did not previously. But I appreciate all the assistance!!!! You are greatly appriciated.
 
Hello together,

I would like setup a chart study that shows down arrows when RSI Laguerre drops below 0.8 and gamma is > 0.6, and up arrows when RSI Laguerre crosses above 0.2 and gamma is > 0.6. The debugging shows no errors but the arrows are not being displayed on my charts.

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);
 
After watching numerous versions of this indicator for a while now, I'm happy to say.... I think it's pretty much worthless. Way better choices out there imo
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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