add new works ...
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
//@version=5
|
||||
indicator("Supertrend", overlay = true, timeframe = "", timeframe_gaps = true)
|
||||
|
||||
atrPeriod = input.int(10, "ATR Length", minval = 1)
|
||||
factor = input.float(3.0, "Factor", minval = 0.01, step = 0.01)
|
||||
|
||||
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
|
||||
|
||||
supertrend := barstate.isfirst ? na : supertrend
|
||||
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style = plot.style_linebr)
|
||||
downTrend = plot(direction < 0 ? na : supertrend, "Down Trend", color = color.red, style = plot.style_linebr)
|
||||
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, "Body Middle",display = display.none)
|
||||
|
||||
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps = false)
|
||||
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps = false)
|
||||
|
||||
alertcondition(direction[1] > direction, title='Downtrend to Uptrend', message='The Supertrend value switched from Downtrend to Uptrend ')
|
||||
alertcondition(direction[1] < direction, title='Uptrend to Downtrend', message='The Supertrend value switched from Uptrend to Downtrend')
|
||||
alertcondition(direction[1] != direction, title='Trend Change', message='The Supertrend value switched from Uptrend to Downtrend or vice versa')
|
||||
Reference in New Issue
Block a user