Triple Supertrend
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © venkatachari_n

//@version=5
indicator("Triple Supertrend", overlay=true, timeframe="", timeframe_gaps=true)

atrPeriod1 = input(10, "ATR Length")
factor1 = input.float(1.0, "Factor", step = 0.01)

[supertrend1, direction1] = ta.supertrend(factor1, atrPeriod1)

bodyMiddle1 = plot((open + close) / 2, display=display.none)
upTrend1 = plot(direction1 < 0 ? supertrend1 : na, "Up Trend", color = color.green, style=plot.style_linebr)
downTrend1 = plot(direction1 < 0? na : supertrend1, "Down Trend", color = color.red, style=plot.style_linebr)

//fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps=false)
//fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps=false)

atrPeriod2 = input(11, "ATR Length")
factor2 = input.float(2.0, "Factor", step = 0.01)

[supertrend2, direction2] = ta.supertrend(factor2, atrPeriod2)

bodyMiddle2 = plot((open + close) / 2, display=display.none)
upTrend2 = plot(direction2 < 0 ? supertrend2 : na, "Up Trend", color = color.green, style=plot.style_linebr)
downTrend2 = plot(direction2 < 0? na : supertrend2, "Down Trend", color = color.red, style=plot.style_linebr)


atrPeriod3 = input(12, "ATR Length")
factor3 = input.float(3.0, "Factor", step = 0.01)

[supertrend3, direction3] = ta.supertrend(factor3, atrPeriod3)

bodyMiddle3 = plot((open + close) / 2, display=display.none)
upTrend3 = plot(direction3 < 0 ? supertrend3 : na, "Up Trend", color = color.green, style=plot.style_linebr)
downTrend3 = plot(direction3 < 0? na : supertrend3, "Down Trend", color = color.red, style=plot.style_linebr)


