First and foremost, thanks to whomever's code or scraps of code was borrowed to make this.
-BlindFreddy's SuperTrend BF
-LazyBear's ATR Pips
//Explanation (for the workings of the oscillator open up the editor)
The oscillator displays on its midline and on the histogram bars the SuperTrend trend. The histogram's top changes color based its slope. Purple Histogram bars are denoted extreme levels, marking an extreme distance between price and trend, and will often retrace or consolidate (though not always, this is purely contextual). To help visualize possible retracements, dots on the histogram's top appear to signal that both the trend's slope and price are moving against the trend for as much as five periods after an extreme level is signaled. It should be noted that trend reversals
usually flash purple because the SuperTrend multiplier will make the oscillator jump more than price moved.
This indicator displays the difference between price (close) and the SuperTrend line to gauge price momentum relative to the (super)trend. Much like the ( ) the STO will detect emerging trends or trend exhaustion. It is however superior to the in that the SuperTrend basis will detect and maintain its direction towards the trend. It will show highs and lows relative to the trend, often allowing you to anticipate breakouts/downs.
On this chart I demonstrated what I believe (so far) to be its best uses; I map trend support/resist levels on the oscillator (here on the daily) and transpose them onto price. The trend support/resist levels will give me an indication of the trend's momentum relative to price; if these are broken the trend is failing. The price transposed S&R levels show where the momentum gains were made; these are key trend levels that are often broken shortly after their STO counterparts break.
I plot minor S&R levels in gray; they mark single periods where the trend advanced .
I plot major S&R levels in white; they mark multiple periods of trend advancement and are often key to maintaining the trend.
I displayed two trades here that were executed using the older version of the STO (accompanied by other indicators and further research).
The first is a short with an anticipated right shoulder fall, confirmed by the trend breaking to new lows. The target was a 38.2% fib retracement target.
The second is a rising wedge/double bottom long with an anticipated local resistance break, confirmed by a trend resist test (break anticipated). The target was the aforementioned right shoulder high.
Note that these trades where set up independently of the STO, but that it was instrumental to anticipating price action relative to S&R levels. Note also that retracement dots came in too early for both trades, but effectively warned of price consolidation.
Trading range in teal, SuperTrend profit in blue and STO profit in purple.
These were interesting trades I came across while paper trading/backtesting the oscillator.
An example of whipsawing price made easy to trade. When the market only gives you odd spikes retracement dots work very well.
I entered the trade on the basis that price attempted to form an higher but failed and broke an S&R level.
I often exit trades when on top of retracement dots and the STO displays higher highs (like the exit here) or lower lows.
An example here of a trend emerging and being confirmed by a break.
//Thank you to whomever's code or scraps of code was borrowed to make this (borrowed from LazyBear, blindfreddy, ChrisMoody and perhaps others) //Green/red historgram is the supertrend trend //Green/red line (slope of the histogram) is movement of price relative to the supertrend line //Purple for extreme moves -> they often retrace/consolidate, especially on larger timeframes study(title="SuperTrend Oscillator",overlay = false) //Inputs useCurrentRes = input(true, title="Use Current Chart Resolution?") resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=resolution, defval="240") res = useCurrentRes ? period : resCustom ebc=input(false, title="Paint Extreme Bars Purple?") urc=input(true, title="Use Retracement Circles?") uah=input(true, title="Display Trend On Histogram?") length = input(12, minval=1, title="SuperTrend Length") lengthema = input(12, minval=1, title="EMA Length") lengthbb = input(12, minval=1, title="BB Length") mult = input(3, type="float",minval=1, title="SuperTrend Multiplier") sb=input(true, title="Use BB") m = input(2, minval=1, maxval=50, title="BB Multiplier") //SuperTrend code avgTR = atr(length) newshortband= hl2 + avgTR * mult newlongband= hl2 - avgTR * mult longband=close>longband? max(newlongband,longband) : newlongband shortband=close<shortband? min(newshortband,shortband) : newshortband trendres = close > shortband ? 1: close< longband? -1: nz(trendres,1) trend = security(tickerid, res, trendres) suptres = trend==1? longband: shortband supt = security(tickerid, res, suptres) //SuperTrend Oscillator code sptres = (close - supt) spt = security(tickerid, res, sptres) //EMA of SuperTrend code sptemares = ema(spt, lengthema) sptema = security(tickerid, res, sptemares) //Bollinger Bands of Supertrend Oscillator code basisres = sb?sma(spt, lengthbb):na basis = security(tickerid, res, basisres) devres = sb?m * stdev(spt, lengthbb):na dev = security(tickerid, res, devres) upper = sb ? (basis + dev) : na lower = sb ? (basis - dev) : na //Slope slope_spt_level_up1 = (spt) > (spt)  slope_spt_level_down1 = (spt) < (spt)  slope_spt_level_up2 = (spt) > (spt)  slope_spt_level_down2 = (spt) < (spt)  slope_spt_level_up3 = (spt) > (spt)  slope_spt_level_down3 = (spt) < (spt)  slope_spt_level_up4 = (spt) > (spt)  slope_spt_level_down4 = (spt) < (spt)  slope_spt_level_up5 = (spt) > (spt)  slope_spt_level_down5 = (spt) < (spt)  slope_spt_level_up6 = (spt) > (spt)  slope_spt_level_down6 = (spt) < (spt)  slope_spt_level_up7 = (spt) > (spt)  slope_spt_level_down7 = (spt) < (spt)  slope_spt_level_up8 = (spt) > (spt)  slope_spt_level_down8 = (spt) < (spt)  slope_spt_level_up9 = (spt) > (spt)  slope_spt_level_down9 = (spt) < (spt)  slope_spt_level_up10 = (spt) > (spt)  slope_spt_level_down10 = (spt) < (spt)  //Trend uptrendextreme = (spt>0) and (spt>upper) downtrendextreme = (spt<0) and (spt<lower) trendextreme = uptrendextreme or downtrendextreme trendwarningup1=(uptrendextreme and (close<close) and (trend==1) and slope_spt_level_down1) trendwarningup2=(uptrendextreme and (close<close) and (trend==1) and slope_spt_level_down1) trendwarningup3=(uptrendextreme and (close<close) and (trend==1) and slope_spt_level_down1) trendwarningup4=(uptrendextreme and (close<close) and (trend==1) and slope_spt_level_down1) trendwarningup5=(uptrendextreme and (close<close) and (trend==1) and slope_spt_level_down1) trendwarningdown1=(downtrendextreme and (close>close) and (trend==-1) and slope_spt_level_up1) trendwarningdown2=(downtrendextreme and (close>close) and (trend==-1) and slope_spt_level_up1) trendwarningdown3=(downtrendextreme and (close>close) and (trend==-1) and slope_spt_level_up1) trendwarningdown4=(downtrendextreme and (close>close) and (trend==-1) and slope_spt_level_up1) trendwarningdown5=(downtrendextreme and (close>close) and (trend==-1) and slope_spt_level_up1) //Color spt_color = slope_spt_level_down1?red:slope_spt_level_up1?lime:slope_spt_level_down2?red:slope_spt_level_up2?lime:slope_spt_level_down3?red:slope_spt_level_up3?lime:slope_spt_level_down4?red:slope_spt_level_up4?lime:slope_spt_level_down5?red:slope_spt_level_up5?lime:slope_spt_level_down6?red:slope_spt_level_up6?lime:slope_spt_level_down7?red:slope_spt_level_up7?lime:slope_spt_level_down8?red:slope_spt_level_up8?lime:slope_spt_level_down9?red:slope_spt_level_up9?lime:slope_spt_level_down10?red:slope_spt_level_up10?lime:white midcolor = trend==1? green: maroon histcolor = uah?(trendextreme?purple:trend==1? green: maroon):(trendextreme?purple:na) extremebarcolor = trendextreme?purple:na trendwarningcolor=trendwarningup1?orange:trendwarningdown1?blue:trendwarningup2?orange:trendwarningdown2?blue:trendwarningup3?orange:trendwarningdown3?blue:trendwarningup4?orange:trendwarningdown4?blue:trendwarningup5?orange:trendwarningdown5?blue:na //Plots plot(spt, color= histcolor , style=histogram, linewidth=1,title="Histogram", editable=true) p1=plot(spt, color= spt_color , style=line, linewidth=2,title="SuperTrend", editable=true) p2=plot(0, style=line, linewidth=2, color=midcolor,title="Midline", editable=true) plot(urc?spt:na,style=circles,linewidth=3, color=trendwarningcolor, editable=true) barcolor(ebc?extremebarcolor:na)