커뮤니티
예스랭귀지 Q&A
답변완료
[공지] 예스랭귀지 AI 어시스턴트, '예스나 AI' 출시 및 무료 체험 안내
안녕하세요, 예스스탁 입니다.복잡한 수식 공부 없이 여러분의 아이디어를 말하면 시스템 트레이딩 언어 예스랭귀지로 작성해주는 서비스예스나 AI(YesNa AI)가 출시되었습니다.지금 예스나 AI를 직접 경험해 보실 수 있도록 20크레딧(질문권 20회)를 무료로 증정해 드리고 있습니다.바로 여러분의 아이디어를 코드로 변환해보세요.--------------------------------------------------🚀 YesNa AI 핵심 기능- 지표식/전략식/종목검색식 생성: 자연어로 요청하면 예스랭귀지 문법에 맞는 코드를 작성합니다.- 종목검색식 변환 지원: K증권의 종목 검색식을 예스랭귀지로 변환 지원합니다.- 컴파일 검증: 작성된 코드가 실행 가능한지 컴파일러를 통해 문법 검증을 거쳐 결과물을 제공합니다.상세한 서비스 개요 및 활용 방법은 [서비스 소개 페이지]에서 확인하실 수 있습니다.▶ 서비스 소개 페이지: 바로가기서비스 사용 유의사항 및 결제 환불정책은 [이용약관]을 참고 부탁드립니다.▶ 서비스 이용약관: 바로가기💬 이용 문의사용 중 문의사항은 [프로그램 사용법 Q&A] 게시판에서 [예스나 AI] 카테고리를 설정 후 문의해 주시면 상세히 안내해 드리겠습니다.--------------------------------------------------앞으로도 AI를 활용한 다양한 트레이딩 기능들을 지속적으로 선보일 예정입니다.많은 관심과 기대 부탁드립니다.
2026-02-27
1829
글번호 230811
답변완료
수식 확인 부탁드립니다.
안녕하십니까
작성하여 주신 수식 검토 부탁드립니다.
-------------------------------------------------------------------------
input : P(20),이평기간(5);
var : cnt(0),sum1(0),mav1(0),sum2(0),mav2(0),t(0),count(0);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
Array : 상[100](False);
if date >= 19981207 then
{
if date < 20050328 && CodeCategory() == 2 then
UpLimit = (BP[0] * 1.12);
Else if date >= 20050328 and date < 20150615 Then
UpLimit = (BP[0] * 1.15);
Else
UpLimit = (BP[0] * 1.30);
if CodeCategory() == 2 then
{
if date >= 20030721 then
{
up1 = int(UpLimit/100+0.00001)*100;
up2 = int(UpLimit/100+0.00001)*100;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
else
{
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/10+0.00001)*10;
up7 = int(UpLimit/1+0.00001)*1;
}
}
Else
{
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
up7 = int(UpLimit/1+0.00001)*1;
}
if CodeCategory() == 1 || CodeCategory() == 2 then
{
if sdate < 20101004 Then
{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up6);
}
Else
{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up7);
}
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
상한가 = up6;
}
}
if Bdate != Bdate[1] Then
{
For cnt = 99 DownTo 1
{
상[cnt] = 상[cnt-1];
}
}
if C == 상한가 Then
상[0] = true;
Else
상[0] = False;
count = 0;
For cnt = 0 to P-1
{
if 상[cnt] == true Then
count = count+1;
}
sum1 = 0;
sum2 = NextBarOpen;
For cnt = 0 to 이평기간-1
{
sum1 = sum1 + DayClose(cnt);
if cnt < P-1 Then
sum2 = sum2 + DayClose(cnt);
}
mav1 = sum1/이평기간;
mav2 = sum2/이평기간;
if NextBarSdate != sDate Then
{
T = 0;
if C <= mav1*1.15 and C >= mav1*0.85 and count >= 1 Then
{
T = 1;
if NextBarOpen < mav2 Then
{
T = 2;
Buy("b11",AtMarket);
}
Else
{
T = 3;
Buy("b12",AtLimit,mav2);
}
}
Condition1 = False;
}
Else
{
if L <= mav1 Then
Condition1 = true;
if Condition1 == False and T == 3 Then
Buy("b2",AtLimit,mav2);
}
SetStopEndofday(151800);
SetStopLoss(5,PercentStop);
#ㅇ 매수
# 1. 최근 20거래일 중 종가 상한가
# 2. 일봉 상 가격 형성이 5일선 기준 +-15% 이내
# 3. 당일 시가가 일봉기준 5일선 위에서 시작하면 당일 일봉 상 5일 이동평균선에 닿거나 하향하면 바로 매수
# 4. 당일 시가가 일봉기준 5일선 아래에서 시작하면 시가로 매수 주문
#매수 주문은 시가가 전일종가 대비 +-20 이내에서 형성될때만 나갈수있게 부탁드립니다.
#ㅇ 매도
#오후 3시 18분 전량매도
검토 요청
5일선 위에서 시가가 형성되어도 시가로 매수 주문이 발생 합니다.
확인 부탁드립니다.,
감사합니다.
2022-07-13
1494
글번호 160693
답변완료
수식 부탁드립니다
수고하십니다.
늘 감사드립니다.
아래 수식은 Data2 30분봉 기준값 수식으로 현재값이 기준에 도달하면 매매되는
시스템으로 이 현재값을 5ma이동평균값으로 변경 가능한지요
수식부탁드립니다
input : 익절(40),손절(20),k(5),k1(5);
Value1=Data2(C-PriceScale*k);
Value2=Data2(C+PriceScale*k1);
if sTime >= 93000 and NextBarSdate == sDate Then
{
if c > value1 Then
Buy("b",AtLimit, Value1);
if c < Value2 Then
Sell("s",AtLimit,Value2);
}
SetStopProfittarget(익절,PointStop);
SetStopLoss(손절,PointStop);
2022-07-13
1526
글번호 160692
알로우kim 님에 의해서 삭제되었습니다.
2022-07-13
12
글번호 160691
답변완료
수식 질문드립니다.
현재 포지션이 매수일때,
현재 포지션이 매도일때,
어떻게 구현할지 궁금합니다.
감사합니다. !!
2022-07-13
1415
글번호 160690
답변완료
이평수렴확장
수고가많습니다
영웅문 수식 한국투자증권수식 적용될수있도록 부탁 드립니다
(분.틱다적용 될수있도록)
A)
1.a=ma(c,3);
b=ma(c,60);
x=(a-b);
if(a>b && x>x(1),x,0)
2.a=ma(c,3);
b=ma(c,60);
x=(a-b);
if(a>b && x>x(1),x,0)
3.a=ma(c,3);
b=ma(c,60);
x=(a-b);
if(a<b && x>x(1),x,0)
4.a=ma(c,3);
b=ma(c,60);
x=(a-b);
if(a<b && x<x(1),x,0)
B)
1.a=ma(c,3);
b=ma(c,60);
x=(a-b);
if(a>b && x>x(1),-x,0)
2.a=ma(c,3);
b=ma(c,60);
x=(a-b);
if(a>b && x<x(1),-x,0)
3.a=ma(c,3);
b=ma(c,60);
x=(a-b);
if(a<b && x>x(1),-x,0)
4.a=ma(c,3);
b=ma(c,60);
x=(a-b);
if(a<b && x<x(1),-x,0)
2022-07-13
1570
글번호 160689
답변완료
문의합니다
안녕하세요
간단한 식인데, 시스템으로 설정하다고 조금 헛갈린 부분이 있어서
문의합니다
매수청산(환매도)일 경우
SetStopProfittarget(50,PointStop) 에서 이익실현가의 -5호가로 주문이 나가고,
setstoploss(200,pointstop); 에서 손실실현가의 -5호가로 주문이 나가는 식 부탁드려요
2022-07-13
1849
글번호 160688
답변완료
시스템식 문의 드립니다.
요청드렸던 시스템식 관련해서 감사드리다는 말씀을 먼저 드리고 싶습니다.
항상 감사드립니다.
그리고 확인중에 하나 궁금한 점이 있어 이렇게 글을 남깁니다.
중간쯤 (약 89~90번째 줄) 에
if var1 > 0 and C < AvgEntryPrice then
ExitLong("bx");
이 문구가 있는데,
작성했던 이유는 var1 > 0 이라는것은 일부 청산을 했고, 1분봉상 종가가 평단만큼
다시 내려오면 매도청산하는 내용인데,
해당시스템식으로 돌려보니, 일부청산 이후 1분봉산 종가가 평단이 아니라 마지막
진입가격만큼 내려오면 매도 청산을 하는것을 볼수 있었습니다.
확인좀 부탁드리겠습니다. .
----------------------------------------------------------------------------
input : 고점(7000);
input : 원금(1000000);
var : A1(0),A2(0),A3(0),A4(0),A5(0), 손절(0);
Var : day(0),EntryDay(0),entry(False),dd(0),ED(0);
A1 = 고점*0.95;
A2 = 고점*0.93;
A3 = 고점*0.91;
A4 = 고점*0.89;
A5 = 고점*0.87;
손절 = 고점*0.85;
if Bdate != Bdate[1] Then
{
Condition1 = False;
entry = true;
day = day+1;
dd = dd+1;
}
if TotalTrades > TotalTrades[1] Then
entry = False;
if DAYClose(1) >= DayClose(2)*1.29
OR DAYClose(2) >= DayClose(3)*1.29
OR DAYClose(3) >= DayClose(4)*1.29
OR DAYClose(4) >= DayClose(5)*1.29
OR DAYClose(5) >= DayClose(6)*1.29
OR DAYClose(6) >= DayClose(7)*1.29
Then
Condition1 = TRUE;
if condition1 == true AND MarketPosition == 0 and entry == true and c > J1 Then
Buy("A매수",AtLimit,J1,Floor((원금*0.2)/A1));
if condition1 == true and entry == true and LatestExitName(1) != "손절" AND ((LatestEntryName(0) == "A매수") OR (MarketPosition == 0 AND C < J1 AND C >= J2)) Then
Buy("B매수",AtLimit,J2,Floor((원금*0.2)/A2));
if condition1 == true and entry == true and LatestExitName(1) != "손절" AND ((LatestEntryName(0) == "B매수") OR (MarketPosition == 0 AND C < J2 AND C >= J3)) Then
Buy("C매수",AtLimit,J3,Floor((원금*0.2)/A3));
if condition1 == true and entry == true and LatestExitName(1) != "손절" AND ((LatestEntryName(0) == "C매수") OR (MarketPosition == 0 AND C < J3 AND C >= J4)) Then
Buy("D매수",AtLimit,J4,Floor((원금*0.2)/A4));
if condition1 == true and entry == true and LatestExitName(1) != "손절" AND ((LatestEntryName(0) == "D매수") OR (MarketPosition == 0 AND C < J4 AND C >= J5)) Then
Buy("E매수",AtLimit,J5,Floor((원금*0.2)/A5));
#매수진입
if MarketPosition == 1 Then
{
#전봉대비 수량 감소(일부 청산발생을 위미)
if CurrentContracts < CurrentContracts[1] Then
{
#청산가 저장
var1 = LatestExitPrice(0);
Condition1 = False;
Condition2 = False;
Condition3 = False;
Condition4 = False;
Condition5 = False;
}
#전봉대비 수량 증가(추가 진입발생을 의미)
if CurrentContracts > CurrentContracts[1] Then
{
#현재수량 저장
Var3 = CurrentContracts;
Condition1 = False;
Condition2 = False;
Condition3 = False;
Condition4 = False;
Condition5 = False;
}
if var1 > 0 and C < AvgEntryPrice then
ExitLong("bx");
if Condition1 == False AND ((LatestEntryName(0) == "A매수") OR (LatestEntryName(0) == "B매수") or (LatestEntryName(0) == "C매수"))Then
ExitLong("3%익절",AtLimit,AvgEntryPrice*1.03,"",Floor(Var3*0.4),1);
if Condition2 == False AND ((LatestEntryName(0) == "A매수") OR (LatestEntryName(0) == "B매수") or (LatestEntryName(0) == "C매수")) Then
ExitLong("4%익절",AtLimit,AvgEntryPrice*1.04,"",Floor(Var3*0.3),1);
if Condition3 == False AND ((LatestEntryName(0) == "A매수") OR (LatestEntryName(0) == "B매수") or (LatestEntryName(0) == "C매수")) Then
ExitLong("5%익절",AtLimit,AvgEntryPrice*1.05,"",Floor(Var3*0.1),1);
if Condition4 == False AND ((LatestEntryName(0) == "A매수") OR (LatestEntryName(0) == "B매수") or (LatestEntryName(0) == "C매수")) Then
ExitLong("7%익절",AtLimit,AvgEntryPrice*1.07,"",Floor(Var3*0.1),1);
ExitLong("10%익절",AtLimit,AvgEntryPrice*1.10);
if Condition1 == False AND ((LatestEntryName(0) == "D매수"))Then
ExitLong("1-D%익절",AtLimit,AvgEntryPrice*1.01,"",Floor(Var3*0.3),1);
if Condition2 == False AND ((LatestEntryName(0) == "D매수")) Then
ExitLong("2-D%익절",AtLimit,AvgEntryPrice*1.02,"",Floor(Var3*0.3),1);
if Condition3 == False AND ((LatestEntryName(0) == "D매수")) Then
ExitLong("3-D%익절",AtLimit,AvgEntryPrice*1.03,"",Floor(Var3*0.3),1);
if Condition4 == False AND ((LatestEntryName(0) == "D매수")) Then
ExitLong("4-D%익절",AtLimit,AvgEntryPrice*1.04,"",Floor(Var3*0.1),1);
if Condition1 == False AND ((LatestEntryName(0) == "E매수"))Then
ExitLong("본절",AtLimit,AvgEntryPrice*1.003,"",Floor(Var3*0.5),1);
if Condition2 == False AND ((LatestEntryName(0) == "E매수")) Then
ExitLong("1-E%익절",AtLimit,AvgEntryPrice*1.01,"",Floor(Var3*0.4),1);
if Condition3 == False AND ((LatestEntryName(0) == "E매수")) Then
ExitLong("2-E%익절",AtLimit,AvgEntryPrice*1.02,"",Floor(Var3*0.1),1);
}
Else#매수진입중이 아니면
{
#변수 0으로 초기화
var1 = 0;
Var2 = 0;
}
if MarketPosition == 1 Then
ExitLong("손절",AtStoP,손절);
2022-07-13
1481
글번호 160687
답변완료
시간 매수매도 문의
안녕하세요 개발자님.
시간 기준 시초가와 장마감 동시호가 매매 방법을 모르겠습니다.
질문 드리는 내용은 다음과 같습니다.
1. 시초가 매수 낮 12시 매도
2. 장 마감 동시호가 매수 다음날 시초가 매도.
3. 낮 12시 매수, 다음날 1시 매도.
항상 도움 주셔서 감사합니다~!
2022-07-12
1164
글번호 160686
신대륙발견 님에 의해서 삭제되었습니다.
2022-07-12
23
글번호 160685