커뮤니티

부탁합니다.

프로필 이미지
newstory
2025-11-19 11:19:17
81
글번호 228204
답변완료

안녕하세요.
아래 내용을 변환부탁 합니다. 환절기에 건강관리 잘하시고요.


length1 = input(10, title="BB1 기간 (Length 1)", type=input.integer) mult1 = input(2.5, title="BB1 승수 (Mult 1)", type=input.float) length2 = input(20, title="BB2 기간 (Length 2)", type=input.integer) mult2 = input(2.0, title="BB2 승수 (Mult 2)", type=input.float) trend_length = input(10, title="중심선", type=input.integer) channel_offset = input(100.0, title="채널간격", type=input.float) flat_length = input(10, title="기간", type=input.integer) flat_threshold = input(0.0005, title="오차", type=input.float, step=0.0001) toggleBreaks_sr = input(true, title = "신호") leftBars_sr = input(10, title = "좌측") rightBars_sr = input(0, title = "우측") volumeThresh = input(20, title = "임계값") length_tl = input(20, 'Trendline') mult_tl = input(1.0, 'Slope', minval = 0, step = 0.1) calcMethod_tl = input(title='Method', type=input.string, options=['Atr','Stdev','Linreg'], defval='Atr') backpaint_tl = input(true, title='Backpaint') upCss_tl = input(color.Blue, 'Up', group = 'Style') dnCss_tl = input(color.red, 'Down', group = 'Style') showExt_tl = input(true, 'Lines') basis1 = sma(close, length1) dev1 = stdev(close, length1) upper1 = basis1 + mult1 * dev1 lower1 = basis1 - mult1 * dev1 basis2 = sma(close, length2) dev2 = stdev(close, length2) upper2 = basis2 + mult2 * dev2 lower2 = basis2 - mult2 * dev2 trend = sma(close, trend_length) trend_upper_channel = trend + channel_offset trend_lower_channel = trend - channel_offset ema_5 = ema(close, 5) ema_10 = ema(close, 10) ema_20 = ema(close, 20) momentum_line_1 = (ema_5 + ema_10) / 2 momentum_line_2 = (ema_10 + ema_20) / 2 highUsePivot = fixnan(pivothigh(leftBars_sr, rightBars_sr)[1]) lowUsePivot = fixnan(pivotlow(leftBars_sr, rightBars_sr)[1]) short = ema(volume, 5) long = ema(volume, 10) osc = 100 * (short - long) / long var upper_tl = 0. var lower_tl = 0. var slope_ph_tl = 0. var slope_pl_tl = 0. var offset_tl = backpaint_tl ? length_tl : 0 n = bar_index src = close ph_tl = pivothigh(length_tl, length_tl) pl_tl = pivotlow(length_tl, length_tl) slope_tl = 0. if calcMethod_tl == 'Atr' slope_tl := atr(length_tl) / length_tl * mult_tl else if calcMethod_tl == 'Stdev' slope_tl := stdev(src, length_tl) / length_tl * mult_tl else slope_tl := abs(linreg(src, length_tl, 0) - linreg(src[1], length_tl, 1)) * mult_tl slope_ph_tl := ph_tl ? slope_tl : slope_ph_tl slope_pl_tl := pl_tl ? slope_tl : slope_pl_tl upper_tl := ph_tl ? ph_tl : upper_tl - slope_ph_tl lower_tl := pl_tl ? pl_tl : lower_tl + slope_pl_tl var upos_tl = 0 var dnos_tl = 0 upos_tl := ph_tl ? 0 : close > upper_tl - slope_ph_tl * length_tl ? 1 : upos_tl dnos_tl := pl_tl ? 0 : close < lower_tl + slope_pl_tl * length_tl ? 1 : dnos_tl buy_signal = crossover(momentum_line_1, trend) sell_signal = crossunder(momentum_line_1, trend) upper_range = highest(upper2, flat_length) - lowest(upper2, flat_length) lower_range = highest(lower2, flat_length) - lowest(lower2, flat_length) is_flat = upper_range < flat_threshold and lower_range < flat_threshold flat_breakout_buy = is_flat and crossover(close, upper2) flat_breakout_sell = is_flat and crossunder(close, lower2) retrace_buy_condition = low[1] < lower2[1] and close > lower2 retrace_sell_condition = high[1] > upper2[1] and close < upper2 retrace_buy_line = retrace_buy_condition ? close : na retrace_sell_line = retrace_sell_condition ? close : na touch_upper_and_up_candle = high >= upper2 and close > open touch_lower_and_down_candle = low <= lower2 and close < open candle_color = touch_upper_and_up_candle or touch_lower_and_down_candle ? color.yellow : na is_no_trade_zone = (trend_upper_channel > upper1) or (trend_lower_channel < lower1) no_trade_bgcolor = is_no_trade_zone ? color.new(color.red, 70) : na u1 = plot(upper1, title="Upper BB1", color=color.blue) u2 = plot(upper2, title="Upper BB2", color=color.navy) l1 = plot(lower1, title="Lower BB1", color=color.red) l2 = plot(lower2, title="Lower BB2", color=color.maroon) fill(u1, u2, color=color.new(color.blue, 80), title="Upper Fill") fill(l1, l2, color=color.new(color.red, 80), title="Lower Fill") plot(trend, title="MA", linewidth=2, color=color.black) plot(trend_upper_channel, title="상단", linewidth=1, color=color.white) plot(trend_lower_channel, title="하단", linewidth=1, color=color.white) is_channel_up = momentum_line_1 > momentum_line_2 and momentum_line_1 > momentum_line_1[1] is_channel_down = momentum_line_2 > momentum_line_1 and momentum_line_1 < momentum_line_1[1] momentum_channel_color = is_channel_up ? color.new(color.fuchsia, 70) : is_channel_down ? color.new(color.aqua, 70) : na m1 = plot(momentum_line_1, title="M1", linewidth=2, color=color.fuchsia) m2 = plot(momentum_line_2, title="M2", linewidth=2, color=color.aqua) fill(m1, m2, color=momentum_channel_color, title="Channel Fill") r_plot = plot(highUsePivot, color=change(highUsePivot) ? na : #FF0000, linewidth=3, offset=-1, title="Resistance") s_plot = plot(lowUsePivot, color=change(lowUsePivot) ? na : #233dee, linewidth=3, offset=-1, title="Support") plot(backpaint_tl ? upper_tl : upper_tl - slope_ph_tl * length_tl, 'Upper Trendline', color = ph_tl ? na : upCss_tl, offset = -offset_tl) plot(backpaint_tl ? lower_tl : lower_tl + slope_pl_tl * length_tl, 'Lower Trendline', color = pl_tl ? na : dnCss_tl, offset = -offset_tl) plot(retrace_buy_line, title="Retrace Buy Line", style=plot.style_circles, linewidth=4, color=color.green) plot(retrace_sell_line, title="Retrace Sell Line", style=plot.style_circles, linewidth=4, color=color.red) plotshape(flat_breakout_buy, location=location.belowbar, style=shape.circle, size=size.small, color=color.orange, title="Buy") plotshape(flat_breakout_sell, location=location.abovebar, style=shape.circle, size=size.small, color=color.purple, title="Sell") plotshape(buy_signal, location=location.belowbar, style=shape.triangleup, size=size.small, color=color.green, title="Buy") plotshape(sell_signal, location=location.abovebar, style=shape.triangledown, size=size.small, color=color.red, title="Sell") plotshape(toggleBreaks_sr and crossunder(close,lowUsePivot) and not (open - close < high - open) and osc > volumeThresh, title = "Sell", text = 'B', style = shape.labeldown, location = location.abovebar, color= color.red,textcolor = color.white, transp = 0, size = size.tiny) plotshape(toggleBreaks_sr and crossover(close,highUsePivot ) and not(open - low > close - open) and osc > volumeThresh, title = "Buy", text = 'B', style = shape.labelup, location = location.belowbar, color= color.green,textcolor = color.white, transp = 0, size = size.tiny) plotshape(upos_tl > upos_tl[1] ? low : na, "Upper" , shape.labelup , location.absolute , upCss_tl , text = "TL+" , textcolor = color.white , size = size.tiny) plotshape(dnos_tl > dnos_tl[1] ? high : na, "Lower" , shape.labeldown , location.absolute , dnCss_tl , text = "TL-" , textcolor = color.white , size = size.tiny) barcolor(candle_color) bgcolor(no_trade_bgcolor, title="Zone") alertcondition(upos_tl > upos_tl[1], 'Upward', 'upward') alertcondition(dnos_tl > dnos_tl[1], 'Downward', 'downward') alertcondition(crossunder(close,lowUsePivot) and osc > volumeThresh , title = "Support" , message = "Support") alertcondition(crossover(close,highUsePivot) and osc > volumeThresh, title = "Resistance" , message = "Resistance")

지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-11-19 14:30:27

안녕하세요 예스스탁입니다. input : length1(10); input : mult1(2.5); input : length2(20); input : mult2(2.0); input : trend_length(10); input : channel_offset(100.0); input : flat_length(10); input : flat_threshold(0.0005); input : toggleBreaks_sr(true); input : leftBars_sr(10); input : rightBars_sr(0); input : volumeThresh(20); input : length_tl(20); input : mult_tl(1.0); input : calcMethod_tl(1);//1:Atr,2:Stdev,3;Linreg input : backpaint_tl(true); input : upCss_tl(Blue); input : dnCss_tl(red); input : showExt_tl(true); var : basis1(0),dev1(0),upper1(0),lower1(0); var : basis2(0),dev2(0),upper2(0),lower2(0); var : trend(0),trend_upper_channel(0),trend_lower_channel(0); var : Ema_5(0),Ema_10(0), Ema_20(0); var : momentum_line_1(0),momentum_line_2(0); var : highUsePivot(0),lowUsePivot(0); basis1 = ma(close, length1); dev1 = std(close, length1); upper1 = basis1 + mult1 * dev1 ; lower1 = basis1 - mult1 * dev1 ; basis2 = ma(close, length2); dev2 = std(close, length2); upper2 = basis2 + mult2 * dev2; lower2 = basis2 - mult2 * dev2; trend = ma(close, trend_length); trend_upper_channel = trend + channel_offset; trend_lower_channel = trend - channel_offset; ema_5 = ema(close, 5); ema_10 = ema(close, 10); ema_20 = ema(close, 20); momentum_line_1 = (ema_5 + ema_10) / 2; momentum_line_2 = (ema_10 + ema_20) / 2; if SwingHigh(1,h,leftBars_sr,rightBars_sr,leftBars_sr+rightBars_sr+1)[1] != -1 Then highUsePivot = SwingHigh(1,h,leftBars_sr,rightBars_sr,leftBars_sr+rightBars_sr+1)[1]; if Swinglow(1,l,leftBars_sr,rightBars_sr,leftBars_sr+rightBars_sr+1)[1] != -1 Then lowUsePivot = Swinglow(1,l,leftBars_sr,rightBars_sr,leftBars_sr+rightBars_sr+1)[1]; var : short(0),long(0),osc(0); var : upper_tl(0); var : lower_tl(0); var : slope_ph_tl(0); var : slope_pl_tl(0); var : offset_tl(0); var : n(0),src(0),ph_tl(0),pl_tl(0),slope_tl(0); short = ema(volume, 5); long = ema(volume, 10); osc = 100 * (short - long) / long; offset_tl =IFf(backpaint_tl , length_tl , 0); n = index; src = close; if SwingHigh(1,h,length_tl,length_tl,length_tl*2+1) != -1 Then ph_tl = h[length_tl]; if Swinglow(1,l,length_tl,length_tl,length_tl*2+1) != -1 Then pl_tl = l[length_tl]; slope_tl = 0; if calcMethod_tl == 1 Then slope_tl = atr(length_tl) / length_tl * mult_tl; else if calcMethod_tl == 2 Then slope_tl = std(src, length_tl) / length_tl * mult_tl; else slope_tl = abs(LinRegForecast(src, length_tl,0) - LinRegForecast(src[1], length_tl, 1)) * mult_tl; slope_ph_tl = iff(ph_tl , slope_tl , slope_ph_tl); slope_pl_tl = iff(pl_tl , slope_tl , slope_pl_tl); upper_tl = iff(ph_tl , ph_tl , upper_tl - slope_ph_tl); lower_tl = iff(pl_tl , pl_tl , lower_tl + slope_pl_tl); var : upos_tl(0); var : dnos_tl(0); upos_tl = iff(ph_tl , 0 , iff(close > upper_tl - slope_ph_tl * length_tl , 1 , upos_tl)); dnos_tl = iff(pl_tl , 0 , iff(close < lower_tl + slope_pl_tl * length_tl , 1 , dnos_tl)); var : buy_signal(False),sell_signal(False),upper_range(0),lower_range(0),is_flat(False); var : flat_breakout_buy(False),flat_breakout_sell(False); var : retrace_buy_condition(False),retrace_sell_condition(False); var : retrace_buy_line(0),retrace_sell_line(0); var : touch_upper_and_up_candle(False),touch_lower_and_down_candle(False); var : candle_color(0),is_no_trade_zone(False),no_trade_bgcolor(0); buy_signal = CrossUp(momentum_line_1, trend); sell_signal = CrossDown(momentum_line_1, trend) ; upper_range = highest(upper2, flat_length) - lowest(upper2, flat_length); lower_range = highest(lower2, flat_length) - lowest(lower2, flat_length); is_flat = upper_range < flat_threshold and lower_range < flat_threshold; flat_breakout_buy = is_flat and CrossUp(close, upper2); flat_breakout_sell = is_flat and CrossDown(close, lower2) ; retrace_buy_condition = low[1] < lower2[1] and close > lower2 ; retrace_sell_condition = high[1] > upper2[1] and close < upper2; retrace_buy_line = iff(retrace_buy_condition , close , Nan); retrace_sell_line = iff(retrace_sell_condition , close , Nan); touch_upper_and_up_candle = high >= upper2 and close > open ; touch_lower_and_down_candle = low <= lower2 and close < open ; candle_color = iff(touch_upper_and_up_candle or touch_lower_and_down_candle , yellow , Black); is_no_trade_zone = (trend_upper_channel > upper1) or (trend_lower_channel < lower1); no_trade_bgcolor = iff(is_no_trade_zone , red , Nan); plot1(upper1, "Upper BB1", blue); plot2(upper2, "Upper BB2", navy); plot3(lower1, "Lower BB1", red); plot4(lower2, "Lower BB2", maroon); plot5(trend, "MA", black); plot6(trend_upper_channel,"상단",White); plot7(trend_lower_channel,"하단",white); var : is_channel_up(False),is_channel_down(False),momentum_channel_color(0); is_channel_up = momentum_line_1 > momentum_line_2 and momentum_line_1 > momentum_line_1[1]; is_channel_down = momentum_line_2 > momentum_line_1 and momentum_line_1 < momentum_line_1[1]; momentum_channel_color = iff(is_channel_up , Magenta , IFf(is_channel_down,Cyan,Nan)); plot8(momentum_line_1, "M1",Magenta); plot9(momentum_line_2, "M2",Cyan); if highUsePivot == highUsePivot[1] Then plot10(highUsePivot,"Resistance", Red); Else NoPlot(10); FixPlotShift(10,-1); if lowUsePivot == lowUsePivot[1] Then plot11(lowUsePivot,"Support",Blue); Else NoPlot(11); FixPlotShift(11,-1); if ph_tl == False Then plot12(iff(backpaint_tl , upper_tl , upper_tl - slope_ph_tl * length_tl), "Upper Trendline",upCss_tl); Else NoPlot(12); FixPlotShift(12,-offset_tl); if pl_tl == False Then plot13(iff(backpaint_tl , lower_tl , lower_tl + slope_pl_tl * length_tl), "Lower Trendline", dnCss_tl); FixPlotShift(13,-offset_tl); plot14(retrace_buy_line, "Retrace Buy Line",green); plot15(retrace_sell_line,"Retrace Sell Line",red); var : tx1(0),tx2(0),tx3(0),tx4(0); if flat_breakout_buy Then { tx1 = Text_New(sDate,sTime,L,"●"); Text_SetStyle(tx1,2,0); Text_SetColor(tx1,Orange); } if flat_breakout_sell Then { tx2 = Text_New(sDate,sTime,H,"●"); Text_SetStyle(tx2,2,1); Text_SetColor(tx2,purple); } if buy_signal Then { tx3 = Text_New(sDate,sTime,L,"▲"); Text_SetStyle(tx3,2,0); Text_SetColor(tx3,Green); } if sell_signal Then { tx4 = Text_New(sDate,sTime,H,"▼"); Text_SetStyle(tx4,2,1); Text_SetColor(tx4,Red); } var : tx5(0),tx6(0),tx7(0),tx8(0); if toggleBreaks_sr and CrossDown(close,lowUsePivot) and !(open - close < high - open) and osc > volumeThresh Then { tx5 = Text_New(sDate,sTime,H,"▼"); Text_SetStyle(tx5,2,1); Text_SetColor(tx5,Red); } if toggleBreaks_sr and CrossUp(close,highUsePivot ) and !(open - low > close - open) and osc > volumeThresh Then { tx6 = Text_New(sDate,sTime,H,"▲"); Text_SetStyle(tx6,2,0); Text_SetColor(tx6,Green); } if upos_tl > upos_tl[1] Then { tx7 = Text_New(sDate,sTime,L,"▲"); Text_SetStyle(tx7,2,0); Text_SetColor(tx7,Green); } if dnos_tl > dnos_tl[1] Then { tx8 = Text_New(sDate,sTime,H,"▼"); Text_SetStyle(tx8,2,1); Text_SetColor(tx8,Red); } 즐거운 하루되세요