커뮤니티

예스트레이더 수식으로 변환 부탁 드립니다.

프로필 이미지
니콜라스킹
2025-06-27 13:12:30
281
글번호 192157
답변완료
Volumatic Trend 지표를 예스로 변환 부탁 드립니다. 주말 행복하게 보내세요~ 감사합니다.^^ //@version=6 indicator("Volumatic Trend [ChartPrime]", overlay = true, max_bars_back = 5000) // --------------------------------------------------------------------------------------------------------------------} // &#128204; &#120400;&#120398;&#120384;&#120397; &#120388;&#120393;&#120395;&#120400;&#120399;&#120398; // --------------------------------------------------------------------------------------------------------------------{ int length = input.int(40) bool vol_h = input.bool(true, "Volume Histogram") color color_up = input.color(#247ac0, "Up Trend") color color_dn = input.color(#c88829, "Down Trend") var upper = float(na) var lower = float(na) var lower_vol = float(na) var upper_vol = float(na) var step_up = float(na) var step_dn = float(na) var last_index = int(na) // --------------------------------------------------------------------------------------------------------------------} // &#128204; &#120388;&#120393;&#120383;&#120388;&#120382;&#120380;&#120399;&#120394;&#120397; &#120382;&#120380;&#120391;&#120382;&#120400;&#120391;&#120380;&#120399;&#120388;&#120394;&#120393;&#120398; // --------------------------------------------------------------------------------------------------------------------{ ema_swma(x, length) => ta.ema(x[3] * 1 / 6 + x[2] * 2 / 6 + x[1] * 2 / 6 + x[0] * 1 / 6, length) atr = ta.atr(200) ema1 = ema_swma(close, length) ema2 = ta.ema(close, length) trend = ema1[1] < ema2 if trend != trend[1] upper := ema1 + atr * 3 lower := ema1 - atr * 3 lower_vol := lower + atr*4 upper_vol := upper - atr*4 step_up := (lower_vol-lower) / 100 step_dn := (upper-upper_vol) / 100 last_index := bar_index vol = int(volume / ta.percentile_linear_interpolation(volume, 1000, 100) * 100) vol_up = step_up * vol vol_dn = step_dn * vol // --------------------------------------------------------------------------------------------------------------------} // &#128204; &#120401;&#120388;&#120398;&#120400;&#120380;&#120391;&#120388;&#120405;&#120380;&#120399;&#120388;&#120394;&#120393; // --------------------------------------------------------------------------------------------------------------------{ color color = trend ? color_up : color_dn color grad_col = color.from_gradient(vol, 0, 25, chart.bg_color, color) color grad_col1 = color.from_gradient(vol, 0, 10, chart.bg_color, color) color col_vol_up = trend ? grad_col : color(na) color col_vol_dn = not trend ? grad_col : color(na) plotcandle(open, high, low, close, title='Volumatic Candles Trend', color = grad_col1, wickcolor=grad_col1, bordercolor = grad_col1, force_overlay = true) plotcandle(lower, lower, lower + vol_up, lower + vol_up, title='Volume Up Trend', color = col_vol_up, wickcolor=col_vol_up, bordercolor = col_vol_up, display = vol_h ? display.all : display.none, editable = false, force_overlay = true) plotcandle(upper, upper, upper - vol_dn, upper - vol_dn, title='Volume Down Trend', color = col_vol_dn, wickcolor=col_vol_dn, bordercolor = col_vol_dn, display = vol_h ? display.all : display.none, editable = false, force_overlay = true) plot(trend and vol_h ? na : upper, color = color, style = plot.style_linebr, display = vol_h ? display.all : display.none, editable = false, force_overlay = true) plot(trend and vol_h ? lower : na, color = color, style = plot.style_linebr, display = vol_h ? display.all : display.none, editable = false, force_overlay = true) plot(ema1, "Trend Line", color = color.new(color, 20), linewidth = 2, force_overlay = true) plotshape(trend != trend[1] ? ema1[1] : na, "Trend Change", shape.diamond, location.absolute, color = color, size = size.tiny, offset = -1, force_overlay = true) volume_ = close > open ? volume : -volume if barstate.islast delta = 0. total = 0. for i = 0 to (bar_index - last_index) total += volume[i] delta += volume_[i] lblb = label.new(bar_index, vol_h ? (trend ? lower + vol_up : upper - vol_dn) : ema1 , "Delta > "+str.tostring(delta, format.volume) + "₩n" + "--------------------" + "₩n" + "Total > "+str.tostring(total, format.volume) , textalign = text.align_left , style = label.style_label_left, color = grad_col1) label.delete(lblb[1])
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-06-27 16:51:37

