Supertrend Indicator by Mobius for ThinkorSwim

K

kshires4

Member
@mc01439 @danl @BenTen need some help. When I add the scan to my watchlist I just get and number. Either 1.0 or 0.0. How do I get the colors to show up?
 
S

stiffdogg06

New member
What are some decent indicators that could help with the false/small signals and filter them out?
 
K

kshires4

Member
@mc01439 How did you get the color bars. When I create the watchlist all I get is a 1.0 or 0.0 - No color
 
K

kshires4

Member
@kshires4 - Please post the code.
@mc01439

Code:
# SuperTrend Yahoo Finance Replica - Modified from Modius SuperTrend
# Modified Modius ver. by RConner7
# BULL SCANNER #
# Works similar to how Yahoo Finance Supertrend works and displays. Holds supertrend value until cross.

input AtrMult = 1.00;
input nATR = 6;
input AvgType = AverageType.HULL;
input PaintBars = yes;

def ATR = ATR("length" = nATR, "average type" = AvgType);
def UP_Band_Basic = HL2 + (AtrMult * ATR);

def LW_Band_Basic = HL2 + (-AtrMult * ATR);

def UP_Band = if ((UP_Band_Basic < UP_Band[1]) or (close[1] > UP_Band[1])) then UP_Band_Basic else UP_Band[1];

def LW_Band = if ((LW_Band_Basic > LW_Band[1]) or (close[1] < LW_Band[1])) then LW_Band_Basic else LW_Band[1];

def ST = if ((ST[1] == UP_Band[1]) and (close < UP_Band)) then UP_Band
else if ((ST[1] == UP_Band[1]) and (close > Up_Band)) then LW_Band
else if ((ST[1] == LW_Band[1]) and (close > LW_Band)) then LW_Band
else if ((ST[1] == LW_Band) and (close < LW_Band)) then UP_Band
else LW_Band;

plot ST_Cross = if (ST crosses below close) within 2 bars then 1 else 0;
 
mc01439

mc01439

Well-known member
2019 Donor
VIP
@kshires4, - try this

Code:
# SuperTrend Yahoo Finance Replica - Modified from Modius SuperTrend
# Modified Modius ver. by RConner7
# BULL SCANNER #
# Works similar to how Yahoo Finance Supertrend works and displays. Holds supertrend value until cross.

input AtrMult = 1.00;
input nATR = 6;
input AvgType = AverageType.HULL;
input PaintBars = yes;

def ATR = ATR("length" = nATR, "average type" = AvgType);
def UP_Band_Basic = HL2 + (AtrMult * ATR);

def LW_Band_Basic = HL2 + (-AtrMult * ATR);

def UP_Band = if ((UP_Band_Basic < UP_Band[1]) or (close[1] > UP_Band[1])) then UP_Band_Basic else UP_Band[1];

def LW_Band = if ((LW_Band_Basic > LW_Band[1]) or (close[1] < LW_Band[1])) then LW_Band_Basic else LW_Band[1];

def ST = if ((ST[1] == UP_Band[1]) and (close < UP_Band)) then UP_Band
else if ((ST[1] == UP_Band[1]) and (close > Up_Band)) then LW_Band
else if ((ST[1] == LW_Band[1]) and (close > LW_Band)) then LW_Band
else if ((ST[1] == LW_Band) and (close < LW_Band)) then UP_Band
else LW_Band;

plot ST_Cross = if (ST crosses below close) within 2 bars then 1 else 0;

AssignBackgroundColor(if close crosses below st
                      then Color.DARK_RED
                      else if close crosses above st
                      then Color.DARK_GREEN
                      else color.LIGHT_GRAY);
 
Last edited by a moderator:
K

kshires4

Member
@mc01439 Works Perfect !!!! Thank you so much. Would you be able to help with a triple supertrend scanner? 7/3,10/3,11/2. Have had some good results with this but would like to be able to scan for opportunities
 
Last edited:
L

lantenaccess

New member
@BenTen

Hi, I'm trying to use this code as a condition to buy automatically (when SuperTrend>0.0, see the code below):

input AtrMult = 1.0;
input nATR = 4;
input AvgType = AverageType.HULL;
input PaintBars = yes;
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;
plot SuperTrend = if ST crosses below close then +1.0 else 0.0;

If I save this as an study and add it to the condition wizard for buying, I get "rec usage is not allowed in this context"

This refers to the line "def ST = if close < ST[1] then UP else DN;" that uses recursion, and seems like ToS doesn't like it.
Is there a workaround? Like defining a period for the whole time window (day, etc.) and do the iteration instead of recursion?

I can see there's something posted here:

Will update if I can figure it out

Thanks!
 
R

rjam2020

New member
Can Supertrend be auto traded as is on TOS ?

Opens the first trade......then....... closes and opens in the other direction ?

just let it run on it's own
 
BenTen

BenTen

Administrative
Staff
VIP
@rjam2020 We already provided a backtesting code for this indicator, however, ToS does not support auto trade.
 
W

WayneG

New member
Hi all, I'm new at ThinkorSwim, I've been using another platform. I'm trying to use the Super Trend indicator, but can't find any way to get rid of the price bubble. I don't really need them, anyone have a suggestion?

Thanks, WayneG
 
Wasontilt

Wasontilt

New member
VIP
Hey, thanks for sharing this study! I'm having a small issue. Is there anyway to extend the price bubble further away from the candles? It seems to be blocking several candles around it. Or maybe make it more translucent ? Whatever you think would work and be best to still be able to see the candles.

Thanks!
 
BenTen

BenTen

Administrative
Staff
VIP
@Wasontilt You can also use this version here which replaces the bubbles with up and down arrows.
 
J

Jenna H.

New member
I started using the codes for study and watchlist.
I have a question about the numbers in the watchlist column.
What are they representing and how do you use them?
(I created 2 columns - 1 min chart, 5 min chart, both excluding extended hours trading sessions)
I read the old posts about these numbers but I didn't understand...
Can somebody help me with this?
 
markos

markos

Well-known member
VIP
I started using the codes for study and watchlist.
I have a question about the numbers in the watchlist column.
What are they representing and how do you use them?
(I created 2 columns - 1 min chart, 5 min chart, both excluding extended hours trading sessions)
I read the old posts about these numbers but I didn't understand...
Can somebody help me with this?
Hi @Jenna H. Please go to imgur.com and get the picture code and post a screenshot of what the problem is. Please place it in the Questions thread. Thanks, and Welcome.
 
J

Jenna H.

New member
Thank you @markos for the instructions! I found the tutorial on how to post images and I am reposting my question.

I started using the code for study and watchlist of supertrend.
I created 2 columns in my watchlist- 1 min chart, 5 min chart, both excluding extended hours trading sessions. I was wondering what these numbers in the columns represent?

Screenshot of my watchlist:


Code from my watchlist:
 
wtf_dude

wtf_dude

Member
Thank you @markos for the instructions! I found the tutorial on how to post images and I am reposting my question.

I started using the code for study and watchlist of supertrend.
I created 2 columns in my watchlist- 1 min chart, 5 min chart, both excluding extended hours trading sessions. I was wondering what these numbers in the columns represent?

Screenshot of my watchlist:


Code from my watchlist:
Looks like its counting bars since triggered. So red with a 4 would be mean that it turned red 4 (bars,minutes, days, etc) ago
 

Top