SuperTrend and RSI Laguerre Indicator for ThinkorSwim

@Rami_sds Here you go. Everything is disabled except for the label.

Code:
# CSA Nube (RSI Laguerre, SuperTrend)
# Nube
# 8.28.2016

# When RSI Laguerre is combined with SuperTrend, if this study plots a
# line and ST changes that bar or the next one, then it seems to be a
# decent entry.
#
# After making this observation, I'm tentatively going to scrap the momentum
# study (VACD) and just use the Laguerre RSI to decide trend and the
# Supertrend for entry. I think something along the lines of attaching that
# to RSI will be enough to decide direction and then just flag the switchover
# between up and down in ST

# RSI in Laguerre Time Self Adjusting With Fractal Energy
# Mobius
# V02.07.2014
# 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.

#Inputs:
input nFE = 13;#hint nFE: length for Fractal Energy calculation.
input Overbought = 0.80;
input Oversold = 0.20;
Input Label = Yes;
# 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;

# 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;
OS = if IsNaN(close) then Double.NaN else Oversold;
OB = if IsNaN(close) then Double.NaN else Overbought;


# Mobius
# SuperTrend
# Chat Room Request
# V03.10.2015

input AtrMult = 1.0;
input nATR = 4;
input AvgType = AverageType.HULL;
input PaintBars = no;

def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = HL2 + (AtrMult * ATR);
def DN = HL2 + (-AtrMult * ATR);
def ST = if close < ST[1] then UP else DN;
def SuperTrend = ST;

#AssignPriceColor(if PaintBars and close < ST
#                then GetColor(5)
#                else if PaintBars and close > ST
#                     then GetColor(7)
#                     else Color.CURRENT);

# End Code SuperTrend

def UT = sum(RSI>OB,20);
def DT = sum(RSI<OS,20);

#plot Buy = if UT>DT and close > ST and close[1] < ST[1] then close else Double.Nan;
#Buy.SetDefaultColor(GetColor(7));
#Buy.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);

#plot Sell = if UT<DT and close < ST and close[1] > ST[1] then close else Double.Nan;
#Sell.SetDefaultColor(GetColor(5));
#Sell.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);

AddLabel(Label, "Trend: " + if UT>DT then "Up" else if UT<DT then "Down" else "None", if UT>DT then GetColor(1) else if UT<DT then GetColor(5) else GetColor(3));

# End Study
 

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

Is it possible to have this on the watchlist column. Where it tells you which way the stock is trending per the supertrend with rsi combo found here.
 
Is it possible to have this on the watchlist column. Where it tells you which way the stock is trending per the supertrend with rsi combo found here.

If you Copy & Paste the entire Study into a Watchlist Custom Column it will display the Trend: Up and Trend: Down labels... It is not possible to reference this Study, it must be copied and pasted...
 
is it just me but im unable to scan for when the Buy signal pops up?
im going into study choosing supertrend i select Plot - Buy
and set it to true
no other filters are on - 0 results

SuperTrendwithRSI("overbought" = 0.7)."Buy" is true within 5 bars
 
@Csharp It should be buy is true.

syZCSNc.png
 
I’ve noticed when AvgType = AverageType.HULL; is selected the search won’t work. I have to choose simple or exponential. But then it doesn’t bring up the same up arrows as the upper study shows
 
Is it possible to make this a lower indicator with a line that changes color? Would appreciate it as there's a few indicators that paint bars and I would like to use this one as well at the same time
 
@ext99k What a dashboard does is it replaces the AssignPriceColor which paints candles in an upper study with AssignValueColor to paint a line in a lower study
ac3gWcb.png

Ruby:
# CSA Nube (RSI Laguerre, SuperTrend)
# Nube
# 8.28.2016

declare lower ;
# When RSI Laguerre is combined with SuperTrend, if this study plots a
# line and ST changes that bar or the next one, then it seems to be a
# decent entry.
#
# After making this observation, I'm tentatively going to scrap the momentum
# study (VACD) and just use the Laguerre RSI to decide trend and the
# Supertrend for entry. I think something along the lines of attaching that
# to RSI will be enough to decide direction and then just flag the switchover
# between up and down in ST

# RSI in Laguerre Time Self Adjusting With Fractal Energy
# Mobius
# V02.07.2014
# 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.

#Inputs:
input nFE = 13;#hint nFE: length for Fractal Energy calculation.
input Overbought = 0.80;
input Oversold = 0.20;
Input Label = Yes;
# 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;

# 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;
OS = if IsNaN(close) then Double.NaN else Oversold;
OB = if IsNaN(close) then Double.NaN else Overbought;


# Mobius
# SuperTrend
# Chat Room Request
# V03.10.2015

input AtrMult = 1.0;
input nATR = 4;
input AvgType = AverageType.HULL;
input PaintBars = no;

def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = HL2 + (AtrMult * ATR);
def DN = HL2 + (-AtrMult * ATR);
def ST = if close < ST[1] then UP else DN;
def SuperTrend = ST;

AssignPriceColor(if PaintBars and close < ST
                then GetColor(5)
                else if PaintBars and close > ST
                     then GetColor(7)
                     else Color.CURRENT);

# End Code SuperTrend

def UT = sum(RSI>OB,20);
def DT = sum(RSI<OS,20);
# End Study

#DASHBOARD
Plot RSI_ST = 1 ;
RSI_ST.AssignValueColor(if close < ST
                then GetColor(5)
                else if close > ST
                     then GetColor(7)
                     else Color.CURRENT);
RSI_ST.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
RSI_ST.SetLineWeight(3) ;

plot Buy = if UT>DT and close > ST and close[1] < ST[1] then RSI_ST else Double.Nan;
Buy.SetDefaultColor(GetColor(7));
Buy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

plot Sell = if UT<DT and close < ST and close[1] > ST[1] then RSI_ST else Double.Nan;
Sell.SetDefaultColor(GetColor(5));
Sell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

AddLabel(Label, "Trend: " + if UT>DT then "Up" else if UT<DT then "Down" else "None", if UT>DT then GetColor(1) else if UT<DT then GetColor(5) else GetColor(3));
 
When setting up as a scan I'm getting the same empty results as a many other in here have. Has anybody successfully set this up as a scan?
 
Revisiting this board to see if anyone figured out how to scan with this and produce results? I followed the above steps and got 0 results

Study Buy is true within x bars no other filters = 0 results
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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