Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=2
- strategy("Supertrend Cloud", overlay = true)
- Multiplier=input(3, minval=1,maxval = 100)
- Periods=input(10, minval=1,maxval = 100)
- Multiplierx2=input(6, minval=1,maxval = 100)
- Periodx2=input(10, minval=1,maxval = 100)
- Up=hl2-(Multiplier*atr(Periods))
- Dn=hl2+(Multiplier*atr(Periods))
- Upx2=hl2-(Multiplierx2*atr(Periodx2))
- Dnx2=hl2+(Multiplierx2*atr(Periodx2))
- TrendUp=close[1]>TrendUp[1]? max(Up,TrendUp[1]) : Up
- TrendDown=close[1]<TrendDown[1]? min(Dn,TrendDown[1]) : Dn
- TrendUpx2=close[1]>TrendUpx2[1]? max(Upx2,TrendUpx2[1]) : Upx2
- TrendDownx2=close[1]<TrendDownx2[1]? min(Dnx2,TrendDownx2[1]) : Dnx2
- Trend = close > TrendDown[1] ? 1: close< TrendUp[1]? -1: nz(Trend[1],1)
- Tsl = Trend==1? TrendUp: TrendDown
- Trendx2 = close > TrendDownx2[1] ? 1: close< TrendUpx2[1]? -1: nz(Trendx2[1],1)
- Tslx2 = Trendx2==1? TrendUpx2: TrendDownx2
- linecolor = Trend == 1 ? green : red
- linecolorx2 = Trendx2 == 1 ? green : red
- short = plot(Tsl, color = linecolor , style = line , linewidth = 2,title = "SuperTrend")
- long = plot(Tslx2, color = linecolorx2 , style = line , linewidth = 1,title = "SuperTrend x2")
- fill(short, long, color = aqua, title = "Cloud")
- plotshape(cross(close,Tsl) and close>Tsl , "Up Arrow", shape.triangleup,location.belowbar,green,0,0)
- plotshape(cross(Tsl,close) and close<Tsl , "Down Arrow", shape.triangledown , location.abovebar, red,0,0)
- plotshape(cross(close,Tslx2) and close>Tslx2 , "Up Arrow", shape.triangleup,location.belowbar,green,0,0)
- plotshape(cross(Tslx2,close) and close<Tslx2 , "Down Arrow", shape.triangledown , location.abovebar, red,0,0)
- fill(short, long, color = aqua, title = "Cloud")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement