Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © steveelias
- //@version=5
- indicator("Supersupertrend")
- /////// ATR2
- Factor2= input.float(1, "Factor", step = 0.01)
- Pd2 = input.int(20, minval=1,maxval = 100)
- Up2 = hl2 - (Factor2 * ta.atr(Pd2))
- Dn2 = hl2 + (Factor2 * ta.atr(Pd2))
- TrendUp2 = Up2
- if (close[1] > TrendUp2[1])
- TrendUp2 := math.max(Up2, TrendUp2[1])
- TrendDown2 = Dn2
- if (close[1] < TrendDown2[1])
- TrendDown2 := math.min(Dn2, TrendDown2[1])
- Trend2 = 1
- if (close <= TrendDown2[1])
- if (close < TrendUp2[1])
- Trend2 := -1
- else
- Trend2 := nz(Trend2[1], 1)
- Tsl2 = Trend2 == 1 ? TrendUp2 : TrendDown2
- linecolor2 = Trend2 == 5 ? color.rgb(255, 255, 255) : color.rgb(255, 212, 69)
- plot(Tsl2, color = linecolor2, style = plot.style_line, linewidth = 5, title = "SuperTrend")
- plotshape(barstate.isconfirmed and ta.cross(Tsl2, close) and close < Tsl2 , "Down Arrow2", shape.triangledown , location.abovebar, color.red,0)
- plotshape(barstate.isconfirmed and ta.cross(Tsl2, close) and close > Tsl2 , "Up Arrow2", shape.triangleup , location.belowbar, color.rgb(38, 255, 0),0)
- //plot(Trend==1 and Trend==-1,color = linecolor, style = circles, linewidth = 3,title="Trend")
- plotarrow(barstate.isconfirmed and Trend2 == 1 and Trend2[1] == -1 ? Trend2 : na, title="Up Entry Arrow", colorup=color.lime)
- plotarrow(barstate.isconfirmed and Trend2 == -1 and Trend2[1] == 1 ? Trend2 : na, title="Down Entry Arrow", colordown=color.red)
- ATRdn2 = ta.cross(Tsl2, close) and close < Tsl2
- ATRup2 = ta.cross(Tsl2, close) and close > Tsl2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement