SuperTrend BF

6147 6 922
The SuperTrend overlay by Olivier Seban provides an excellent 'trailing stop' that can be used with any bar length for bullish or bearish moves. My preferred timeframe is weekly for capturing huge (Super) moves. For instance applying it to AAPL             , this baby would have us reeling in a fivebagger over the course of three years. Patience and holding your nerve are key to trend following and I like to think of SuperTrend as a great big visual 'crutch' right there on the chart.
Essentially this is an average true range trailing stop, of which there are several versions available (eg see the Sylvain Vervoort version programmed by H Potter). SuperTrend differs by referring the stop back from the middle of the bar (High+Low)/2. This is similar to using the Vervoort with a tweak to the number of ATR's considered. At the end of the day its a matter of preference and what works best for you.
Remove from Favorite Scripts Add to Favorite Scripts
//SuperTrend - Originally by Olivier Seban
//Programmed by BlindFreddy 
study(title="SuperTrend BF", overlay = true)
Length = input(10, minval=1),
mult = input(3, type="float",minval=1)
avgTR = atr(Length)
newshortband= hl2 + avgTR * mult
newlongband= hl2 - avgTR * mult
longband=close[1]>longband[1]? max(newlongband,longband[1]) : newlongband
shortband=close[1]<shortband[1]? min(newshortband,shortband[1]) : newshortband
trend = close > shortband[1] ? 1: close< longband[1]? -1: nz(trend[1],1)
supt = trend==1? longband: shortband
dotcolor = trend==1? green: maroon
plot(supt, color= dotcolor , style=circles, linewidth=3,title="SuperTrend")

Related Ideas

ucsgears PRO
2 years ago
This is aka MQtrender - retails for 99 bucks. Good job.
blindfreddy PRO
2 years ago
Thanks kindly ucsgears.
A couple of points when using this indicator, if you're monitoring it mid-bar you may not be seeing the final position of the dot. For instance, on weekly bars if you look at a stock that's down on say Wednesday, it may be below the green and flip up to red. However if it makes a recovery back above the green dot by Friday then it will show only the green dot. It is the closing price that is used for this indicator and that is how I personally use it - I ignore mid-bar gyrations. An example on this chart would be the May 2010 earnings release, where you see the tail hanging below the green dot. Just this week I was monitoring my position in Gilead Sciences and it did a similar move where the dot flipped over to red mid-week but finished up green. If you use this indicator for setting stop-losses and you enter the stop price in the market (rather than selling manually), you could get stopped out when you didn't intend to, although this would not happen terribly often.
Also, in my copy of the script I have changed the ">" to ">=" in line 10 and the "<" to "<=" in line 11. This makes no difference apart from the once in a blue moon occasion when a stock closes at exactly the same price as the dot.
blindfreddy PRO
2 years ago
Thanks for the all the Likes people ! If you'd like to keep up with my custom Market Gauge and all my stock selections, check out my blog at
Good trading to all !
fuzzball1980 PRO
7 months ago
Hi! I got this error when trying to use the script.

Script 'SuperTrend BF' has been saved
Processing script...
Cannot read property 'value' of undefined

Any idea?

Thanks you!
blindfreddy PRO fuzzball1980
7 months ago
The script broke on a tradingview update several months back.. i republished a fixed version under same name if you just delete it and look for it again!
fuzzball1980 PRO blindfreddy
7 months ago
wil check tks!
Ideas Scripts Chart
United States
United Kingdom
Home Stock Screener Forex Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out