안녕하세요 예스스탁입니다. input : length(40),vol_h(true),color_up(Blue),color_dn(Orange); var : upper(nan); var : lower(nan); var : lower_vol(nan); var : upper_vol(nan); var : step_up(nan); var : step_dn(nan); var : last_index(nan); VAR : alpha(0),ATr(0),Ema1(0),Ema2(0),trend(False),vol(0); var : vol_dn(0),vol_up(0); alpha = 1 / 200 ; atr = IFf(IsNan(atr[1]) == true, ma(TrueRange,200) , alpha * TrueRange + (1 - alpha) * IFf(isnan(atr[1])==true,0,atr[1])); ema1 = ema(close[3] * 1 / 6 + close[2] * 2 / 6 + close[1] * 2 / 6 + close[0] * 1 / 6, length); ema2 = ema(close, length); trend = ema1[1] < ema2; if trend != trend[1] Then { upper = ema1 + atr * 3; lower = ema1 - atr * 3; lower_vol = lower + atr*4; upper_vol = upper - atr*4; step_up = (lower_vol-lower) / 100; step_dn = (upper-upper_vol) / 100; last_index = index; } vol = int(volume / highest(v,1000) * 100); vol_up = step_up * vol; vol_dn = step_dn * vol; plot1(ema1, "Trend Line",IFf(trend==true,color_up,color_dn)); var : tx(0); if trend != trend[1] Then { tx = Text_New(sDate[1],sTime[1],Ema1[1],"●"); Text_SetStyle(tx,2,2); Text_SetColor(tx,IFf(trend==true,color_up,color_dn)); } var : tl1(0); if vol_h == true Then { if trend == true then { TL1 = TL_New(sDate,sTime,lower,sDate,sTime,lower+vol_up); TL_SetColor(TL1,color_up); TL_SetSize(TL1,3); } Else { TL1 = TL_New(sDate,sTime,upper,sDate,sTime,upper-vol_dn); TL_SetColor(TL1,color_dn); TL_SetSize(TL1,3); } } 즐거운 하루되세요 > 니콜라스킹 님이 쓴 글입니다. > 제목 : 예스트레이더 수식으로 변환 부탁 드립니다. > Volumatic Trend 지표를 예스로 변환 부탁 드립니다. 주말 행복하게 보내세요~ 감사합니다.^^ //@version=6 indicator("Volumatic Trend [ChartPrime]", overlay = true, max_bars_back = 5000) // --------------------------------------------------------------------------------------------------------------------} // &#128204; &#120400;&#120398;&#120384;&#120397; &#120388;&#120393;&#120395;&#120400;&#120399;&#120398; // --------------------------------------------------------------------------------------------------------------------{ int length = input.int(40) bool vol_h = input.bool(true, "Volume Histogram") color color_up = input.color(#247ac0, "Up Trend") color color_dn = input.color(#c88829, "Down Trend") var upper = float(na) var lower = float(na) var lower_vol = float(na) var upper_vol = float(na) var step_up = float(na) var step_dn = float(na) var last_index = int(na) // --------------------------------------------------------------------------------------------------------------------} // &#128204; &#120388;&#120393;&#120383;&#120388;&#120382;&#120380;&#120399;&#120394;&#120397; &#120382;&#120380;&#120391;&#120382;&#120400;&#120391;&#120380;&#120399;&#120388;&#120394;&#120393;&#120398; // --------------------------------------------------------------------------------------------------------------------{ ema_swma(x, length) => ta.ema(x[3] * 1 / 6 + x[2] * 2 / 6 + x[1] * 2 / 6 + x[0] * 1 / 6, length) atr = ta.atr(200) ema1 = ema_swma(close, length) ema2 = ta.ema(close, length) trend = ema1[1] < ema2 if trend != trend[1] upper := ema1 + atr * 3 lower := ema1 - atr * 3 lower_vol := lower + atr*4 upper_vol := upper - atr*4 step_up := (lower_vol-lower) / 100 step_dn := (upper-upper_vol) / 100 last_index := bar_index vol = int(volume / ta.percentile_linear_interpolation(volume, 1000, 100) * 100) vol_up = step_up * vol vol_dn = step_dn * vol // --------------------------------------------------------------------------------------------------------------------} // &#128204; &#120401;&#120388;&#120398;&#120400;&#120380;&#120391;&#120388;&#120405;&#120380;&#120399;&#120388;&#120394;&#120393; // --------------------------------------------------------------------------------------------------------------------{ color color = trend ? color_up : color_dn color grad_col = color.from_gradient(vol, 0, 25, chart.bg_color, color) color grad_col1 = color.from_gradient(vol, 0, 10, chart.bg_color, color) color col_vol_up = trend ? grad_col : color(na) color col_vol_dn = not trend ? grad_col : color(na) plotcandle(open, high, low, close, title='Volumatic Candles Trend', color = grad_col1, wickcolor=grad_col1, bordercolor = grad_col1, force_overlay = true) plotcandle(lower, lower, lower + vol_up, lower + vol_up, title='Volume Up Trend', color = col_vol_up, wickcolor=col_vol_up, bordercolor = col_vol_up, display = vol_h ? display.all : display.none, editable = false, force_overlay = true) plotcandle(upper, upper, upper - vol_dn, upper - vol_dn, title='Volume Down Trend', color = col_vol_dn, wickcolor=col_vol_dn, bordercolor = col_vol_dn, display = vol_h ? display.all : display.none, editable = false, force_overlay = true) plot(trend and vol_h ? na : upper, color = color, style = plot.style_linebr, display = vol_h ? display.all : display.none, editable = false, force_overlay = true) plot(trend and vol_h ? lower : na, color = color, style = plot.style_linebr, display = vol_h ? display.all : display.none, editable = false, force_overlay = true) plot(ema1, "Trend Line", color = color.new(color, 20), linewidth = 2, force_overlay = true) plotshape(trend != trend[1] ? ema1[1] : na, "Trend Change", shape.diamond, location.absolute, color = color, size = size.tiny, offset = -1, force_overlay = true) volume_ = close > open ? volume : -volume if barstate.islast delta = 0. total = 0. for i = 0 to (bar_index - last_index) total += volume[i] delta += volume_[i] lblb = label.new(bar_index, vol_h ? (trend ? lower + vol_up : upper - vol_dn) : ema1 , "Delta > "+str.tostring(delta, format.volume) + "₩n" + "--------------------" + "₩n" + "Total > "+str.tostring(total, format.volume) , textalign = text.align_left , style = label.style_label_left, color = grad_col1) label.delete(lblb[1])