Archived: Supertrend Indicator by Mobius for ThinkorSwim

Status
Not open for further replies.
@mc01439 Is there anyway of getting a scanner for a triple supertrend with these settings 12,3 11,2 10,1
Use this code in the scanner with the study code below.

mbhSuperTrend_Scan_Only("atr mult" = 3.0, "atr length" = 12)."BUY" is true and mbhSuperTrend_Scan_Only("atr mult" = 2.0, "atr length" = 11)."BUY" is true and mbhSuperTrend_Scan_Only("atr mult" = 1.0, "atr length" = 10)."BUY" is true

http://tos.mx/Y7KSocH
 

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

@BenTen

Do you have a replacement code for the below if I want Arrow Up (green) and Arrow Down (red) instead of the price bubble for the desktop version? Thanks in advance!

AddChartBubble(close crosses below ST, low[1], low[1], Color.DARK_GRAY);
AddChartBubble(close crosses above ST, high[1], high[1], Color.DARK_GRAY, no);
 
@HOVA This will plot up and down arrows for the signals.

Code:
plot bullish = if close crosses above ST then low[1] else double.nan;
plot bearish = if close crosses below ST then low[1] else double.nan;
bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullish.SetDefaultColor(Color.CYAN);
bullish.SetLineWeight(1);
bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearish.SetDefaultColor(Color.CYAN);
bearish.SetLineWeight(1);
 
Use this code in the scanner with the study code below.

mbhSuperTrend_Scan_Only("atr mult" = 3.0, "atr length" = 12)."BUY" is true and mbhSuperTrend_Scan_Only("atr mult" = 2.0, "atr length" = 11)."BUY" is true and mbhSuperTrend_Scan_Only("atr mult" = 1.0, "atr length" = 10)."BUY" is true

http://tos.mx/Y7KSocH
Getting error message when using the link
 
@kshires4
copy and paste the below code, if you can't get the link to work for you.
make sure to save the study w/ the name: mbhSuperTrend_Scan_Only

Code:
declare lower;

def AggregationPeriod = GetAggregationPeriod();
#hint: thinkScript adaptation of SuperTrend. The speed of the trend changes are controlled by adjusting the ATR input parameters.
#hint atrMult: Multiple to scale the Average True Range (ATR) value. (Smaller numbers will produce faster trend changes.)
input atrMult = 2.5;
#hint atrLength: ATR moving average period length.
input atrLength = 14;
#hint atrType: ATR moving average type
input atrType = AverageType.WILDERS;
#hint pivot/price: Bar pivot used for trend points. (Default is hl2)
input pivot = hl2;
def atr = MovingAverage(atrType, TrueRange(high, close, low), atrLength) * atrMult;
def prUp = pivot + atr;
def prDn = pivot - atr;
# rTrend stores the current trend value and direction. (The direction is currently up if rTrend[1] is positive and down if rTrend[1] is negative, therefore AbsValue is used to compare rTrend values when the trend is down.)
def rTrend = compoundValue(1,
  # Trending Up
    if rTrend[1] > 0 then
      # If close is below trend then switch to downtrend (negative)
        if close < Max(prDn[1], rTrend[1]) then -prUp
      # ...else adjust new uptrend value. 
        else Max(prDn, rTrend[1])
  # Trending Down
    else if rTrend[1] < 0 then
      # If close is above trend then switch to uptrend (positive)
        if close > Min(prUp[1], AbsValue(rTrend[1])) then prDn
      # ...else adjust new downtrend value.
        else -Min(prUp, AbsValue(rTrend[1]))
    else rTrend[1]
, pivot);
# The Trend plot skips a bar whenever the trend direction changes.
def Trend = if Sign(rTrend) == Sign(rTrend[1]) then absValue(rTrend) else Double.NaN;


###############################
##### Orders Conditions   #####
###############################
def Bull = rTrend > 0  and rTrend[1] < 0;
def Bear = rTrend < 0 and rTrend[1] > 0;

plot BUY = Bull;
plot SELL = Bear;
 
Sorry a newbie here. I have tried scanning through all 19 pages and am confused on a couple points
  • whats the latest script for the Supertrend signal
  • I hear mention of the script for the scanner and the watchlist. IS that differnt than the signal script? Do i need to post the script for the signal and manually create the scanner and watchlist OR are there separate scripts for the scanner and the wartchlist that I can paste directly?

Sorry for the newbie type question...TIA
 
@jderasari There are different versions of the Supertrend indicator (some with additional features). If you want to get the standard Supertrend version, the code on the first page will give you that.

Start by importing the indicator and scanner. Come back with any errors/issues you may have, and we'll help.
 
