커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

질문 부탁드립니다

추세선과 for 문 관련해서 부탁드립니다 첨부된 식 else 문에서 h>var25 인 경우가 하나도 없을 때 (ii==0) tr[0] 추세선의 시작점, 끝점, 가격값을 기존 값에서 (기존값: sd[6],st[6],aa[6],sd[3],st[3],aa[3]) 각각 +1 씩 변경한 식을 작성했는데요, (설명을 위한 예시로 작성한것 입니다) ii==0 인 상태에서 추세선 위치를 변경했을때 ii >1 이 될때까지 시작점,시작값은 기존값 +2로, 끝점,끝값은 기존값 +1로 변경하는 수식을 작성하고자 합니다. if문의 기존 추세선 값을 바꾸면 연동돼서 바뀌게 할 수 있을까요? 범위는 뒤로 3 회 까지(즉 3번째 변경 했을때의 시작점은 +6, 끝점은 +3) 로 부탁드립니다 (3회까지 했으나 ii>1 이 아니라면 원래값을 유지) 항상 감사드립니다 var : cnt(0), sum1(0), sumi1(0),summ(0),tt(0),hh(0),ll(0),tll(0),n(0),ae(0); var: sum2(0),sumi2(0),count(0),sumaa(0),sumai(0),avgaa(0); var : t(0),StartBarIndex(0),dd(0),d1(0),d2(0),e1(0),e2(0),ii(0); Array : aa[50](0),cc[50](0),ee[50](0),txt[40](0),txt1[20](0), tr[40](0),sd[45](0),st[45](0),ad[50](0),at[50](0); if Bdate != Bdate[1] Then { DD = DD+1; } if (h>l*1.08) and (d1 == 0 or (d1 > 0 and dd >= d1+5)) Then { d1 = dd; hh = h; var1 = Index; Var2 = var1[1]; Var3 = Var2[1]; sum1=0; sumi1=0; sum2=0; sumi2=0; tll=TL_NEW(sDate,sTime,100,sDate,sTime,999999); TL_SetSize(tll,0); TL_SetColor(tll,Gray); For cnt = 1 to (var1-Var2) { sum1=sum1+l[cnt]; sumi1=sumi1+1; } value1=sum1/sumi1; For cnt = 49 DownTo 1 { aa[cnt] = aa[cnt-1];sd[cnt] =sd[cnt-1];st[cnt] =st[cnt-1]; txt[cnt] = txt[cnt-1]; tr[cnt]=tr[cnt-1]; } aa[0] = value1; sd[0] = sDate; st[0] = sTime; TL_SetExtRight(tr[3],False); tr[0] = TL_New(sd[6],st[6],aa[6],sd[3],st[3],aa[3]);TL_SetDrawMode(tr[0],0); TL_Delete( tr[3]); TL_SetExtRight( tr[0],true); TL_SetColor(tr[0],DarkGreen); TL_SetColor(tr[4],Green); TL_SetColor(tr[5],LightGreen);TL_SetSize( tr[0],1); ii=0; } Else { Var25=TL_GetValue(tr[0],sDate,sTime); if h>=Var25 then { ii=ii+1; #plot24(ii,"test1",Orange,Def,1); } if ii==0 Then { TL_SetBegin(tr[0],sd[7],st[7],aa[7]); TL_SetEnd(tr[0],sd[4],st[4],aa[4]); } }
프로필 이미지
yamu
2025-05-29
250
글번호 191262
지표
답변완료

수식질문

아래 수식1, 수식2, 수식3을 논리합(or)조건으로 결합하여 하나의 조건식으로 만들어 주시기 바랍니다 수식1. var : A(0),value(0),Sum(0),ii(0),avgif(0),cnt(0), SumSqrt(0),Stdevif(0),B(0); Array : diff[500](0); A= ma(C,5); value=C-A; if IsNan(value) == False Then { if value < 0 Then {ii = ii + 1; diff[ii] = value; Sum = Sum + value; avgif = Sum/ii; } if ii >= 1 Then {SumSqrt = 0; For cnt = 1 To ii {SumSqrt=SumSqrt+(diff[cnt]-avgif)^2;} Stdevif=SquareRoot(SumSqrt/ii); B=A+avgif-2*Stdevif; if CrossDown(C,B) && C < O Then Find(1); }} 수식2. var : A(0),value(0),Sum(0),ii(0),avgif(0),cnt(0), SumSqrt(0),Stdevif(0),B(0); Array : diff[500](0); A= ma(C,10); value=C-A; if IsNan(value) == False Then { if value < 0 Then {ii = ii + 1; diff[ii] = value; Sum = Sum + value; avgif = Sum/ii; } if ii >= 1 Then {SumSqrt = 0; For cnt = 1 To ii {SumSqrt=SumSqrt+(diff[cnt]-avgif)^2;} Stdevif=SquareRoot(SumSqrt/ii); B=A+avgif-2*Stdevif; if CrossDown(C,B) && C < O Then Find(1); }} 수식3. var : A(0),value(0),Sum(0),ii(0),avgif(0),cnt(0), SumSqrt(0),Stdevif(0),B(0); Array : diff[500](0); A= ma(C,20); value=C-A; if IsNan(value) == False Then { if value < 0 Then {ii = ii + 1; diff[ii] = value; Sum = Sum + value; avgif = Sum/ii; } if ii >= 1 Then {SumSqrt = 0; For cnt = 1 To ii {SumSqrt=SumSqrt+(diff[cnt]-avgif)^2;} Stdevif=SquareRoot(SumSqrt/ii); B=A+avgif-2*Stdevif; if CrossDown(C,B) Then Find(1); }}
프로필 이미지
파크에버뉴
2025-05-29
253
글번호 191261
종목검색

yamu 님에 의해서 삭제되었습니다.

프로필 이미지
yamu
2025-05-29
3
글번호 191260
지표
답변완료

감사합니다 지표 변환 부탁드립니다

// Settings //---------------------------------------------------------------------------------------------------------------------{ sp='&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;' res = input.timeframe ( '' , 'Period&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;' ) i1 = input.bool ( true , '' , inline='1', group='Swing Length') i2 = input.bool ( true , '' , inline='2', group='Swing Length') i3 = input.bool ( true , '' , inline='3', group='Swing Length') l1 = input.int (60, 'Long&#160;&#160;&#160;&#160;&#160;', minval=1, inline='1', group='Swing Length') l2 = input.int (30, 'Medium' , minval=1, inline='2', group='Swing Length') l3 = input.int (10, 'Short&#160;&#160;&#160;&#160;', minval=1, inline='3', group='Swing Length') cBull = input.color (#089981, 'Trendline'+sp, inline='d', group='Style' ) cBear = input.color (#f23645, '' , inline='d', group='Style' , tooltip = 'Bullish/Bearish Trendline' ) cWickBull = input.color (#085def, 'Wick Dot' +sp, inline='w', group='Style' ) cWickBear = input.color (#ff5d00, '' , inline='w', group='Style' , tooltip = 'Bullish/Bearish Wick' ) term = input.string('Long' , 'Term' , options =['Long' , 'Medium', 'Short' ] ) HHLL = input.string('None' , 'HH/LL' , options =['None','Only HH/LL','HH/LL & previous H/L']) bg = input.bool ( false , 'Background Color' ) cc = input.bool ( false , 'Bar Color' ) //---------------------------------------------------------------------------------------------------------------------} //LuxAlgo Defined Type //---------------------------------------------------------------------------------------------------------------------{ type bin line lin float slope bool active chart.point cp //---------------------------------------------------------------------------------------------------------------------} //Variables //---------------------------------------------------------------------------------------------------------------------{ lbi = last_bar_index n = bar_index INV = color(na) //---------------------------------------------------------------------------------------------------------------------} //Function //---------------------------------------------------------------------------------------------------------------------{ draw(toggle, res, left, right, pos) => ps = term == 'Long' ? 1 : term == 'Medium' ? 2 : 3 var int trend = 0 var chart.point prevPh = chart.point.from_index(na, na) var chart.point prevPl = chart.point.from_index(na, na) var bn = bin.new(line(na), 0, false) ph_ = ta.pivothigh(left, right), [tH, ph] = request.security(syminfo.tickerid, res, [time[2], ph_]) pl_ = ta.pivotlow (left, right), [tL, pl] = request.security(syminfo.tickerid, res, [time[2], pl_]) cH = ta.change(fixnan(ph)) cL = ta.change(fixnan(pl)) chH = cH != 0 and cL == 0 chL = cL != 0 and cH == 0 if toggle if bn.active if bn.lin.get_x2() - bn.lin.get_x1() > 5000 bn.active := false bn.lin.delete() else bn.lin.set_xy2(n, bn.lin.get_y2() + bn.slope) if chH v = 0. idx = 0 for i = 0 to 5000 Ti = time[i] if high[i] > v v := high[i] idx := i if Ti < tH break x = n - idx c = close[idx] if trend < 1 //HH if v > prevPh.price and x - prevPh.index > 5 and n - prevPl.index < 5000 if pos == ps and HHLL != 'None' label.new(x, v, color=color(na), text='HH₩n', size=size.tiny, textcolor=chart.fg_color) if HHLL == 'HH/LL & previous H/L' label.new(prevPh.index, prevPh.price, color=color(na), size=size.tiny, text='●', textcolor=chart.fg_color) trend := 1 bn := bin.new(line.new(prevPl.index, prevPl.price, n, prevPl.price, color=cBull , style= pos == 1 ? line.style_solid : pos == 2 ? line.style_dashed : line.style_dotted, width=pos == 1 ? 2 : 1) , 0, true, chart.point.from_index(prevPl.index, prevPl.price)) else //if bearish TL if bn.active slope = (v - bn.cp.price) / (x - bn.cp.index) //if line direction is down and wick breaks line or first LH if v < bn.lin.get_y1() + slope and (v > bn.lin.get_y2() + slope or bn.slope == 0) priceLin = bn.lin.get_price(n-idx) if c < priceLin //where wick breaks last line price if bn.slope != 0 label.new(n-idx, priceLin, style=label.style_label_center, text='●', color=color(na), textcolor=cWickBear) //First 업데이트 line bn.lin.set_xy2(n, v + slope*idx) //if first Swing after line conception if bn.slope == 0 //repeat until all close prices are below the line stop = false while not stop arr = array.new<float>() //check for inner-line breaks with close for i = 0 to n - bn.lin.get_x1() arr.push(close[i] - bn.lin.get_price(n-i)) highest_point = arr.max() //if yes, 업데이트 first point to highest point if highest_point > 0 ix = arr.indexof(highest_point) x1 = n-ix, y1 = high[ix] //label.new(x1, y1) bn.cp.index := x1 bn.cp.price := y1 slope := (v - y1) / (x - x1) bn.lin.set_xy2(n, v + slope*idx) bn.lin.set_xy1(x1, y1) bn.slope := slope else bn.lin.set_xy2(n, v + slope*idx) bn.slope := slope stop := true else bn.slope := slope else //if close price at Swing point breaks line bn.active := false prevPh.index := x prevPh.price := v else if trend < 1 if close > bn.lin.get_y2() bn.active := false if chL v = 10e6 idx = 0 for i = 0 to 5000 Ti = time[i] if low[i] < v v := low[i] idx := i if Ti < tL break x = n - idx c = close[idx] if trend >-1 //LL if v < prevPl.price and x - prevPl.index > 5 and n - prevPh.index < 5000 if pos == ps and HHLL != 'None' label.new(x, v, color=color(na), text='₩nLL', size=size.tiny, textcolor=chart.fg_color, style=label.style_label_up) if HHLL == 'HH/LL & previous H/L' label.new(prevPl.index, prevPl.price, color=color(na), size=size.tiny, text='●', textcolor=chart.fg_color, style=label.style_label_up) trend :=-1 bn := bin.new(line.new(prevPh.index, prevPh.price, n, prevPh.price, color=cBear , style= pos == 1 ? line.style_solid : pos == 2 ? line.style_dashed : line.style_dotted, width=pos == 1 ? 2 : 1) , 0, true, chart.point.from_index(prevPh.index, prevPh.price)) else //if bullish TL if bn.active slope = (v - bn.cp.price) / (x - bn.cp.index) //if line direction is up and wick breaks line or first HL if v > bn.lin.get_y1() + slope and (v < bn.lin.get_y2() + slope or bn.slope == 0) priceLin = bn.lin.get_price(n-idx) if c > priceLin //where wick breaks last line price if bn.slope != 0 label.new(n-idx, priceLin, style=label.style_label_center, text='●', color=color(na), textcolor=cWickBull) //First 업데이트 line bn.lin.set_xy2(n, v + slope*idx) //if first Swing after line conception if bn.slope == 0 //repeat until all close prices are above the line stop = false while not stop arr = array.new<float>() //check for inner-line breaks with close for i = 0 to n - bn.lin.get_x1() arr.push(bn.lin.get_price(n-i)-close[i]) deepest_point = arr.max() //if yes, 업데이트 first point to deepest point if deepest_point > 0 ix = arr.indexof(deepest_point) x1 = n-ix, y1 = low[ix] bn.cp.index := x1 bn.cp.price := y1 slope := (v - y1) / (x - x1) bn.lin.set_xy2(n, v + slope*idx) bn.lin.set_xy1(x1, y1) bn.slope := slope else bn.lin.set_xy2(n, v + slope*idx) bn.slope := slope stop := true else bn.slope := slope else //if close price at Swing point breaks line bn.active := false prevPl.index := x prevPl.price := v else if trend >-1 if close < bn.lin.get_y2() bn.active := false [trend, bn.lin.get_y2()] //---------------------------------------------------------------------------------------------------------------------} //실행 //---------------------------------------------------------------------------------------------------------------------{ [trend1, value1] = draw(i1, res, l1, 1, 1) [trend2, value2] = draw(i2, res, l2, 1, 2) [trend3, value3] = draw(i3, res, l3, 1, 3) col = color(na) if cc col := switch close > value1 true => switch close > value2 true => if close > value3 color.new(cBull, 20) else color.new(cBull, 43) => if close > value3 color.new(cBull, 66) else color.new(cBull, 89) => switch close < value2 true => if close < value3 color.new(cBear, 20) else color.new(cBear, 43) => if close < value3 color.new(cBear, 66) else color.new(cBear, 89) //---------------------------------------------------------------------------------------------------------------------} //Plot - Bar/Background Color //---------------------------------------------------------------------------------------------------------------------{ plot(value1, display=display.none) plot(value2, display=display.none) plot(value3, display=display.none) plot(trend1, display=display.none) barcolor(cc ? col : na) //Background color - close above/below value1-2-3 isValid = bg and (term == 'Long' ? i1 : term == 'Medium' ? i2 : i3) bgcolor(isValid ? color.new(close > (term == 'Long' ? value1 : term == 'Medium' ? value2 : value3) ? cBull : cBear, 97) : na)
프로필 이미지
갈랑교
2025-05-28
310
글번호 191259
지표
답변완료

수식변환요청

다음수식 변환 부탁드립니다 A=(C-C(1))/C(1)*100>=10; B=V>=Highest(V,기간); S1=A && B; M1=ma(C,period); SS=ValueWhen(1,S1,M1); C>SS && O< SS 감사합니다
프로필 이미지
김승빈
2025-05-28
248
글번호 191258
종목검색
답변완료

도움 부탁드립니다

안녕하세요 분봉이나 틱봉에 적용하고자 합니다. 2가지 방식의 검색식 부탁드립니다. 1. 15분 시가선이 있고 시가선위에 캔들이 있을때 빨강색 원표시 15분 시가선이 있고 시가선아래에 캔들이 있을때 파랑색 원표시 2. 15분 시가선이 있고 5이평선이 시가선을 크로스업 했을때 빨강색 원표시 15분 시가선이 있고 5이평선이 시가선을 크로스다운 했을때 파랑색 원표시 * 15분과 이평은 변수로 부탁드립니다.
프로필 이미지
라몬
2025-05-28
223
글번호 191257
검색
답변완료

수식 부탁 드립니다

볼린져 밴드 하단 터치후 양봉 발생시 매수 중심선 터치후 음봉 발생시 매수청산 또는 볼린져밴드 상단터치후 음봉 발생시 매수청산 볼린져 밴드 상단 터치후 음봉발생시 매도 중심선 터치후 양봉 발생시 매도청산 또는 볼린져 밴드 하단터치후 양봉 발생시 매도청산 첨부파일 변수값으로 작성 부탁 드립니다
프로필 이미지
kortp119
2025-05-28
224
글번호 191256
시스템
답변완료

검색식 문의 드립니다!

트레이딩뷰에서 사용되던 알파트렌드라는 지표를 검색하는 검색식인데요. 이 식은 사진처럼 파란선이 빨간선 위로 골든 나올때 검색하는 식입니다. 일단 식을 올리자면 input : coeff(1); input : AP(14); input : novolumedata(1);#1:true, 0:False var : atrv(0),src(0),upt(0),downt(0),AlphaTrend(0); var : buySignalk(False),sellSignalk(False),조건(False); ATRv = ma(TrueRange, AP); src = close; upT = low - ATRv * coeff; downT = high + ATRv * coeff; Condition1 = False; if novolumedata == 1 and rsi(AP) >= 50 Then Condition1 = true; if novolumedata == 0 and MFI(AP) >= 50 Then Condition1 = true; AlphaTrend = iff(Condition1 , IFf(upT < iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]), iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]) , upT),IFf(downT > iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]) , iff(isnan(AlphaTrend[1])==true,0,AlphaTrend[1]) , downT)); 조건=AlphaTrend>AlphaTrend[2]; IF 조건 && !조건[1] && C>AlphaTrend && RSI(AP)>50 TheN Find(1); 여거 이구요 제가 변경하고픈 방식의 검색식은 다른 사진처럼 파란선이 계속 상승이면서 차트상 캔들이 음봉일때를 검색하고픈데 가능할까요? 바쁘신데 항상 감사합니다!
프로필 이미지
수지성
2025-05-28
237
글번호 191253
검색
답변완료

수식수정

틱차트에서 VWAP차트를 쓰려는데요. 아래 수식 오류좀 점검 부탁드립니다. Inputs: ResetTime(093000); // 장 시작 시점 Vars: CumVol(0), // 누적 거래량 CumPV(0), // 누적 가격 × 거래량 VWAP(0), SessionReset(False); // 리셋 조건 // 세션 시작 시 누적값 리셋 If Time = ResetTime Then Begin CumVol = 0; CumPV = 0; SessionReset = True; End Else SessionReset = False; // 누적 계산 CumVol = CumVol + Volume; CumPV = CumPV + Close * Volume; If CumVol > 0 Then VWAP = CumPV / CumVol; // 출력 Plot1(VWAP, "VWAP");
프로필 이미지
중추신경
2025-05-28
255
글번호 191252
지표
답변완료

종목 검색 부탁드립니다.

AA=(H+L+C)/3; BB=AA*V; X1=SUM(BB,기간); X2=SUM(V,기간); dev1 = mult1 * stdev(AA, 기간); dev2 = mult2 * stdev(AA, 기간); dev3 = mult3 * stdev(AA, 기간); CT=X1/X2; CT+dev2; 기간: 120 mult1:1 mult2:2 mult3:3 라인을 돌파시 종목 검색식 부탁드립니다
프로필 이미지
골든도라도
2025-05-28
211
글번호 191251
종목검색