// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © kimteagyun0413
//@version=6
indicator("2 Supertrend", overlay = true)
// Supertrend 1 Configuration (Fast/Sensitive) / Supertrend 1 설정 (빠름/민감)
atrPeriod1 = input.int(10, "ATR Length 1", minval = 1)
factor1 = input.float(1.2, "Factor 1", minval = 0.01, step = 0.01)
[supertrend1, direction1] = ta.supertrend(factor1, atrPeriod1)
supertrend1 := barstate.isfirst ? na : supertrend1
// Plot Supertrend 1 lines / Supertrend 1 라인 표시
upTrend1 = plot(direction1 < 0 ? supertrend1 : na, "Up Trend 1", color = color.green, style = plot.style_linebr)
downTrend1 = plot(direction1 < 0 ? na : supertrend1, "Down Trend 1", color = color.red, style = plot.style_linebr)
// Supertrend 2 Configuration (Slow/Conservative) / Supertrend 2 설정 (느림/보수적)
atrPeriod2 = input.int(10, "ATR Length 2", minval = 1)
factor2 = input.float(3.0, "Factor 2", minval = 0.01, step = 0.01)
[supertrend2, direction2] = ta.supertrend(factor2, atrPeriod2)
supertrend2 := barstate.isfirst ? na : supertrend2
// Plot Supertrend 2 lines / Supertrend 2 라인 표시
upTrend2 = plot(direction2 < 0 ? supertrend2 : na, "Up Trend 2", color = color.lime, style = plot.style_linebr)
downTrend2 = plot(direction2 < 0 ? na : supertrend2, "Down Trend 2", color = color.maroon, style = plot.style_linebr)
// Supertrend 3 Configuration (Optional - Currently Commented Out) / Supertrend 3 설정 (선택사항 - 현재 주석 처리됨)
// atrPeriod3 = input.int(10, "ATR Length 3", minval = 1)
// factor3 = input.float(10.0, "Factor 3", minval = 0.01, step = 0.01)
// [supertrend3, direction3] = ta.supertrend(factor3, atrPeriod3)
// supertrend3 := barstate.isfirst ? na : supertrend3
// upTrend3 = plot(direction3 < 0 ? supertrend3 : na, "Up Trend 3", color = color.teal, style = plot.style_linebr)
// downTrend3 = plot(direction3 < 0 ? na : supertrend3, "Down Trend 3", color = color.purple, style = plot.style_linebr)
// Calculate body middle point for background fill reference / 배경 채우기 기준점으로 바디 중간점 계산
bodyMiddle = plot(barstate.isfirst ? na : (open + close) / 2, "Body Middle", display = display.none)
// Calculate and plot 200-period EMA as trend baseline / 추세 기준선으로 200일 EMA 계산 및 표시
ema200 = ta.ema(close,200)
plot(ema200, color = color.white, linewidth = 3)
// Background fills for Supertrend 1 / Supertrend 1 배경 채우기
fill(bodyMiddle, upTrend1, title = "Uptrend 1 background", color = color.new(color.green, 90), fillgaps = false)
fill(bodyMiddle, downTrend1, title = "Downtrend 1 background", color = color.new(color.red, 90), fillgaps = false)
// Background fills for Supertrend 2 / Supertrend 2 배경 채우기
fill(bodyMiddle, upTrend2, title = "Uptrend 2 background", color = color.new(color.lime, 90), fillgaps = false)
fill(bodyMiddle, downTrend2, title = "Downtrend 2 background", color = color.new(color.maroon, 90), fillgaps = false)
// Background fills for Supertrend 3 (Optional - Currently Commented Out) / Supertrend 3 배경 채우기 (선택사항 - 현재 주석 처리됨)
// fill(bodyMiddle, upTrend3, title = "Uptrend 3 background", color = color.new(color.teal, 90), fillgaps = false)
// fill(bodyMiddle, downTrend3, title = "Downtrend 3 background", color = color.new(color.purple, 90), fillgaps = false)