@xad I'm no longer using this indicator to trade. The 1.0 and 0.7 are just the length for the AtrMult variable. You can try them both and see which one provides better signals.
Hey BenTen, I just joined ! This forum is great ! I have read through all 20 pages here in the hopes that I do not ask a repeating question. I saw in a previous post you said "I'm no longer using this indicator to trade." Were you referring to the supertrend scanner or the supertrend chart indicator ? And if you are not using the indicator/scanner, what do you use now ? Thank you in advance !
 
@.redddd Hey, I'm no longer using Supertrend (this includes the indicator and scanner). The only indicator I'm using at the moment is our Buy the Dip indicator. You can find it here.
 
Hi, I am on a trial of Abletrend 7, and read that the supertrend indicator is just about the same thing. I have attached a chart snapshot of the software, as they recommend using multiple time frames plotted on the same chart. For daytrading, a 3 min and 9 min are recommended. The sales specialist does a 15 minute one-on-one, which is not really needed if you've watched their youtube channel. Also, there are different types of signals, and other features of the software that there is no video or live training available. The bar color is the first signal, and the big dot either blue or red(down) is the beginning of new buy/sell signal. The small dots are the smaller time frame line in the sand, and the crosses the higher TF. The trainer said the dots appear "almost magically" and the price action stops there or the trend is over and you are stopped out. They have no backtests available, which ****s. It is fun, but your supertrend is so close except for the big dots on the price bars. He also said that after a signal if the price is too far from the dots, wait for a pullback to them(the "sweetspot") as is lowest risk. If you have both red and blue mixed signals, that keeps you out of congestion. Take a look at the screenshot and if you want, tell me what you think is going on here.

EBEE58c.png
it looks like an atr trailing stop with different settings or different time frames, so a quicker setting and a longer setting. a recomendation would be line 5, 3.5, and then for the longer time period, play around with it.
 
DO you know of a way to add arrows though? ive been trying and the problem I face is that it adds arrows to every single candle and I only want an arrow at the first candle in which the momentum changes directions and the candle stick colour changes.
Code:
plot arrowup = close crosses above ST;
arrowup.SetDefaultColor(Color.GREEN);
arrowup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
 
Hello, this indicator is created by morbius; the super trend indicator. I have modified it so that it creates chimes and dots (which can be changed to anything you prefer such as wedges, arrows, or nothing).

The best settings are 0.7 atr multiplier and thats it.

I have been granted 100% permission by morbius himself, the original creator of super trend, to re-release this code for free. This is not my algo.

here is the code.

Code:
# Mobius
# SuperTrend
# Chat Room Request
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 = ST;

SuperTrend.AssignValueColor(if close < ST then Color.GREEN else color.RED);

AssignPriceColor(if PaintBars and close < ST

                 then Color.RED

                 else if PaintBars and close > ST

                      then Color.GREEN

                      else Color.CURRENT);

#AddChartBubble(close crosses below ST, low[1], low[1], #color.Dark_Gray);
#AddChartBubble(close crosses above ST, high[1], high[1], #color.Dark_Gray, no);
# End Code SuperTrend# Mobius
# SuperTrend
# Chat Room Request

plot SuperTrendUp = close crosses above ST;
plot SuperTrendDown = close crosses below ST;
SuperTrend.AssignValueColor(if close < ST then Color.RED else Color.GREEN);
SuperTrendUp.SetDefaultColor(Color.YELLOW);
SuperTrendUp.setPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
SuperTrendDown.SetDefaultColor(Color.PINK);
SuperTrendDown.setPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

def bullish = close crosses below ST;
def bearish = close crosses above ST;

# Alerts
Alert(bullish, " ", Alert.Bar, Sound.Chimes);
Alert(bearish, " ", Alert.Bar, Sound.Bell);
 
I am trying to setup this watchlist, but when i add the code to the thinkscript editor under scanner custom filter, it says AddLabel is not allowed in this context.

You will have better luck if you were to reference the Study via the Conditional Wizard rather than Copy & Paste it into the Thinkscript editor... Reference the Study and pick the plot you desire to use... That will eliminate the need to modify the original code...
 
You will have better luck if you were to reference the Study via the Conditional Wizard rather than Copy & Paste it into the Thinkscript editor... Reference the Study and pick the plot you desire to use... That will eliminate the need to modify the original code...
I trying that, i am not having any success, I set the condition to SuperTrendDown is true within 1 bars and it comes up with nothing. It comes up with nothing no matter what i change the number of bars to. Sorry to be a bother, still trying to figure this all out.
 
Status
Not open for further replies.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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