커뮤니티

부탁드립니다 항상 감사합니다

프로필 이미지
윤호석
2025-09-13 16:15:44.0
89
글번호 193981
답변완료
//@version=6 indicator(title="Multiple Moving Averages & 3 Bollinger Bands", shorttitle="Multi MA & 3 BB", overlay=true) ​ // Function to calculate different types of Moving Averages ma(source, length, type) => float result = na switch type "SMA" => result = ta.sma(source, length) "EMA" => result = ta.ema(source, length) "WMA" => result = ta.wma(source, length) "RMA" => result = ta.rma(source, length) "VWMA" => result = ta.vwma(source, length) result ​ // --- Moving Average Settings --- GRP_MA1 = "Moving Average 1" ma1_enable = input.bool(true, "Enable MA 1", group=GRP_MA1) ma1_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA1) ma1_length = input.int(20, "Length", minval=1, group=GRP_MA1) ma1_color = input.color(color.blue, "Color", group=GRP_MA1) ma1 = ma(close, ma1_length, ma1_type) plot(ma1_enable ? ma1 : na, title="MA 1", color=ma1_color, linewidth=2, display=display.all) ​ GRP_MA2 = "Moving Average 2" ma2_enable = input.bool(true, "Enable MA 2", group=GRP_MA2) ma2_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA2) ma2_length = input.int(30, "Length", minval=1, group=GRP_MA2) ma2_color = input.color(color.orange, "Color", group=GRP_MA2) ma2 = ma(close, ma2_length, ma2_type) plot(ma2_enable ? ma2 : na, title="MA 2", color=ma2_color, linewidth=2, display=display.all) ​ GRP_MA3 = "Moving Average 3" ma3_enable = input.bool(true, "Enable MA 3", group=GRP_MA3) ma3_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA3) ma3_length = input.int(60, "Length", minval=1, group=GRP_MA3) ma3_color = input.color(color.purple, "Color", group=GRP_MA3) ma3 = ma(close, ma3_length, ma3_type) plot(ma3_enable ? ma3 : na, title="MA 3", color=ma3_color, linewidth=2, display=display.all) ​ GRP_MA4 = "Moving Average 4" ma4_enable = input.bool(false, "Enable MA 4", group=GRP_MA4) ma4_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA4) ma4_length = input.int(120, "Length", minval=1, group=GRP_MA4) ma4_color = input.color(color.black, "Color", group=GRP_MA4) ma4 = ma(close, ma4_length, ma4_type) plot(ma4_enable ? ma4 : na, title="MA 4", color=ma4_color, linewidth=2, display=display.all) ​ GRP_MA5 = "Moving Average 5" ma5_enable = input.bool(false, "Enable MA 5", group=GRP_MA5) ma5_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA5) ma5_length = input.int(240, "Length", minval=1, group=GRP_MA5) ma5_color = input.color(color.new(color.green, 20), "Color", group=GRP_MA5) ma5 = ma(close, ma5_length, ma5_type) plot(ma5_enable ? ma5 : na, title="MA 5", color=ma5_color, linewidth=1, display=display.all) ​ GRP_MA6 = "Moving Average 6" ma6_enable = input.bool(false, "Enable MA 6", group=GRP_MA6) ma6_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA6) ma6_length = input.int(400, "Length", minval=1, group=GRP_MA6) ma6_color = input.color(color.new(color.red, 20), "Color", group=GRP_MA6) ma6 = ma(close, ma6_length, ma6_type) plot(ma6_enable ? ma6 : na, title="MA 6", color=ma6_color, linewidth=1, display=display.all) ​ GRP_MA7 = "Moving Average 7" ma7_enable = input.bool(false, "Enable MA 7", group=GRP_MA7) ma7_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA7) ma7_length = input.int(600, "Length", minval=1, group=GRP_MA7) ma7_color = input.color(color.new(color.teal, 20), "Color", group=GRP_MA7) ma7 = ma(close, ma7_length, ma7_type) plot(ma7_enable ? ma7 : na, title="MA 7", color=ma7_color, linewidth=1, display=display.all) ​ // --- Bollinger Bands Settings --- // Bollinger Band 1 GRP_BB1 = "Bollinger Band 1" bb1_enable = input.bool(true, "Enable BB 1", group=GRP_BB1) bb1_source = input.source(close, "Source", group=GRP_BB1) bb1_length = input.int(20, "Length", minval=1, group=GRP_BB1) bb1_mult = input.float(2.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB1) bb1_basis_color = input.color(color.aqua, "Basis Color", group=GRP_BB1) // Basis line color bb1_upper_color = input.color(color.aqua, "Upper Color", group=GRP_BB1) // Upper line color bb1_lower_color = input.color(color.aqua, "Lower Color", group=GRP_BB1) // Lower line color bb1_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB1) // Line width for all BB lines bb1_fill_color = input.color(color.new(color.aqua, 90), "Fill Color", group=GRP_BB1) // Fill color bb1_hit_enable = input.bool(true, "Enable Hit Marks", group=GRP_BB1) // Enable/disable hit marks bb1_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB1) // Color for upper band hit bb1_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB1) // Color for lower band hit ​ bb1_basis = ta.sma(bb1_source, bb1_length) bb1_dev = bb1_mult * ta.stdev(bb1_source, bb1_length) bb1_upper = bb1_basis + bb1_dev bb1_lower = bb1_basis - bb1_dev ​ plot(bb1_enable ? bb1_basis : na, "BB1 Basis", color=bb1_basis_color, linewidth=bb1_linewidth) p1_bb1 = plot(bb1_enable ? bb1_upper : na, "BB1 Upper", color=bb1_upper_color, linewidth=bb1_linewidth) p2_bb1 = plot(bb1_enable ? bb1_lower : na, "BB1 Lower", color=bb1_lower_color, linewidth=bb1_linewidth) fill(p1_bb1, p2_bb1, color=bb1_enable ? bb1_fill_color : na, title="BB1 Fill") ​ // Plot shapes when candle hits BB1 (modified conditions to include equality) plotshape(bb1_hit_enable and high >= bb1_upper, style=shape.triangledown, location=location.abovebar, color=bb1_hit_color_upper, size=size.small, title="BB1 Upper Hit") plotshape(bb1_hit_enable and low <= bb1_lower, style=shape.triangleup, location=location.belowbar, color=bb1_hit_color_lower, size=size.small, title="BB1 Lower Hit") ​ ​ // Bollinger Band 2 GRP_BB2 = "Bollinger Band 2" bb2_enable = input.bool(false, "Enable BB 2", group=GRP_BB2) bb2_source = input.source(open, "Source", group=GRP_BB2) bb2_length = input.int(4, "Length", minval=1, group=GRP_BB2) bb2_mult = input.float(4.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB2) bb2_basis_color = input.color(color.fuchsia, "Basis Color", group=GRP_BB2) // Basis line color bb2_upper_color = input.color(color.fuchsia, "Upper Color", group=GRP_BB2) // Upper line color bb2_lower_color = input.color(color.fuchsia, "Lower Color", group=GRP_BB2) // Lower line color bb2_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB2) // Line width for all BB lines bb2_fill_color = input.color(color.new(color.fuchsia, 90), "Fill Color", group=GRP_BB2) // Fill color bb2_hit_enable = input.bool(false, "Enable Hit Marks", group=GRP_BB2) // Enable/disable hit marks bb2_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB2) // Color for upper band hit bb2_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB2) // Color for lower band hit ​ bb2_basis = ta.sma(bb2_source, bb2_length) bb2_dev = bb2_mult * ta.stdev(bb2_source, bb2_length) bb2_upper = bb2_basis + bb2_dev bb2_lower = bb2_basis - bb2_dev ​ plot(bb2_enable ? bb2_basis : na, "BB2 Basis", color=bb2_basis_color, linewidth=bb2_linewidth) p1_bb2 = plot(bb2_enable ? bb2_upper : na, "BB2 Upper", color=bb2_upper_color, linewidth=bb2_linewidth) p2_bb2 = plot(bb2_enable ? bb2_lower : na, "BB2 Lower", color=bb2_lower_color, linewidth=bb2_linewidth) fill(p1_bb2, p2_bb2, color=bb2_enable ? bb2_fill_color : na, title="BB2 Fill") ​ // Plot shapes when candle hits BB2 (modified conditions to include equality) plotshape(bb2_hit_enable and high >= bb2_upper, style=shape.triangledown, location=location.abovebar, color=bb2_hit_color_upper, size=size.small, title="BB2 Upper Hit") plotshape(bb2_hit_enable and low <= bb2_lower, style=shape.triangleup, location=location.belowbar, color=bb2_hit_color_lower, size=size.small, title="BB2 Lower Hit") ​ // Bollinger Band 3 GRP_BB3 = "Bollinger Band 3" bb3_enable = input.bool(false, "Enable BB 3", group=GRP_BB3) bb3_source = input.source(open, "Source", group=GRP_BB3) bb3_length = input.int(3, "Length", minval=1, group=GRP_BB3) bb3_mult = input.float(3.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB3) bb3_basis_color = input.color(color.lime, "Basis Color", group=GRP_BB3) // Basis line color bb3_upper_color = input.color(color.lime, "Upper Color", group=GRP_BB3) // Upper line color bb3_lower_color = input.color(color.lime, "Lower Color", group=GRP_BB3) // Lower line color bb3_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB3) // Line width for all BB lines bb3_fill_color = input.color(color.new(color.lime, 90), "Fill Color", group=GRP_BB3) // Fill color bb3_hit_enable = input.bool(false, "Enable Hit Marks", group=GRP_BB3) // Enable/disable hit marks bb3_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB3) // Color for upper band hit bb3_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB3) // Color for lower band hit ​ bb3_basis = ta.sma(bb3_source, bb3_length) bb3_dev = bb3_mult * ta.stdev(bb3_source, bb3_length) bb3_upper = bb3_basis + bb3_dev bb3_lower = bb3_basis - bb3_dev ​ plot(bb3_enable ? bb3_basis : na, "BB3 Basis", color=bb3_basis_color, linewidth=bb3_linewidth) p1_bb3 = plot(bb3_enable ? bb3_upper : na, "BB3 Upper", color=bb3_upper_color, linewidth=bb3_linewidth) p2_bb3 = plot(bb3_enable ? bb3_lower : na, "BB3 Lower", color=bb3_lower_color, linewidth=bb3_linewidth) fill(p1_bb3, p2_bb3, color=bb3_enable ? bb3_fill_color : na, title="BB3 Fill") ​ // Plot shapes when candle hits BB3 (modified conditions to include equality) plotshape(bb3_hit_enable and high >= bb3_upper, style=shape.triangledown, location=location.abovebar, color=bb3_hit_color_upper, size=size.small, title="BB3 Upper Hit") plotshape(bb3_hit_enable and low <= bb3_lower, style=shape.triangleup, location=location.belowbar, color=bb3_hit_color_lower, size=size.small, title="BB3 Lower Hit") 수정부탁드립니다
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-09-15 10:30:45.0

