커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내

안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
프로필 이미지
예스스탁
2026-02-27
1699
글번호 230811
지표
답변완료

문의드립니다.

1. 국선에서 5계약을 진입하는데 아래 청산식에서 최소수익 달성후 수익감소시 청산을 1개씩만 하고 싶은데 B_2 청산이 한번 나오고 그 이후 봉에서 다시 B_2 청산이 나옵니다. 매수든 매도든 1개 진입신호에서 아래 청산식은 딱 1개씩만 적용되게 하고 싶습니다. 수정 부탁 드립니다. var : 최소수익1(30),수익감소1(15); var : 최소수익2(50),수익감소2(25); var : HH(0),LL(0); if MarketPosition == 1 Then { HH = Highest(H,BarsSinceEntry); if HH >= EntryPrice+PriceScale*최소수익1 and HH < EntryPrice+PriceScale*최소수익2 Then ExitLong("B_1",AtStop,HH-PriceScale*수익감소1,"",1,1); if HH >= EntryPrice+PriceScale*최소수익2 Then ExitLong("B_2",AtStop,HH-PriceScale*수익감소2,"",1,1); } if MarketPosition == -1 Then { LL = lowest(L,BarsSinceEntry); if LL <= EntryPrice-PriceScale*최소수익1 and LL > EntryPrice-PriceScale*최소수익2 Then ExitShort("S_1",AtStop,LL+PriceScale*수익감소1,"",1,1); if LL <= EntryPrice-PriceScale*최소수익2 Then ExitShort("S_2",AtStop,LL+PriceScale*수익감소2,"",1,1); } 2. 그리고 atstop 대신에 atlimit를 쓰면 시뮬레이션에서 수익이 더 많이 나오던데 이유도 설명 부탁드립니다. 3. 음봉 또는 양봉이 연속해서 10개 나오면 현재 계약수에 관계없이 전량 청산하는 식도 부탁드립니다.
프로필 이미지
카르마다
2024-09-23
619
글번호 183635
시스템
답변완료

검색식 부탁합니다

