커뮤니티
부탁합니다.
안녕하세요.
아래 내용을 변환부탁 합니다.
환절기에 건강관리 잘하시고요.
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