j1O9SB

SuperTrend Oscillator v3

Version 3: Improved aesthetically, complete turnaround for the strategy with which to use this indicator.
Once again, thanks to BlindFreddy and ChrisMoody for the bits of code that were assembled into this indicator.
Make the chart yours using the share button for the indicator with barcolors functionality.
Changes from v2 and looking forward: Indicator now uses a 14 length SuperTrend with no ATR multiplier. This my preferred use and I'd be grateful to hear your case for a different length/multiplier. Removed the Bollinger Bands and retracement dots due to these being gimmicky and marginally useful. There may be a version 4 should a similar concept using a rate of change analysis turn out to be useful. I have also tried -in vain- to plot internal trend peaks as horizontal S/R levels. Please pm if you are willing to help in that respect.
Strategy: The indicator will display the trend as a red/green area. It measures the spread between the closing price and the SuperTrend line, much like a CCI (close and ma). When the area contracts warning bars of the opposite trend color will warn of a reversal. When this happens, these areas will either be defended, reviving the trend, or will break, causing a trend flip. SuperTrend is unique in that breaks are typically large candles, and that its levels, especially on Weekly, Daily, Hourly, Minute timeframes, these levels will be defended (think similar to a 200sma or a 21ema). The STO             making new highs within (internal) a trend is an overextension sign.
CVX             Example: This is not a full analysis of CVX's stock , just an example potential trades. On the posted chart I used a weekly and a daily STO             .
Long 1:The weekly showed warnings and then flipped. The daily made a double bottom , showed warnings and then flipped the daily STO             at trendline support.
Long 2:The weekly still shows an uptrend, the daily made a weak break to downtrend and reversed back upwards at trendline support, forming a double bottom . Note the conservative exit when the STO             made an internal new high.
Long 3: looking forward on CVX             stock , the current downtrend made a weak break and is showing sings of reversal ( pin bar ) at horizontal support. Go long on flip of the daily (conservative) or flip of the hourly (aggressive).
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title="SuperTrend Oscillator",shorttitle="STO",overlay=false)
//Inputs
spt_ures=input(false,title="Use Cutsom Resolution?")
spt_res=input(type=resolution,defval="M")
spt_lenw=input(200,title="Length Of Warning Range")
spt_len=input(14,title="SuperTrend Length")
spt_mult=input(1,title="SuperTrend Multiple")
spt_ubc=input(true,title="Use Barcolors?")
colup=green
coldn=red
//SuperTrend
spt_atr=atr(spt_len)
spt_nsb=hl2+spt_atr*spt_mult
spt_nlb=hl2-spt_atr*spt_mult
spt_lb=close[1]>spt_lb[1]?max(spt_nlb,spt_lb[1]):spt_nlb
spt_sb=close[1]<spt_sb[1]?min(spt_nsb,spt_sb[1]):spt_nsb
spt_tdur=close>spt_sb[1]?1:close<spt_lb[1]?-1:nz(spt_tdur[1],1)
spt_td=spt_ures?(security(tickerid,spt_res,spt_tdur)):spt_tdur
spt_lvlur=(close-(spt_td==1?spt_lb:spt_sb))
spt_lvl=spt_ures?(security(tickerid,spt_res,spt_lvlur)):spt_lvlur
//Components
spt_lvlup=spt_td==1?spt_lvl:na
spt_lvldn=spt_td==-1?spt_lvl:na
spt_tdup=(spt_td==1)and(spt_td[1]==-1)
spt_tddn=(spt_td==-1)and(spt_td[1]==1)
spt_tr=spt_ures?(security(tickerid,spt_res,tr)):tr
spt_matr=sma(abs(spt_lvl),200)
spt_cls=spt_ures?(security(tickerid,spt_res,close)):close
spt_lvlwup=(spt_lvlup<spt_matr)and(spt_cls<spt_cls[1])
spt_lvlwdn=(spt_lvldn>-spt_matr)and(spt_cls>spt_cls[1])
//Color
spt_col=spt_td==1?colup:coldn
spt_colbar=(spt_td==1)and(spt_lvlwup)?#A7D1AA:(spt_td==-1)and(spt_lvlwdn)?#D1A7AE:spt_td==1?colup:coldn
spt_colhst=spt_tdup?colup:spt_tddn?coldn:spt_lvlwdn?colup:spt_lvlwup?coldn:na
//Plot
p0=plot(0,color=spt_col,style=line,linewidth=1,transp=0,title="Midline")
p1=plot(spt_lvlup,color=colup,style=linebr,linewidth=1,transp=0,title="Uptrend Line")
p2=plot(spt_lvldn,color=coldn,style=linebr,linewidth=1,transp=0,title="Downtrend Line")
plot(spt_lvl,color=spt_colhst,style=histogram,linewidth=3,transp=0,title="Trend Change")
plot(spt_lvl,color=spt_colhst,style=circles,linewidth=2,transp=0,title="Trend Change")
fill(p0,p1,color=colup,transp=90)
fill(p0,p2,color=red,transp=90)
barcolor(spt_ubc?spt_colbar:na)
BTCTTM
a year ago
Nice!
+1 Reply
stockspy PRO
5 months ago
This indicator is great. I really like it. Appears that it's quite similar to the way that Aroon works. This is a bit fancier.
+1 Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock 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