색상이 변하는 지점(적석에서 녹색으로 바뀌는 변곡점)에서 종목검색식 부탁드립니다. SuperTrend input : factor(3), AtrPeriod(10); var : src(0), AtrV(0),upperBand(0),lowerBand(0), prevLowerBand(0), prevUpperBand(0); var : prevSuperTrend(0), superTrend(C), direction(0),alpha(0),source(0); if CurrentBar > 1 Then { src = (H+L)/2; // ATR계산(ATR 계산시 지수가중이동평균(rma)이용) alpha = 1 / AtrPeriod ; source = max(high - low, abs(high - close[1]), abs(low - close[1])); ATrV = alpha * source + (1 - alpha) * ATrV[1]; upperBand = src + factor * AtrV; lowerBand = src - factor * AtrV; prevLowerBand = lowerBand[1]; prevUpperBand = upperBand[1]; if lowerBand > prevLowerBand or close[1] < prevLowerBand Then lowerBand = lowerBand; Else lowerBand = prevLowerBand; if upperBand < prevUpperBand or close[1] > prevUpperBand Then upperBand = upperBand; Else upperBand = prevUpperBand; if C > UpperBand Then direction = 1; if C < LowerBand Then direction = -1; if direction == 1 Then supertrend = lowerband; Else supertrend = upperband; } if C > superTrend Then { Plot1(superTrend,"UpTrend", GREEN, 0, 1); NoPlot(2); } Else { Plot2(superTrend,"DnTrend", RED, 0, 1); NoPlot(1); } if direction == 1 and direction[1] == -1 Then plot3(superTrend,"BuyStart",green,0,8); if direction == -1 and direction[1] == 1 Then plot4(superTrend,"SellStart",RED,0,8);
프로필 이미지
행복만땅
2024-10-10
837
글번호 183634
종목검색
답변완료

수식문의입니다

1. 다중조건의 IF함수 input : 가격(C), 기간S(17), 시그널S(52); var : EmavS(0); EmavS = Ema(가격,기간S); Var3 = highest(iff(C>O, EmavS, 0), 시그널S); if Var3 > 0 Then Plot4(Var3, "세력선S"); >> "세력선S"에 증감에 따른 색상 표시를 하기 위한 IF함수에 대한 문의입니다. Var3가 전일대비 하락시에는 파란색을, 변동이 없으면 노란색을, 상승하는 경우는 빨강색으로 표시하고자 하면 어케해야 하나요? 색상은 INPUT변수처리 부탁합니다. 2. 보조지표상 거래량관련입니다. input : v기간1(5),v기간2(20); var1 = MA(V,v기간1); var2 = MA(V,v기간2); If C > O Then { Plot1(V, "양봉거래량"); Plot2(0, "음봉거래량"); } Else { Plot1(0, "양봉거래량"); Plot2(V, "음봉거래량"); } >>PLOT1 또는 PLOT2의 거래량은 숫자로 조회표시됩니다. 커서를 해당 거래량 막대에 갖다놓으면 거래량은 표시되는데 전일대비 또는 전일이평 선량대비 몇 퍼센트(%) 증감되었는지 표시가 되지 않는데 되게 할려면 추가해야할 수식을 알려주세요.
프로필 이미지
해피오
2024-09-23
808
글번호 183633
지표
답변완료

문의

30개봉중에서 평균거래량의3배 이상되는 캔들에 그캔들에 색깔을 입혓어면 좋겠습니다. 봉수와 배수는 외부변수가 될수 있어면 해주셧어면 좋겟습니다
프로필 이미지
레전드
2024-09-23
710
글번호 183632
강조

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

프로필 이미지
회원
2024-09-22
114
글번호 183631
시스템
답변완료

문의 드립니다

안녕하세요 다음 트레이딩뷰 코딩을 전환해주세요 //@version=5 indicator("Nadaraya-Watson Envelope [LuxAlgo]", "LuxAlgo - Nadaraya-Watson Envelope", overlay = true, max_lines_count = 500, max_labels_count = 500, max_bars_back=500) //------------------------------------------------------------------------------ //Settings //-----------------------------------------------------------------------------{ h = input.float(8.,'Bandwidth', minval = 0) mult = input.float(3., minval = 0) src = input(close, 'Source') repaint = input(true, 'Repainting Smoothing', tooltip = 'Repainting is an effect where the indicators historical output is subject to change over time. Disabling repainting will cause the indicator to output the endpoints of the calculations') //Style upCss = input.color(color.teal, 'Colors', inline = 'inline1', group = 'Style') dnCss = input.color(color.red, '', inline = 'inline1', group = 'Style') //-----------------------------------------------------------------------------} //Functions //-----------------------------------------------------------------------------{ //Gaussian window gauss(x, h) => math.exp(-(math.pow(x, 2)/(h * h * 2))) //-----------------------------------------------------------------------------} //Append lines //-----------------------------------------------------------------------------{ n = bar_index var ln = array.new_line(0) if barstate.isfirst and repaint for i = 0 to 499 array.push(ln,line.new(na,na,na,na)) //-----------------------------------------------------------------------------} //End point method //-----------------------------------------------------------------------------{ var coefs = array.new_float(0) var den = 0. if barstate.isfirst and not repaint for i = 0 to 499 w = gauss(i, h) coefs.push(w) den := coefs.sum() out = 0. if not repaint for i = 0 to 499 out += src[i] * coefs.get(i) out /= den mae = ta.sma(math.abs(src - out), 499) * mult upper = out + mae lower = out - mae //-----------------------------------------------------------------------------} //Compute and display NWE //-----------------------------------------------------------------------------{ float y2 = na float y1 = na nwe = array.new<float>(0) if barstate.islast and repaint sae = 0. //Compute and set NWE point for i = 0 to math.min(499,n - 1) sum = 0. sumw = 0. //Compute weighted mean for j = 0 to math.min(499,n - 1) w = gauss(i - j, h) sum += src[j] * w sumw += w y2 := sum / sumw sae += math.abs(src[i] - y2) nwe.push(y2) sae := sae / math.min(499,n - 1) * mult for i = 0 to math.min(499,n - 1) if i%2 line.new(n-i+1, y1 + sae, n-i, nwe.get(i) + sae, color = upCss) line.new(n-i+1, y1 - sae, n-i, nwe.get(i) - sae, color = dnCss) if src[i] > nwe.get(i) + sae and src[i+1] < nwe.get(i) + sae label.new(n-i, src[i], '▼', color = color(na), style = label.style_label_down, textcolor = dnCss, textalign = text.align_center) if src[i] < nwe.get(i) - sae and src[i+1] > nwe.get(i) - sae label.new(n-i, src[i], '▲', color = color(na), style = label.style_label_up, textcolor = upCss, textalign = text.align_center) y1 := nwe.get(i) //-----------------------------------------------------------------------------} //Dashboard //-----------------------------------------------------------------------------{ var tb = table.new(position.top_right, 1, 1 , bgcolor = #1e222d , border_color = #373a46 , border_width = 1 , frame_color = #373a46 , frame_width = 1) if repaint tb.cell(0, 0, 'Repainting Mode Enabled', text_color = color.white, text_size = size.small) //-----------------------------------------------------------------------------} //Plot //-----------------------------------------------------------------------------} plot(repaint ? na : out + mae, 'Upper', upCss) plot(repaint ? na : out - mae, 'Lower', dnCss) //Crossing Arrows plotshape(ta.crossunder(close, out - mae) ? low : na, "Crossunder", shape.labelup, location.absolute, color(na), 0 , text = '▲', textcolor = upCss, size = size.tiny) plotshape(ta.crossover(close, out + mae) ? high : na, "Crossover", shape.labeldown, location.absolute, color(na), 0 , text = '▼', textcolor = dnCss, size = size.tiny) //-----------------------------------------------------------------------------} 감사합니다
프로필 이미지
만강
2024-09-22
684
글번호 183630
지표
답변완료

간단한 수식확인 부탁드립니다.

초보라 너무 수준낮은 질문 죄송합니다. input : 체결강도기본값(1000); if Upvol[0]/DownVol[0]*100 >= 체결강도기본값 Then{ find(1); } 위와 같이, 작성하면 체결강도의 1000 이상 종목만 걸려야하는데 24.09.22 기준 디지아이(043360)같은 종목이 검색됩니다. 확인해보니 디지아이는 마지막영업일기준(24.09.20) 체결강도가 21.26인데 말이죠.. 어째서 이런건지 설명좀 부탁드립니다. ㅠㅠ
프로필 이미지
아침식사됩니다
2024-09-22
478
글번호 183629
종목검색
답변완료

이동평균선 기울기가 바뀔 때 색깔 달라지게

안녕하세요.. 이동평균선 5,20,60,120,240 에서 기울기가 바뀔때 색깔이 변화도록 부탁드립니다.. 예를들어 20이평선이 +기울기일 때는 빨강이라면 (-)기울기가 될 때는 푸른색으로 바뀔 수 있도록요....., 즉 각이평선의 색깔도 다르면서 각 이평선의 기울기가 바뀔때 색깔이 바뀔수 있도록 수식부탁드립니다...이평선의 기울기가 바뀌는 시점도 파악하고 싶은데 색깔을 달리하면 쉽게 파악할 수 있을 것 같아서요... 감사합니다.
프로필 이미지
랑랑
2024-09-22
932
글번호 183628
지표
답변완료

참조차트에서의 ATR 계산 문의

기본차트에서 다음과 같이 ATR_5와 ATR_20을 계산한 결과와 sum = 0; for cnt = 1 to P{ If DayClose(cnt+1) > dayhigh(cnt) then TH = DayClose(cnt+1); else TH = dayhigh(cnt); If DayClose(cnt+1) < DayLow(cnt) then TL = DayClose(cnt+1); else TL = daylow(cnt); TR = TH-TL; sum = sum+TR; //MessageLog("%.2f",TR); } ATR_5 = sum/P; //ATR(20) sum1 = 0; for cnt1 = 1 to P1{ If DayClose(cnt1+1) > dayhigh(cnt1) then TH1 = DayClose(cnt1+1); else TH1 = dayhigh(cnt1); If DayClose(cnt1+1) < DayLow(cnt1) then TL1 = DayClose(cnt1+1); else TL1 = daylow(cnt1); TR1 = TH1-TL1; Sum1 = Sum1+TR1; } ATR_20 = sum1/P1; MessageLog("%.2f,%.2f",ATR_5,ATR_20); 같은 종목을 참조차트에 넣고 계산한 결과가 다릅니다. 똑같은 종목이고 이를 참조차트로 넣으면서 다음과 같이 코드를 작성해서 마찬가지로 찍어보니 결과가 다른데 뭐가 잘못된건지 알 수 있을까요? sum = 0; for cnt = 1 to P{ If data2(closeD(cnt+1)) > data2(highD(cnt)) then TH = data2(closeD(cnt+1)); else TH = data2(highD(cnt)); If data2(closeD(cnt+1)) < data2(lowD(cnt)) then TL = data2(closeD(cnt+1)); else TL = data2(lowD(cnt)); TR = TH-TL; sum = sum+TR; //MessageLog("%.2f",TR); } ATR_5 = sum/P; //ATR(20) sum1 = 0; for cnt1 = 1 to P1{ If data2(closeD(cnt1+1)) > data2(highD(cnt1)) then TH1 = data2(closeD(cnt1+1)); else TH1 = data2(highD(cnt1)); If data2(closeD(cnt1+1)) < data2(lowD(cnt1)) then TL1 = data2(closeD(cnt1+1)); else TL1 = data2(lowD(cnt1)); TR1 = TH1-TL1; Sum1 = Sum1+TR1; } ATR_20 = sum1/P1; MessageLog("%.2f,%.2f",ATR_5, ATR_20); 코드가 바뀐부분이라곤 dayhigh함수 같은것을 highD함수로 바꾼거 밖에 없는데 도무지 모르겠네요.
프로필 이미지
Trader
2024-09-22
524
글번호 183627
시스템