안녕하세요 예스스탁입니다. input : ma1_enable(true); input : ma1_type(1); #1:SMA, 2:EMA, 3:WMA", 4:RMA, 5:VWMA input : ma1_length(20); input : ma1_color(blue); input : ma2_enable(true); input : ma2_type(1); #1:SMA, 2:EMA, 3:WMA", 4:RMA, 5:VWMA input : ma2_length(30); input : ma2_color(orange); input : ma3_enable(true); input : ma3_type(1); #1:SMA, 2:EMA, 3:WMA", 4:RMA, 5:VWMA input : ma3_length(60); input : ma3_color(purple); input : ma4_enable(true); input : ma4_type(1); #1:SMA, 2:EMA, 3:WMA", 4:RMA, 5:VWMA input : ma4_length(120); input : ma4_color(black); input : ma5_enable(true); input : ma5_type(1); #1:SMA, 2:EMA, 3:WMA", 4:RMA, 5:VWMA input : ma5_length(240); input : ma5_color(green); input : ma6_enable(true); input : ma6_type(1); #1:SMA, 2:EMA, 3:WMA", 4:RMA, 5:VWMA input : ma6_length(240); input : ma6_color(red); input : ma7_enable(true); input : ma7_type(1); #1:SMA, 2:EMA, 3:WMA", 4:RMA, 5:VWMA input : ma7_length(240); input : ma7_color(teal); var : a1(0),a2(0),a3(0),a4(0),a5(0),a6(0),a7(0); var : ma1(0),ma2(0),ma3(0),ma4(0),ma5(0),ma6(0),ma7(0); if ma1_type == 1 Then { ma1 = ma(c,ma1_length); ma2 = ma(c,ma2_length); ma3 = ma(c,ma3_length); ma4 = ma(c,ma4_length); ma5 = ma(c,ma5_length); ma6 = ma(c,ma6_length); ma7 = ma(c,ma7_length); } if ma1_type == 2 Then { ma1 = ema(c,ma1_length); ma2 = ema(c,ma2_length); ma3 = ema(c,ma3_length); ma4 = ema(c,ma4_length); ma5 = ema(c,ma5_length); ma6 = ema(c,ma6_length); ma7 = ema(c,ma7_length); } if ma1_type == 3 Then { ma1 = wma(c,ma1_length); ma2 = wma(c,ma2_length); ma3 = wma(c,ma3_length); ma4 = wma(c,ma4_length); ma5 = wma(c,ma5_length); ma6 = wma(c,ma6_length); ma7 = wma(c,ma7_length); } if ma1_type == 4 Then { a1 = 1 / ma1_length ; a2 = 1 / ma2_length ; a3 = 1 / ma3_length ; a4 = 1 / ma4_length ; a5 = 1 / ma5_length ; a6 = 1 / ma6_length ; a7 = 1 / ma7_length ; ma1 = IFf(IsNan(ma1[1]) == true, ma(TrueRange,ma1_length) , a1 * TrueRange + (1 - a1) * IFf(isnan(ma1[1])==true,0,ma1[1])); ma2 = IFf(IsNan(ma2[1]) == true, ma(TrueRange,ma2_length) , a2 * TrueRange + (1 - a2) * IFf(isnan(ma2[1])==true,0,ma2[1])); ma3 = IFf(IsNan(ma3[1]) == true, ma(TrueRange,ma3_length) , a2 * TrueRange + (1 - a2) * IFf(isnan(ma3[1])==true,0,ma3[1])); ma4 = IFf(IsNan(ma4[1]) == true, ma(TrueRange,ma4_length) , a2 * TrueRange + (1 - a2) * IFf(isnan(ma4[1])==true,0,ma4[1])); ma5 = IFf(IsNan(ma5[1]) == true, ma(TrueRange,ma5_length) , a2 * TrueRange + (1 - a2) * IFf(isnan(ma5[1])==true,0,ma5[1])); ma6 = IFf(IsNan(ma6[1]) == true, ma(TrueRange,ma6_length) , a2 * TrueRange + (1 - a2) * IFf(isnan(ma6[1])==true,0,ma6[1])); ma7 = IFf(IsNan(ma7[1]) == true, ma(TrueRange,ma7_length) , a2 * TrueRange + (1 - a2) * IFf(isnan(ma7[1])==true,0,ma7[1])); } if ma1_type == 5 Then { ma1 = ma(close * volume, ma1_length) / ma(volume, ma1_length); ma2 = ma(close * volume, ma2_length) / ma(volume, ma2_length); ma3 = ma(close * volume, ma3_length) / ma(volume, ma3_length); ma4 = ma(close * volume, ma4_length) / ma(volume, ma4_length); ma5 = ma(close * volume, ma5_length) / ma(volume, ma5_length); ma6 = ma(close * volume, ma6_length) / ma(volume, ma6_length); ma7 = ma(close * volume, ma7_length) / ma(volume, ma7_length); } if ma1_enable == true Then plot1(ma1,"MA 1", ma1_color); else NoPlot(1); if ma2_enable == true Then plot2(ma2,"MA 2", ma2_color); else NoPlot(2); if ma3_enable == true Then plot3(ma3,"MA 3", ma3_color); else NoPlot(3); if ma4_enable == true Then plot4(ma4,"MA 4", ma4_color); else NoPlot(4); if ma5_enable == true Then plot5(ma5,"MA 5", ma5_color); else NoPlot(5); if ma6_enable == true Then plot6(ma6,"MA 6", ma6_color); else NoPlot(6); if ma7_enable == true Then plot7(ma7,"MA 7", ma7_color); else NoPlot(7); input : bb1_enable(true); input : bb1_source(close); input : bb1_length(20); input : bb1_mult(2.0); input : bb1_basis_color(Cyan); input : bb1_upper_color(Cyan); input : bb1_lower_color(Cyan); input : bb1_linewidth(1); input : bb1_hit_enable(true); input : bb1_hit_color_upper(red); input : bb1_hit_color_lower(green); var : bb1_basis(0),bb1_dev(0),bb1_upper(0),bb1_lower(0),tx1(0); bb1_basis = ma(bb1_source, bb1_length); bb1_dev = bb1_mult * std(bb1_source, bb1_length); bb1_upper = bb1_basis + bb1_dev; bb1_lower = bb1_basis - bb1_dev; if bb1_enable == true Then { plot8(bb1_basis, "BB1 Basis",bb1_basis_color,Def,bb1_linewidth); plot9(bb1_upper, "BB1 Upper",bb1_upper_color,Def,bb1_linewidth); plot10(bb1_lower, "BB1 Lower",bb1_lower_color,Def,bb1_linewidth); } Else { NoPlot(8); NoPlot(9); NoPlot(10); } if bb1_hit_enable and high >= bb1_upper Then { tx1 = Text_New(sDate,sTime,H,"▼"); Text_SetStyle(tx1,2,1); Text_SetColor(tx1,bb1_hit_color_upper); } if bb1_hit_enable and low <= bb1_lower Then { tx1 = Text_New(sDate,sTime,L,"▲"); Text_SetStyle(tx1,2,0); Text_SetColor(tx1,bb1_hit_color_lower); } input : bb2_enable(true); input : bb2_source(open); input : bb2_length(4); input : bb2_mult(4.0); input : bb2_basis_color(Magenta); input : bb2_upper_color(Magenta); input : bb2_lower_color(Magenta); input : bb2_linewidth(1); input : bb2_hit_enable(true); input : bb2_hit_color_upper(red); input : bb2_hit_color_lower(green); var : bb2_basis(0),bb2_dev(0),bb2_upper(0),bb2_lower(0),tx2(0); bb2_basis = ma(bb2_source, bb2_length); bb2_dev = bb2_mult * std(bb2_source, bb2_length); bb2_upper = bb2_basis + bb2_dev; bb2_lower = bb2_basis - bb2_dev; if bb2_enable == true Then { plot11(bb2_basis, "BB2 Basis",bb2_basis_color,Def,bb2_linewidth); plot12(bb2_upper, "BB2 Upper",bb2_upper_color,Def,bb2_linewidth); plot13(bb2_lower, "BB2 Lower",bb2_lower_color,Def,bb2_linewidth); } Else { NoPlot(11); NoPlot(12); NoPlot(13); } if bb2_hit_enable and high >= bb2_upper Then { tx2 = Text_New(sDate,sTime,H,"▼"); Text_SetStyle(tx2,2,1); Text_SetColor(tx2,bb2_hit_color_upper); } if bb2_hit_enable and low <= bb2_lower Then { tx2 = Text_New(sDate,sTime,L,"▲"); Text_SetStyle(tx2,2,0); Text_SetColor(tx2,bb2_hit_color_lower); } input : bb3_enable(true); input : bb3_source(open); input : bb3_length(3); input : bb3_mult(3.0); input : bb3_basis_color(lime); input : bb3_upper_color(lime); input : bb3_lower_color(lime); input : bb3_linewidth(1); input : bb3_hit_enable(true); input : bb3_hit_color_upper(red); input : bb3_hit_color_lower(green); var : bb3_basis(0),bb3_dev(0),bb3_upper(0),bb3_lower(0),tx3(0); bb3_basis = ma(bb3_source, bb3_length); bb3_dev = bb3_mult * std(bb3_source, bb3_length); bb3_upper = bb3_basis + bb3_dev; bb3_lower = bb3_basis - bb3_dev; if bb3_enable == true Then { plot14(bb3_basis, "BB3 Basis",bb3_basis_color,Def,bb3_linewidth); plot15(bb3_upper, "BB3 Upper",bb3_upper_color,Def,bb3_linewidth); plot16(bb3_lower, "BB3 Lower",bb3_lower_color,Def,bb3_linewidth); } Else { NoPlot(14); NoPlot(15); NoPlot(16); } if bb3_hit_enable and high >= bb3_upper Then { tx3 = Text_New(sDate,sTime,H,"▼"); Text_SetStyle(tx3,2,1); Text_SetColor(tx3,bb3_hit_color_upper); } if bb3_hit_enable and low <= bb3_lower Then { tx3 = Text_New(sDate,sTime,L,"▲"); Text_SetStyle(tx3,2,0); Text_SetColor(tx3,bb3_hit_color_lower); } 즐거운 하루되세요 > 윤호석 님이 쓴 글입니다. > 제목 : 부탁드립니다 항상 감사합니다 > //@version=6 indicator(title="Multiple Moving Averages & 3 Bollinger Bands", shorttitle="Multi MA & 3 BB", overlay=true) ​ // Function to calculate different types of Moving Averages ma(source, length, type) => float result = na switch type "SMA" => result = ta.sma(source, length) "EMA" => result = ta.ema(source, length) "WMA" => result = ta.wma(source, length) "RMA" => result = ta.rma(source, length) "VWMA" => result = ta.vwma(source, length) result ​ // --- Moving Average Settings --- GRP_MA1 = "Moving Average 1" ma1_enable = input.bool(true, "Enable MA 1", group=GRP_MA1) ma1_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA1) ma1_length = input.int(20, "Length", minval=1, group=GRP_MA1) ma1_color = input.color(color.blue, "Color", group=GRP_MA1) ma1 = ma(close, ma1_length, ma1_type) plot(ma1_enable ? ma1 : na, title="MA 1", color=ma1_color, linewidth=2, display=display.all) ​ GRP_MA2 = "Moving Average 2" ma2_enable = input.bool(true, "Enable MA 2", group=GRP_MA2) ma2_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA2) ma2_length = input.int(30, "Length", minval=1, group=GRP_MA2) ma2_color = input.color(color.orange, "Color", group=GRP_MA2) ma2 = ma(close, ma2_length, ma2_type) plot(ma2_enable ? ma2 : na, title="MA 2", color=ma2_color, linewidth=2, display=display.all) ​ GRP_MA3 = "Moving Average 3" ma3_enable = input.bool(true, "Enable MA 3", group=GRP_MA3) ma3_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA3) ma3_length = input.int(60, "Length", minval=1, group=GRP_MA3) ma3_color = input.color(color.purple, "Color", group=GRP_MA3) ma3 = ma(close, ma3_length, ma3_type) plot(ma3_enable ? ma3 : na, title="MA 3", color=ma3_color, linewidth=2, display=display.all) ​ GRP_MA4 = "Moving Average 4" ma4_enable = input.bool(false, "Enable MA 4", group=GRP_MA4) ma4_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA4) ma4_length = input.int(120, "Length", minval=1, group=GRP_MA4) ma4_color = input.color(color.black, "Color", group=GRP_MA4) ma4 = ma(close, ma4_length, ma4_type) plot(ma4_enable ? ma4 : na, title="MA 4", color=ma4_color, linewidth=2, display=display.all) ​ GRP_MA5 = "Moving Average 5" ma5_enable = input.bool(false, "Enable MA 5", group=GRP_MA5) ma5_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA5) ma5_length = input.int(240, "Length", minval=1, group=GRP_MA5) ma5_color = input.color(color.new(color.green, 20), "Color", group=GRP_MA5) ma5 = ma(close, ma5_length, ma5_type) plot(ma5_enable ? ma5 : na, title="MA 5", color=ma5_color, linewidth=1, display=display.all) ​ GRP_MA6 = "Moving Average 6" ma6_enable = input.bool(false, "Enable MA 6", group=GRP_MA6) ma6_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA6) ma6_length = input.int(400, "Length", minval=1, group=GRP_MA6) ma6_color = input.color(color.new(color.red, 20), "Color", group=GRP_MA6) ma6 = ma(close, ma6_length, ma6_type) plot(ma6_enable ? ma6 : na, title="MA 6", color=ma6_color, linewidth=1, display=display.all) ​ GRP_MA7 = "Moving Average 7" ma7_enable = input.bool(false, "Enable MA 7", group=GRP_MA7) ma7_type = input.string("SMA", "Type", options=["SMA", "EMA", "WMA", "RMA", "VWMA"], group=GRP_MA7) ma7_length = input.int(600, "Length", minval=1, group=GRP_MA7) ma7_color = input.color(color.new(color.teal, 20), "Color", group=GRP_MA7) ma7 = ma(close, ma7_length, ma7_type) plot(ma7_enable ? ma7 : na, title="MA 7", color=ma7_color, linewidth=1, display=display.all) ​ // --- Bollinger Bands Settings --- // Bollinger Band 1 GRP_BB1 = "Bollinger Band 1" bb1_enable = input.bool(true, "Enable BB 1", group=GRP_BB1) bb1_source = input.source(close, "Source", group=GRP_BB1) bb1_length = input.int(20, "Length", minval=1, group=GRP_BB1) bb1_mult = input.float(2.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB1) bb1_basis_color = input.color(color.aqua, "Basis Color", group=GRP_BB1) // Basis line color bb1_upper_color = input.color(color.aqua, "Upper Color", group=GRP_BB1) // Upper line color bb1_lower_color = input.color(color.aqua, "Lower Color", group=GRP_BB1) // Lower line color bb1_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB1) // Line width for all BB lines bb1_fill_color = input.color(color.new(color.aqua, 90), "Fill Color", group=GRP_BB1) // Fill color bb1_hit_enable = input.bool(true, "Enable Hit Marks", group=GRP_BB1) // Enable/disable hit marks bb1_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB1) // Color for upper band hit bb1_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB1) // Color for lower band hit ​ bb1_basis = ta.sma(bb1_source, bb1_length) bb1_dev = bb1_mult * ta.stdev(bb1_source, bb1_length) bb1_upper = bb1_basis + bb1_dev bb1_lower = bb1_basis - bb1_dev ​ plot(bb1_enable ? bb1_basis : na, "BB1 Basis", color=bb1_basis_color, linewidth=bb1_linewidth) p1_bb1 = plot(bb1_enable ? bb1_upper : na, "BB1 Upper", color=bb1_upper_color, linewidth=bb1_linewidth) p2_bb1 = plot(bb1_enable ? bb1_lower : na, "BB1 Lower", color=bb1_lower_color, linewidth=bb1_linewidth) fill(p1_bb1, p2_bb1, color=bb1_enable ? bb1_fill_color : na, title="BB1 Fill") ​ // Plot shapes when candle hits BB1 (modified conditions to include equality) plotshape(bb1_hit_enable and high >= bb1_upper, style=shape.triangledown, location=location.abovebar, color=bb1_hit_color_upper, size=size.small, title="BB1 Upper Hit") plotshape(bb1_hit_enable and low <= bb1_lower, style=shape.triangleup, location=location.belowbar, color=bb1_hit_color_lower, size=size.small, title="BB1 Lower Hit") ​ ​ // Bollinger Band 2 GRP_BB2 = "Bollinger Band 2" bb2_enable = input.bool(false, "Enable BB 2", group=GRP_BB2) bb2_source = input.source(open, "Source", group=GRP_BB2) bb2_length = input.int(4, "Length", minval=1, group=GRP_BB2) bb2_mult = input.float(4.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB2) bb2_basis_color = input.color(color.fuchsia, "Basis Color", group=GRP_BB2) // Basis line color bb2_upper_color = input.color(color.fuchsia, "Upper Color", group=GRP_BB2) // Upper line color bb2_lower_color = input.color(color.fuchsia, "Lower Color", group=GRP_BB2) // Lower line color bb2_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB2) // Line width for all BB lines bb2_fill_color = input.color(color.new(color.fuchsia, 90), "Fill Color", group=GRP_BB2) // Fill color bb2_hit_enable = input.bool(false, "Enable Hit Marks", group=GRP_BB2) // Enable/disable hit marks bb2_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB2) // Color for upper band hit bb2_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB2) // Color for lower band hit ​ bb2_basis = ta.sma(bb2_source, bb2_length) bb2_dev = bb2_mult * ta.stdev(bb2_source, bb2_length) bb2_upper = bb2_basis + bb2_dev bb2_lower = bb2_basis - bb2_dev ​ plot(bb2_enable ? bb2_basis : na, "BB2 Basis", color=bb2_basis_color, linewidth=bb2_linewidth) p1_bb2 = plot(bb2_enable ? bb2_upper : na, "BB2 Upper", color=bb2_upper_color, linewidth=bb2_linewidth) p2_bb2 = plot(bb2_enable ? bb2_lower : na, "BB2 Lower", color=bb2_lower_color, linewidth=bb2_linewidth) fill(p1_bb2, p2_bb2, color=bb2_enable ? bb2_fill_color : na, title="BB2 Fill") ​ // Plot shapes when candle hits BB2 (modified conditions to include equality) plotshape(bb2_hit_enable and high >= bb2_upper, style=shape.triangledown, location=location.abovebar, color=bb2_hit_color_upper, size=size.small, title="BB2 Upper Hit") plotshape(bb2_hit_enable and low <= bb2_lower, style=shape.triangleup, location=location.belowbar, color=bb2_hit_color_lower, size=size.small, title="BB2 Lower Hit") ​ // Bollinger Band 3 GRP_BB3 = "Bollinger Band 3" bb3_enable = input.bool(false, "Enable BB 3", group=GRP_BB3) bb3_source = input.source(open, "Source", group=GRP_BB3) bb3_length = input.int(3, "Length", minval=1, group=GRP_BB3) bb3_mult = input.float(3.0, "StdDev Mult", minval=0.001, maxval=50, step=0.1, group=GRP_BB3) bb3_basis_color = input.color(color.lime, "Basis Color", group=GRP_BB3) // Basis line color bb3_upper_color = input.color(color.lime, "Upper Color", group=GRP_BB3) // Upper line color bb3_lower_color = input.color(color.lime, "Lower Color", group=GRP_BB3) // Lower line color bb3_linewidth = input.int(1, "Line Width", minval=1, maxval=4, group=GRP_BB3) // Line width for all BB lines bb3_fill_color = input.color(color.new(color.lime, 90), "Fill Color", group=GRP_BB3) // Fill color bb3_hit_enable = input.bool(false, "Enable Hit Marks", group=GRP_BB3) // Enable/disable hit marks bb3_hit_color_upper = input.color(color.red, "Upper Hit Color", group=GRP_BB3) // Color for upper band hit bb3_hit_color_lower = input.color(color.green, "Lower Hit Color", group=GRP_BB3) // Color for lower band hit ​ bb3_basis = ta.sma(bb3_source, bb3_length) bb3_dev = bb3_mult * ta.stdev(bb3_source, bb3_length) bb3_upper = bb3_basis + bb3_dev bb3_lower = bb3_basis - bb3_dev ​ plot(bb3_enable ? bb3_basis : na, "BB3 Basis", color=bb3_basis_color, linewidth=bb3_linewidth) p1_bb3 = plot(bb3_enable ? bb3_upper : na, "BB3 Upper", color=bb3_upper_color, linewidth=bb3_linewidth) p2_bb3 = plot(bb3_enable ? bb3_lower : na, "BB3 Lower", color=bb3_lower_color, linewidth=bb3_linewidth) fill(p1_bb3, p2_bb3, color=bb3_enable ? bb3_fill_color : na, title="BB3 Fill") ​ // Plot shapes when candle hits BB3 (modified conditions to include equality) plotshape(bb3_hit_enable and high >= bb3_upper, style=shape.triangledown, location=location.abovebar, color=bb3_hit_color_upper, size=size.small, title="BB3 Upper Hit") plotshape(bb3_hit_enable and low <= bb3_lower, style=shape.triangleup, location=location.belowbar, color=bb3_hit_color_lower, size=size.small, title="BB3 Lower Hit") 수정부탁드립니다