커뮤니티

TradingView 지표인데 예스트레이더 형식으로 바꾸어 주시면...

프로필 이미지
고도산
2024-12-29 16:42:25
681
글번호 186716
답변완료
Box가 나오니 어렵네요. 변환이 가능허면 부탁드릴께요. 미리 감사드립니다. //@version=6 // ★★★ Range Detector [LuxAlgo] ★★★ indicator('Range Detector [LuxAlgo]', '@Range Detector - LuxAlgo', overlay = true, max_boxes_count = 500, max_lines_count = 500) //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ length = input.int(20, 'Minimum Range Length', minval = 2) mult = input.float(1., 'Range Width', minval = 0, step = 0.1) atrLen = input.int(500, 'ATR Length', minval = 1) //Style upCss = input(color.fuchsia, 'Broken Upward', group = 'Style') dnCss = input(color.teal, 'Broken Downward', group = 'Style') unbrokenCss = input(#5079f3, 'Unbroken', group = 'Style') //-----------------------------------------------------------------------------} //Detect and highlight ranges //-----------------------------------------------------------------------------{ //Ranges drawings var box bx = na var line lvl = na //Extensions var float max = na var float min = na var os = 0 color detect_css = na n = bar_index atr = ta.atr(atrLen) * mult ma = ta.sma(close, length) count = 0 for i = 0 to length - 1 by 1 count := count + (math.abs(close[i] - ma) > atr ? 1 : 0) count if count == 0 and count[1] != count //Test for overlap and change coordinates if n[length] <= bx.get_right() max := math.max(ma + atr, bx.get_top()) min := math.min(ma - atr, bx.get_bottom()) //Box new coordinates bx.set_top(max) bx.set_rightbottom(n, min) bx.set_bgcolor(color.new(unbrokenCss, 80)) //Line new coordinates avg = math.avg(max, min) lvl.set_y1(avg) lvl.set_xy2(n, avg) lvl.set_color(unbrokenCss) else max := ma + atr min := ma - atr //Set new box and level bx := box.new(n[length], ma + atr, n, ma - atr, na, bgcolor = color.new(unbrokenCss, 80)) lvl := line.new(n[length], ma, n, ma, color = unbrokenCss, style = line.style_dotted) detect_css := color.new(color.gray, 50) os := 0 os else if count == 0 bx.set_right(n) lvl.set_x2(n) //Set color if close > bx.get_top() bx.set_bgcolor(color.new(upCss, 80)) lvl.set_color(upCss) os := 1 os else if close < bx.get_bottom() bx.set_bgcolor(color.new(dnCss, 80)) lvl.set_color(dnCss) os := -1 os //-----------------------------------------------------------------------------} //Plots //-----------------------------------------------------------------------------{ //Range detection bgcolor bgcolor(detect_css) plot(max, 'Range Top', max != max[1] ? na : os == 0 ? unbrokenCss : os == 1 ? upCss : dnCss, 2) plot(min, 'Range Bottom', min != min[1] ? na : os == 0 ? unbrokenCss : os == 1 ? upCss : dnCss, 2) //-----------------------------------------------------------------------------} // my add longCond = ta.crossover(close, max) shortCond = ta.crossunder(close, min) //plot(longCond ? max : na, color=color.yellow, style = plot.style_cross, linewidth = 4, title="Cross+") //plot(shortCond ? min : na, color=color.yellow, style = plot.style_cross, linewidth = 4, title="Cross-") plotchar(longCond ? max : na, 'cross Up ↑', '△', location.absolute, #ffff00, size = size.small) plotchar(shortCond ? min : na, 'cross Dn ↓', '▽', location.absolute, #ffff00, size = size.small)
지표
답변 3
프로필 이미지

예스스탁 예스스탁 답변

2024-12-30 14:17:43

