SuperTrend BF

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.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?
//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")


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 fuzzball1980
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 blindfreddy
wil check tks!
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 !
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.
nuovibusiness blindfreddy
@blindfreddy, Your script is not working. Is there a way to fix it?
blindfreddy nuovibusiness
@nuovibusiness, see my reply to similar question above. There are two versions with the same name 'Supertrend BF', choose the one with less likes. I think now i can revise old scripts, must look into that..
This is aka MQtrender - retails for 99 bucks. Good job.
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Private Messages Chat Sign Out