커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1620
글번호 230811
답변완료
여러가지 조건 전략 테스트할 경우
안녕하세요.
한 개의 조건을 상수로 두고 여러개의 조건을 전략으로 테스트 해보려고 하는데요.
위와 같은 형식으로 한 개의 진입 조건에서 여러개의 청산 조건 테스트 시스템을 구성하려면,
input: exit(0);
그리고
각 청산 조건별로 if exit == 숫자 then '각 숫자에 해당하는 청산조건' 과 같은 형식으로 코딩하면 되나요?
2025-01-31
503
글번호 187614
답변완료
수식 문의드립니다
안녕하세요 ?
변수선언이 맞게 작성 되었는지
확인부탁드립니다
고맙습니다
input: period1(20), period2(100);
var: mav1(0), mav2(0);
mav1=ma(c, period1);
mav2=ma(c, period2);
#매수진입
if !(sTime>=090000 and sTime < 093500) and MarketPosition() != -1 and
CrossUp(ma(c,20), ma(c,100)) and
c>ma(c,100)+PriceScale*10 and Highest(h,200)-c>PriceScale*100
Then Buy("매수",AtMarket);
#매수청산
if MarketPosition() == 1 Then
{
if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*290)Then
ExitLong("수익1",AtStop, EntryPrice()+PriceScale*280,"매수");
if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*240)Then
ExitLong("수익2",AtStop, EntryPrice()+PriceScale*190,"매수");
if Highest(h,BarsSinceEntry+1)>=(EntryPrice()+PriceScale*190)Then
ExitLong("수익3",AtStop, EntryPrice()+PriceScale*140,"매수");
if c<(EntryPrice()-PriceScale*190)Then
ExitLong("손절", AtStop, c, "매수");}
#매도 진입
if !(sTime >=090000 and sTime < 093500)and MarketPosition() != 1 and
CrossDown(ma(c,20),ma(c,100)) and
c<ma(c,100)-PriceScale*10 and
Highest(h,200)-c>PriceScale*100
Then Sell("매도",AtMarket);
#매도청산
if MarketPosition() == -1 Then
{
if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*490) Then
ExitShort("매도수익0",AtStop,EntryPrice()-PriceScale*440,"매도");
if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*390) Then
ExitShort("매도수익1",AtStop,EntryPrice()-PriceScale*340,"매도");
if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*190) Then
ExitShort("매도수익2",AtStop,EntryPrice()-PriceScale*140,"매도");
if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*140) Then
ExitShort("매도수익3",AtStop,EntryPrice()-PriceScale*90,"매도");
if Lowest(l,BarsSinceEntry +1)<=(EntryPrice()-PriceScale*50) Then
ExitShort("매도수익4",AtStop,EntryPrice()-PriceScale*30,"매도");
if c>(EntryPrice()+PriceScale*200) Then
ExitShort("매도손절",AtStop,c,"매도");}
2025-01-31
475
글번호 187601
가자아이 님에 의해서 삭제되었습니다.
2025-01-31
47
글번호 187594
답변완료
시스템식 요청드립니다.
아래의 식에서 오류가 있는데 어떤식으로 수정해야 할지 몰라 요청드립니다.
아래의 시스템식은 주가가 14 이평선위에 있다가 해당 이평선을 하향돌파했을때
매수하는 시스템식으로
그림 파일1을 보시면 14일선 아래에 있다가 갭하락으로 시가가 시작했을때 매수가 되었습니다.
그런데, 매도는 매수평단에서 3% 4% 5% 분할매도가 되어야 하는데, 분할매도가 안됩니다.
그림파일 2를 보시면 평소엔 잘 되는것 같습니다. 1번의 경우가 갭하락으로 인해서 문제가
발생한것 처럼 보이는데 혹시 어떤 부분에 문제가 있는지 확인 부탁드리겠습니다.
그리고 수정하기위해서 어떤 부분을 어떻게 수정해야하는지 부탁드리겠습니다.ㅜ.ㅜ
---------------------------------------------------------------
input : N(14),금액(2000000);
input : 시작날짜 (20250109);
Input : 기준선기간(120);
Var : 기준선(0);
var : cntt(0),H1(0),L1(0);
var : cnt(0),sum(0),mav(0),DD(0);
var : AP(0),TT(0),entry(False);
var : LL(0),RR(0),rate(0);
var : 저항(0), B1(0) ;
Var : day(0),EntryDay(0),ddd(0),ED(0);
#-------------------------------------
if sDate >= 시작날짜 Then
{
if Bdate != Bdate[1] Then
{
entry = true;
day = day+1;
dd = dd+1;
}
}
if TotalTrades > TotalTrades[1] Then
entry = False;
#-------------------------------------
#-------------------------------------
sum = 0;
For cnt = 0 to N-1
{
sum = sum + DayClose(cnt);
}
mav = (sum/N);
#-------------------------------------
#---------------------------------------
if (MarketPosition == 0) and (entry == true) and L > mav Then
Buy("1차매수",AtLimit,mav,Floor(금액/min(NextBarOpen,mav)));
if (LatestEntryName(0) == "1차매수") Then
Buy("2차매수",AtLimit,LatestEntryPrice(0)*0.95,Floor(금액*1.15/min(NextBarOpen,mav)));
if (LatestEntryName(0) == "2차매수") Then
Buy("3차매수",AtLimit,LatestEntryPrice(0)*0.95,Floor(금액*1.2/min(NextBarOpen,mav)));
if (LatestEntryName(0) == "3차매수") Then
Buy("4차매수",AtLimit,LatestEntryPrice(0)*0.95,Floor(금액*1.25/min(NextBarOpen,mav)));
if (LatestEntryName(0) == "4차매수") Then
Buy("5차매수",AtLimit,LatestEntryPrice(0)*0.95,Floor(금액*1.3/min(NextBarOpen,mav)));
if (LatestEntryName(0) == "5차매수") Then
Buy("6차매수",AtLimit,LatestEntryPrice(0)*0.95,Floor(금액*1.35/min(NextBarOpen,mav)));
#-----------------------------------
if MarketPosition == 1 Then
{
#전봉대비 수량 감소(일부 청산발생을 위미)
if CurrentContracts < CurrentContracts[1] Then
{
#청산가 저장
var1 = LatestExitPrice(0);
if LatestExitName(0) == "3%익절" or LatestExitName(0) == "3-D%익절" or LatestExitName(0) == "3-E%익절" Then
Condition1 = true;
if LatestExitName(0) == "4%익절" or LatestExitName(0) == "4-D%익절" or LatestExitName(0) == "4-E%익절" Then
Condition2 = true;
if LatestExitName(0) == "5%익절" or LatestExitName(0) == "5-D%익절" or LatestExitName(0) == "5-E%익절" Then
Condition3 = true;
if LatestExitName(0) == "7%익절" or LatestExitName(0) == "7-D%익절" Then
Condition4 = true;
}
#전봉대비 수량 증가(추가 진입발생을 의미)
if CurrentContracts > CurrentContracts[1] AND ((LatestEntryName(0) == "1차매수") OR (LatestEntryName(0) == "2차매수") or (LatestEntryName(0) == "3차매수") ) Then
{
#현재수량 저장
Var3 = CurrentContracts;
Var4 = AvgEntryPrice;
Condition1 = False;
Condition2 = False;
Condition3 = False;
Condition4 = False;
}
if CurrentContracts > CurrentContracts[1] AND ((LatestEntryName(0) == "4차매수")) Then
{
#현재수량 저장
Var3 = CurrentContracts;
Var4 = AvgEntryPrice;
Condition1 = False;
Condition2 = False;
Condition3 = False;
Condition4 = False;
}
if CurrentContracts > CurrentContracts[1] AND ((LatestEntryName(0) == "6차매수") or (LatestEntryName(0) == "5차매수")) Then
{
#현재수량 저장
Var3 = CurrentContracts;
Var4 = AvgEntryPrice;
Condition1 = False;
Condition2 = False;
Condition3 = False;
Condition4 = False;
}
if var1 > 0 and C < Var4 then
ExitLong("bx");
if Condition1 == False AND ((LatestEntryName(0) == "1차매수") OR (LatestEntryName(0) == "2차매수") or (LatestEntryName(0) == "3차매수") )Then
ExitLong("3%익절",AtLimit,Var4*1.03,"",Floor(Var3*0.2),1);
if Condition2 == False AND ((LatestEntryName(0) == "1차매수") OR (LatestEntryName(0) == "2차매수") or (LatestEntryName(0) == "3차매수") ) Then
ExitLong("4%익절",AtLimit,Var4*1.04,"",Floor(Var3*0.3),1);
if Condition3 == False AND ((LatestEntryName(0) == "1차매수") OR (LatestEntryName(0) == "2차매수") or (LatestEntryName(0) == "3차매수") ) Then
ExitLong("5%익절",AtLimit,Var4*1.05,"",Floor(Var3*0.4),1);
if Condition4 == False AND ((LatestEntryName(0) == "1차매수") OR (LatestEntryName(0) == "2차매수") or (LatestEntryName(0) == "3차매수") ) Then
ExitLong("7%익절",AtLimit,Var4*1.07,"",Floor(Var3*0.1),1);
ExitLong("10%익절",AtLimit,Var4*1.10);
if Condition1 == False AND ((LatestEntryName(0) == "4차매수"))Then
ExitLong("3-D%익절",AtLimit,Var4*1.03,"",Floor(Var3*0.5),1);
if Condition2 == False AND ((LatestEntryName(0) == "4차매수")) Then
ExitLong("4-D%익절",AtLimit,Var4*1.04,"",Floor(Var3*0.45),1);
if Condition3 == False AND ((LatestEntryName(0) == "4차매수")) Then
ExitLong("5-D%익절",AtLimit,Var4*1.05,"",Floor(Var3*0.1),1);
if Condition1 == False AND ((LatestEntryName(0) == "6차매수") or (LatestEntryName(0) == "5차매수"))Then
ExitLong("3-E%익절",AtLimit,Var4*1.03,"",Floor(Var3*0.5),1);
if Condition2 == False AND ((LatestEntryName(0) == "6차매수") or (LatestEntryName(0) == "5차매수")) Then
ExitLong("4-E%익절",AtLimit,Var4*1.04,"",Floor(Var3*0.45),1);
if Condition3 == False AND ((LatestEntryName(0) == "6차매수") or (LatestEntryName(0) == "5차매수")) Then
ExitLong("5-E%익절",AtLimit,Var4*1.05,"",Floor(Var3*0.1),1);
}
Else#매수진입중이 아니면
{
#변수 0으로 초기화
var1 = 0;
Var2 = 0;
}
2025-02-03
423
글번호 187593
당근인생 님에 의해서 삭제되었습니다.
2025-01-31
0
글번호 187591
답변완료
예스랭귀지 수식 요청합니다
A = sum(if(H-H(1)>0&&H-H(1)>L(1)-L,1,0),14);
B = sum(IF(l(1)-l>0&&H-H(1)<L(1)-L,1,0),14);
D=eavg(A,5)-eavg(B,5);
D > 100
안녕하세요
위의 키움 수식을 예스랭귀지로 변환 가능할까요?
감사합니다
2025-01-31
512
글번호 187590
정규남 님에 의해서 삭제되었습니다.
2025-01-31
13
글번호 187589
답변완료
문의 드립니다
안녕하세요 새해 복 많이 받으시기 바랍니다.
응답해 주신 지난 아래 수식에서 지표속성창에서 선 굵기와 지표선 값을 표시하도록
체크를 해도 전혀 반응이 없습니다. 지표선 값을 알고싶습니다. 윗쪽 밴드선 값은 선 위에
아래쪽 밴드선 값은 선 아래에 표시해 주실 수 있는지요
감사합니다
======================================
input : hh(8),mult(3),repaint(true),upCss(red),dnCss(blue);
var : n(0),src(0),i(0),w(0),den(0),out(0),mae(0),upper(0),lower(0);
Array : ln[500](0),coefs[500](0);
Array : nwe[500](0),uptx[500](0),dntx[500](0),uptx1[500](0),dntx1[500](0);
src = close;
n = index;
den = 0;
for i = 0 to 499
{
ln[i] = 0;
w = exp(-(pow(i, 2)/(hh *hh * 2)));
coefs[i] = w;
den = den + coefs[i];
}
out = 0;
for i = 0 to 499
{
out = out +(src[i] * coefs[i]);
}
out = out/den;
mae = ma(abs(src - out), 499) * mult;
upper = out + mae;
lower = out - mae;
var : sae(0),y2(0),y1(0),j(0);
var : sum(0),sumw(0);
if Index >= 500 and repaint == true Then
{
for i = 0 to min(499,n - 1)
{
nwe[i] = 0;
Text_Delete(uptx[i]);
Text_Delete(dntx[i]);
Text_Delete(uptx1[i]);
Text_Delete(dntx1[i]);
}
sae = 0;
for i = 0 to min(499,n - 1)
{
sum = 0;
sumw = 0;
for j = 0 to min(499,n - 1)
{
w = exp(-(pow(i-j, 2)/(hh *hh * 2)));
sum = sum + src[j] * w;
sumw = sumw + w;
}
y2 = sum / sumw;
sae = sae + abs(src[i] - y2);
nwe[i] = y2;
}
sae = sae / min(499,n - 1) * mult;
for i = 0 to min(499,n - 1)
{
uptx[i] = text_new(sDate[i],sTime[i],nwe[i]+sae,"-");
Text_SetColor(uptx[i],upcss);
Text_SetStyle(uptx[i],2,2);
dntx[i] = text_new(sDate[i],sTime[i],nwe[i]-sae,"-");
Text_SetColor(dntx[i],dncss);
Text_SetStyle(dntx[i],2,2);
y1 = nwe[i];
}
}
if repaint == False Then
{
plot1(out + mae, "Upper", upCss);
plot2(out - mae, "Lower", dnCss);
}
=============================================
2025-01-31
489
글번호 187588
답변완료
n분동안의 체결건수 종목검색
n분동안의 체결건수 종목검색 부탁합니다
2025-01-31
509
글번호 187587