안녕하세요 예스스탁입니다. 지표속성에서 plot은 그래프 모양을 일자그래프로 지정하셔야 합니다. input : length(20); input : mult(1); input : atrLen(500); input : upCss(Violet),dnCss(Teal),unbrokenCss(Blue); var : bx(Nan),lvl(Nan),mx(nan),mn(Nan),os(0),detect_css(nan); var : alpha(0),r(0),i(0),n(0),a(0),mav(0),count(0); n = index; alpha = 1 / atrLen; r = IFf(IsNan(r[1]) == true , ma(TrueRange, atrLen) , alpha * TrueRange + (1 - alpha) * r[1]); a = r * mult; mav = ma(close, length); count = 0; for i = 0 to length - 1 { count = count + IFF(abs(close[i] - mav) > a , 1 , 0); } var : LeftDate(0),Lefttime(0); var : BxRight(0),BxTop(0),BxBottom(0); var : avgv(0),vtl(0),tx(0); if count == 0 and count[1] != count Then { if n[length] <= bxRight Then { mx = max(mav + a, bxtop); mn = min(mav - a, bxBottom); bxtop = mx; bxBottom = mn; bxRight = Index; //Box new coordinates Box_SetBegin(bx,LeftDate,LeftTime,mx); Box_Setend(bx,sDate,sTime,mn); Box_SetColor(bx,unbrokenCss); //Line new coordinates avgv = avg(mx, mn); TL_SetBegin(lvl,LeftDate,Lefttime,avgv); TL_SetEnd(lvL,sDate,sTime,avgv); TL_SetColor(lvl,unbrokenCss); } else { mx = mav + a; mn = mav - a; //Set new box and level LeftDate = sDate[length]; Lefttime = sTime[length]; bxtop = mav+a; bxRight = Index; bxBottom = mav-a; bx = box_new(LeftDate,Lefttime,mav + a,sDate,sTime,mav - a); Box_SetColor(bx, unbrokenCss); Box_SetFill(bx,true); avgv = mav; lvl = TL_new(LeftDate,Lefttime, avgv, sDate,sTime, avgv); TL_SetColor(lvl,unbrokenCss); TL_SetStyle(Lvl,3); detect_css = gray; os = 0; vtl = TL_New(sDate,sTime,0,sDate,sTime,999999999); TL_SetColor(vtl,detect_css); } } else if count == 0 Then { Box_SetEnd(bx,sDate,sTime,bxBottom); TL_SetEnd(lvl,sDate,sTime,avgv); } //Set color if close > bxtop Then { Box_SetColor(bx,upCss); TL_SetColor(lvl,upCss); os = 1; } else if close < bxbottom Then { Box_SetColor(bx,dnCss); TL_SetColor(lvl,dnCss); os = -1; } plot1(mx,"Range Top", iff(mx != mx[1] , nan, Iff( os == 0 , unbrokenCss ,Iff( os == 1 , upCss , dnCss)))); plot2(mn,"Range Bottom", iff(mn != mn[1] , Nan, iff(os == 0 , unbrokenCss , iff(os == 1 , upCss , dnCss)))); if CrossUp(C,mx) Then { tx = Text_New(sDate,sTime,mx,"▲"); Text_SetStyle(tx,2,0); Text_SetColor(tx,Yellow); } if CrossDown(C,mn) Then { tx = Text_New(sDate,sTime,mn,"▼"); Text_SetStyle(tx,2,1); Text_SetColor(tx,Yellow); } 새해 복 많이 받으시길 바랍니다. > 고도산 님이 쓴 글입니다. > 제목 : TradingView 지표인데 예스트레이더 형식으로 바꾸어 주시면... > Box가 나오니 어렵네요. 변환이 가능허면 부탁드릴께요. 미리 감사드립니다. //@version=6 // ★★★ Range Detector [LuxAlgo] ★★★ indicator('Range Detector [LuxAlgo]', '@Range Detector - LuxAlgo', overlay = true, max_boxes_count = 500, max_lines_count = 500) //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ length = input.int(20, 'Minimum Range Length', minval = 2) mult = input.float(1., 'Range Width', minval = 0, step = 0.1) atrLen = input.int(500, 'ATR Length', minval = 1) //Style upCss = input(color.fuchsia, 'Broken Upward', group = 'Style') dnCss = input(color.teal, 'Broken Downward', group = 'Style') unbrokenCss = input(#5079f3, 'Unbroken', group = 'Style') //-----------------------------------------------------------------------------} //Detect and highlight ranges //-----------------------------------------------------------------------------{ //Ranges drawings var box bx = na var line lvl = na //Extensions var float max = na var float min = na var os = 0 color detect_css = na n = bar_index atr = ta.atr(atrLen) * mult ma = ta.sma(close, length) count = 0 for i = 0 to length - 1 by 1 count := count + (math.abs(close[i] - ma) > atr ? 1 : 0) count if count == 0 and count[1] != count //Test for overlap and change coordinates if n[length] <= bx.get_right() max := math.max(ma + atr, bx.get_top()) min := math.min(ma - atr, bx.get_bottom()) //Box new coordinates bx.set_top(max) bx.set_rightbottom(n, min) bx.set_bgcolor(color.new(unbrokenCss, 80)) //Line new coordinates avg = math.avg(max, min) lvl.set_y1(avg) lvl.set_xy2(n, avg) lvl.set_color(unbrokenCss) else max := ma + atr min := ma - atr //Set new box and level bx := box.new(n[length], ma + atr, n, ma - atr, na, bgcolor = color.new(unbrokenCss, 80)) lvl := line.new(n[length], ma, n, ma, color = unbrokenCss, style = line.style_dotted) detect_css := color.new(color.gray, 50) os := 0 os else if count == 0 bx.set_right(n) lvl.set_x2(n) //Set color if close > bx.get_top() bx.set_bgcolor(color.new(upCss, 80)) lvl.set_color(upCss) os := 1 os else if close < bx.get_bottom() bx.set_bgcolor(color.new(dnCss, 80)) lvl.set_color(dnCss) os := -1 os //-----------------------------------------------------------------------------} //Plots //-----------------------------------------------------------------------------{ //Range detection bgcolor bgcolor(detect_css) plot(max, 'Range Top', max != max[1] ? na : os == 0 ? unbrokenCss : os == 1 ? upCss : dnCss, 2) plot(min, 'Range Bottom', min != min[1] ? na : os == 0 ? unbrokenCss : os == 1 ? upCss : dnCss, 2) //-----------------------------------------------------------------------------} // my add longCond = ta.crossover(close, max) shortCond = ta.crossunder(close, min) //plot(longCond ? max : na, color=color.yellow, style = plot.style_cross, linewidth = 4, title="Cross+") //plot(shortCond ? min : na, color=color.yellow, style = plot.style_cross, linewidth = 4, title="Cross-") plotchar(longCond ? max : na, 'cross Up ↑', '△', location.absolute, #ffff00, size = size.small) plotchar(shortCond ? min : na, 'cross Dn ↓', '▽', location.absolute, #ffff00, size = size.small)
프로필 이미지

고도산

2024-12-30 20:05:28

고도산 님에 의해 삭제된 답변입니다.
프로필 이미지

아트키노

2025-01-30 11:44:03

if CrossDown(C,mn) Then { tx = Text_New(sDate,sTime,mn,"▼"); Text_SetStyle(tx,2,1); Text_SetColor(tx,Yellow); } 위에처럼 아래화살표가 나올때 검색식 부탁드림니다