커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

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

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

첫봉 진입

if sTime == 154600 Then Sell("s",Atstop,NextBarOpen-0.05,1); SetStopEndofday(); 1분봉입니다. 이렇게 하면 첫번째 봉이 완성되기 전에 진입이 될 것 같은데 왜 신호가 안 나오는 걸까요? 시간을 154500 분으로 바꿔봐도 똑같네요.
프로필 이미지
아스가드
2017-07-21
113
글번호 111483
시스템
답변완료

54181 재질문 드립니다.

수고많으십니다. 글번호 54181 수정해 주셔서 적용했으나, 추가 질문드립니다. 1. 수정해 주신대로 했으나 아래와 같이 적용해 보았으나 동일(진입가 or 진입일이 시스템식의 "시스템 성능 보고서" 매수가, 날짜/시간과 다름)합니다. 무엇이 잘못인지 모르겠습니다. if 매수진입여부 == 0 and 매수조건 Then { 매수진입여부 = 1; #신호가 매수신호 중에 있는지 확인하기 위함. 진입가 = O; 진입일 = Date; 진입시간 = Time; } if 매수진입여부 == 1 and 매도조건 Then { 매수진입여부 = 0; 진입가 = 0; } 2. 수정해 주신대로 적용시 검색결과값이 "2017072010"로만 나타납니다. 년,월,일을 정상이나... 시간만 나오고 분,초는 나타나지 않습니다. 수정부탁드립니다. Find(진입일*1000000+진입시간); 3. 추가질문입니다. 위 1번 사항에서 "진입가 = O"로 하였습니다. 시스템 식에서는 EntryPrice로 매수가를 확인합니다만... O(시초가)로 하는게 맞는건가요? C(종가)로 하는것이 맞는건가요? O가 맞다면 C는 왜 안되는지? 반대의 경우도 마찬가지로 이유에 대한 설명도 부탁드립니다. 미리 감사드립니다.
프로필 이미지
자동매매를알자
2017-07-20
102
글번호 111482
종목검색
답변완료

시스템식부탁드립니다

안녕하세요 data1:120틱 data2:720틱 으로서 720틱차트의 3 이평선상승 and 120틱차트의 3,10,20이평선상승: 매수신호 720틱차트의 3 이평선하락 and 120틱차트의 3,10,20이평선하락: 매도신호 위와같이 시스템식부탁드립니다
프로필 이미지
bestkim
2017-07-20
113
글번호 111480
시스템

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

프로필 이미지
렉쳐
2017-07-20
3
글번호 111479
지표
답변완료

특정조건하에서의 매수/매도신호 처리

(1)종가가 20일선 아래 2일이상 머물러있다는 조건하에서 처음으로 양봉이 날때 매수하고 종가가 20일선 위에 2일이상 머물러있다는 조건하에서 처음으로 음봉이 날때 매도한다. 위 로직을 수식화하려면 어떻게 하는지요? (2) 같다라는 표현을 할때 어떨때는 = 어떨때는 ==를 사용합니다. 이 양자의 차이는 무엇인지요? 감사합니다.
프로필 이미지
대단한콩
2017-07-20
116
글번호 111472
시스템
답변완료

문의드립니다.

안녕하세요 사진에 있는 시간 전에는 잘 되다가 이때부터 꼬였는지 3계약 진입하고 2계약 청산하여서 뒤에가 안들어 가는거 같습니다 어떻게 해야할까요 청산식 은 다음과 같습니다. ////청산 //매도 //1,2차 if MarketPosition==-1 and CurrentEntries < 3 Then{ ExitShort("매도익절1",AtLimit,EntryPrice-Benefit,"매도진입1"); ExitShort("매도익절2",AtLimit,EntryPrice-Benefit,"매도진입2"); } if MarketPosition==-1 and CurrentEntries ==3 Then{ ExitShort("매도익절1.",AtLimit,EntryPrice,"매도진입1"); ExitShort("매도익절2.",AtLimit,EntryPrice,"매도진입2"); ExitShort("매도익절3",AtLimit,EntryPrice,"매도진입3"); } if MarketPosition==-1 and CurrentEntries ==4 Then{ ExitShort("매도익절1..",AtLimit,EntryPrice+addPrice,"매도진입1"); ExitShort("매도익절2..",AtLimit,EntryPrice+addPrice,"매도진입2"); ExitShort("매도익절3.",AtLimit,EntryPrice+addPrice,"매도진입3"); ExitShort("매도익절4",AtLimit,EntryPrice+addPrice,"매도진입4"); } if MarketPosition == -1 and CurrentEntries >= 5 then{ ExitShort("매도평균1",AtLimit,AvgEntryPrice,"매도진입1"); ExitShort("매도평균2",AtLimit,AvgEntryPrice,"매도진입2"); ExitShort("매도평균3",AtLimit,AvgEntryPrice,"매도진입3"); ExitShort("매도평균4",AtLimit,AvgEntryPrice,"매도진입4"); ExitShort("매도평균5",AtLimit,AvgEntryPrice,"매도진입5"); ExitShort("매도평균6",AtLimit,AvgEntryPrice,"매도진입6"); ExitShort("매도평균7",AtLimit,AvgEntryPrice,"매도진입7"); ExitShort("매도평균8",AtLimit,AvgEntryPrice,"매도진입8"); ExitShort("매도손절1",AtStop,EntryPrice+Loss,"매도진입1"); ExitShort("매도손절2",AtStop,EntryPrice+Loss,"매도진입2"); ExitShort("매도손절3",AtStop,EntryPrice+Loss,"매도진입3"); ExitShort("매도손절4",AtStop,EntryPrice+Loss,"매도진입4"); ExitShort("매도손절5",AtStop,EntryPrice+Loss,"매도진입5"); ExitShort("매도손절6",AtStop,EntryPrice+Loss,"매도진입6"); ExitShort("매도손절7",AtStop,EntryPrice+Loss,"매도진입7"); ExitShort("매도손절8",AtStop,EntryPrice+Loss,"매도진입8"); } //매수 if MarketPosition==1 and CurrentEntries < 3 Then{ ExitLong("매수익절1",AtLimit,EntryPrice+Benefit,"매수진입1"); ExitLong("매수익절2",AtLimit,EntryPrice+Benefit,"매수진입2"); } if MarketPosition== 1 and CurrentEntries==3 Then{ ExitLong("매수익절1.",AtLimit,EntryPrice,"매수진입1"); ExitLong("매수익절2.",AtLimit,EntryPrice,"매수진입2"); ExitLong("매수익절3",AtLimit,EntryPrice,"매수진입3"); } if MarketPosition== 1 and CurrentEntries==4 Then{ ExitLong("매수익절1..",AtLimit,EntryPrice-addPrice,"매수진입1"); ExitLong("매수익절2..",AtLimit,EntryPrice-addPrice,"매수진입2"); ExitLong("매수익절3.",AtLimit,EntryPrice-addPrice,"매수진입3"); ExitLong("매수익절4",AtLimit,EntryPrice-addPrice,"매수진입4"); } if MarketPosition == 1 and CurrentEntries >= 5 then{ ExitLong("매수평균1",AtLimit,AvgEntryPrice,"매수진입1"); ExitLong("매수평균2",AtLimit,AvgEntryPrice,"매수진입2"); ExitLong("매수평균3",AtLimit,AvgEntryPrice,"매수진입3"); ExitLong("매수평균4",AtLimit,AvgEntryPrice,"매수진입4"); ExitLong("매수평균5",AtLimit,AvgEntryPrice,"매수진입5"); ExitLong("매수평균6",AtLimit,AvgEntryPrice,"매수진입6"); ExitLong("매수평균7",AtLimit,AvgEntryPrice,"매수진입7"); ExitLong("매수평균8",AtLimit,AvgEntryPrice,"매수진입8"); ExitLong("매수손절1",AtStop,EntryPrice-Loss,"매수진입1"); ExitLong("매수손절2",AtStop,EntryPrice-Loss,"매수진입2"); ExitLong("매수손절3",AtStop,EntryPrice-Loss,"매수진입3"); ExitLong("매수손절4",AtStop,EntryPrice-Loss,"매수진입4"); ExitLong("매수손절5",AtStop,EntryPrice-Loss,"매수진입5"); ExitLong("매수손절6",AtStop,EntryPrice-Loss,"매수진입6"); ExitLong("매수손절7",AtStop,EntryPrice-Loss,"매수진입7"); ExitLong("매수손절8",AtStop,EntryPrice-Loss,"매수진입8"); }
프로필 이미지
hanwoon
2017-07-20
144
글번호 111469
시스템
답변완료

부탁드립니다

Input:atrLength(12),multi(1); Var:j(0),dayATR(0),sum(0),upTr(100),dnTr(-100),trnd(0), date11(0),date12(0),time11(0),time12(0),TL1(0), date21(0),date22(0),time21(0),time22(0),TL2(0), date31(0),date32(0),time31(0),time32(0),TL3(0); var : HH(0),LL(0); Array:hiVal[10](0),loVal[10](0),hiBar[10](0),loBar[10](0); //hiVal[1]은 전고점, hiVal[2]는 전전고점, hiVal[3]은 전전전고점 //hiVal[0]은 변곡점 이후 현재봉까지의 고점. 현재 고점은 진행중이므로 계속 바뀐다. //loVal[0]은 반대 개념 HH = (H+H[1])/2; LL = (L+L[1])/2; if index >= 1 then{ sum = 0; for j = 1 to atrLength { sum = sum + Max(DayClose(j+1),DayHigh(j)) - Min(DayClose(j+1),DayLow(j)); } dayATR = sum/atrLength; //일봉기준으로 ATR 산출 for j = 1 to 9 { //전고,전저점을 9개까지 보관 loBar[j] = loBar[j] + 1; //전저점의 위치. 현재 봉으로부터 떨어져 있는 거리 hiBar[j] = hiBar[j] + 1; //전고점의 위치 } if hiVal[0] <= HH or hiVal[0] == 0 then { //전고,전저점 이후 현재까지의 고점 hiVal[0] = HH; //0을 체크한 이유는 초기에 값이 없는 구간이 생기기 때문 hiBar[0] = 0; //현재 고점의 위치가 0이란 것은 현재봉의 고가가 구간 고점이라는 의미 } else { hiBar[0] = hiBar[0] + 1; //현재 고점의 위치 } if loVal[0] >= LL or loVal[0] == 0 then { //전고,전저점 이후 현재까지 저점 loVal[0] = LL; loBar[0] = 0; } else { loBar[0] = loBar[0] + 1; //현재 구간 저점의 위치 } if trnd != dnTr && hiVal[0] > HH && hiVal[0] - (dayATR * multi) > LL then trnd = dnTr; //저가가 고가 대비 변동률보다 밑으로 떨어지면 하락추세로 설정 //단, 현재봉의 고가가 변곡점 이후 최고가이면 상승 추세가 진행중이라고 본다. //그래서 현재봉의 고가가 hiVal[0]보다 작다는 조건이 추가되었다. else if trnd != upTr && loVal[0] < LL && loVal[0] + (dayATR * multi) < HH then trnd = upTr; //고가가 저가 대비 변동률보다 높으면 상승추세로 설정 if trnd[1] == upTr and trnd == dnTr then { //상승추세였다가 하락추세로 바뀌었다면 for j = 8 downto 1 { //새로운 전고점이 생기는 것이므로 hiVal[j+1] = hiVal[j]; //전고점을 하나씩 뒤로 보낸다. hiBar[j+1] = hiBar[j]; //전고점은 전전고점이 되고, 전전고점은 전전전고점이 된다. } hiVal[1] = hiVal[0]; //새로운 전고점에 현재 고점을 대입 hiBar[1] = hiBar[0]; hiVal[0] = HH; //전고점이 확정되었으므로 전고점 이후 최고가는 현재봉의 고가 hiBar[0] = 0; loVal[0] = LL; loBar[0] = 0; //전고점이 새로 생긴 것이니까 전저점에서 전고점까지 추세선을 긋는다. date11 = date[loBar[1]]; //추세선 시작일. 전저점의 날짜 time11 = stime[loBar[1]]; //추세선 시작시간 Value11 = loVal[1]; //추세선 시작가격 date12 = date[hiBar[1]]; //추세선 종료일. 전고점의 날짜 time12 = stime[hiBar[1]]; //추세선 종료시간 Value12 = hiVal[1]; //추세선 종료가격 TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); //TL_New는 신규 추세선을 그려주는 함수 } if trnd[1] == dnTr and trnd == dnTr and //추세는 하락 상태에서 바뀌지 않았는데 hiVal[1] < hiVal[0] then { //전고점보다 더 높은 고점이 출현했다면 if loVal[1] <= loVal[0] then { //전저점은 갱신되지 않았다면 hiVal[1] = hiVal[0]; //전고점을 현재의 고점으로 바꿔준다. hiBar[1] = hiBar[0]; hiVal[0] = HH; hiBar[0] = 0; loVal[0] = LL; loBar[0] = 0; //전고점이 추가된 게 아니고 바뀐 것이므로 종료일,종료시간,종료가격만 바꿔준다. date12 = date[hiBar[1]]; //추세선 종료일 time12 = stime[hiBar[1]]; Value12 = hiVal[1]; TL_SetEnd(TL1, date12,time12,Value12); //TL_SetEnd는 기존추세선의 종료지점을 변경해주는 추세선 함수이다. //TL_Delete 함수를 써서 직전의 추세선을 지우고 다시 TL_New로 추세선을 추가해도 된다. } else { //전저점도 갱신되었다면 for j = 8 downto 1 { //전고점, 전저점을 새로이 추기 hiVal[j+1] = hiVal[j]; //전고점을 하나씩 뒤로 보낸다. hiBar[j+1] = hiBar[j]; //전고점은 전전고점이 되고, 전전고점은 전전전고점이 된다. loVal[j+1] = loVal[j]; //전저점을 하나씩 뒤로 보낸다. loBar[j+1] = loBar[j]; //전저점은 전전저점이 되고, 전전저점은 전전전저점이 된다. } hiVal[1] = hiVal[0]; //새로운 전고점에 현재 고점을 대입 hiBar[1] = hiBar[0]; loVal[1] = loVal[0]; //새로운 전저점에 현재 저점을 대입 loBar[1] = loBar[0]; hiVal[0] = HH; //전고점 이후 최고가는 현재봉의 고가 hiBar[0] = 0; loVal[0] = LL; loBar[0] = 0; //전저,전고점이 새로 생긴 것이니까 전전고점에서 전저점까지 //그리고 전저점에서 전고점까지 추세선 2개를 생성한다. date11 = date[hiBar[2]]; //추세선 시작일. 전전고점의 날짜 time11 = stime[hiBar[2]]; //추세선 시작시간 Value11 = hiVal[2]; //추세선 시작가격 date12 = date[loBar[1]]; //추세선 종료일. 전저점의 날짜 time12 = stime[loBar[1]]; //추세선 종료시간 Value12 = loVal[1]; //추세선 종료가격 TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); TL_SetSize(TL1,2); date11 = date[loBar[1]]; //추세선 시작일. 전저점의 날짜 time11 = stime[loBar[1]]; //추세선 시작시간 Value11 = loVal[1]; //추세선 시작가격 date12 = date[hiBar[1]]; //추세선 종료일. 전고점의 날짜 time12 = stime[hiBar[1]]; //추세선 종료시간 Value12 = hiVal[1]; //추세선 종료가격 TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); } } if trnd[1] == dnTr and trnd == upTr then { //추세가 하락에서 상승으로 바뀌었을 경우 for j = 8 downto 1 { //이전저점은 전전저점으로, 전전저점은 전전전저점으로 번호를 부여 loVal[j+1] = loVal[j]; loBar[j+1] = loBar[j]; } loVal[1] = loVal[0]; loBar[1] = loBar[0]; loVal[0] = LL; loBar[0] = 0; hiVal[0] = HH; hiBar[0] = 0; date11 = date[hiBar[1]]; //전저점이 새로이 생긴 것이므로 시작점은 전고점이 된다. time11 = stime[hiBar[1]]; Value11 = hiVal[1]; date12 = date[loBar[1]]; time12 = stime[loBar[1]]; Value12 = loVal[1]; TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); } if trnd[1] == upTr and trnd == upTr and //추세는 상승을 유지하고 있는데 loVal[1] > loVal[0] then { //전저점보다 낮은 저가가 출현했다면 if hiVal[1] >= hiVal[0] then { //고점 갱신이 되지 않았다면 loVal[1] = loVal[0]; //직전의 전저점만 바꿔준다. loBar[1] = loBar[0]; loVal[0] = LL; loBar[0] = 0; hiVal[0] = HH; hiBar[0] = 0; date12 = date[loBar[1]]; time12 = stime[loBar[1]]; Value12 = loVal[1]; TL_SetEnd(TL1, date12,time12,Value12); } else { //고점도 이전고점보다 높다면 for j = 8 downto 1 { //전고점,전저점을 새로이 생성 hiVal[j+1] = hiVal[j]; hiBar[j+1] = hiBar[j]; loVal[j+1] = loVal[j]; loBar[j+1] = loBar[j]; } hiVal[1] = hiVal[0]; hiBar[1] = hiBar[0]; loVal[1] = loVal[0]; loBar[1] = loBar[0]; loVal[0] = LL; loBar[0] = 0; hiVal[0] = HH; hiBar[0] = 0; date11 = date[loBar[2]]; //시작점이 전전저점 time11 = stime[loBar[2]]; Value11 = loVal[2]; date12 = date[hiBar[1]]; //종료는 전고점 time12 = stime[hiBar[1]]; Value12 = hiVal[1]; TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); TL_SetSize(TL1,2); date11 = date[hiBar[1]]; //2번째 시작은 전고점이 된다. time11 = stime[hiBar[1]]; Value11 = hiVal[1]; date12 = date[loBar[1]]; //2번째 종료는 전저점 time12 = stime[loBar[1]]; Value12 = loVal[1]; TL1 = TL_New(date11,time11,Value11,date12,time12,Value12); } } //여기까지가 파동선이고 아래는 추세선이다. if loVal[2] < loVal[1] then { //전전저점보다 전저점이 높을 경우 //전전저점으로부터 전저점까지 지지추세선을 긋는데 //시작점인 전전저점이 바뀌면 신규추세선을 긋고(TL_New) //시작점이 바뀌지 않았다면 종료지점만 변경해준다(TL_SetEnd) if loBar[2][1] + 1 != loBar[2][0] then { //시작점이 바뀌었는지 여부는 가격은 동일할 수 있으므로 위치값으로 판별한다. //위치값은 1씩 증가시켜왔으므로 이전 봉에서의 위치값이 1 차이나는지로 확인 //1 이상 차이가 나면 전전고점이 바뀐 것으로 보고 추세선을 추가로 그린다. date21 = date[loBar[2]]; time21 = stime[loBar[2]]; Value21 = loVal[2]; date22 = date[0]; //추세선이므로 현재 봉까지 그려준다. time22 = stime[0]; Value22 = (loVal[1]-loVal[2])/(loBar[2]-loBar[1])*loBar[2]+LoVal[2]; //종료시점의 가격은 직선의 기울기와 절편을 계산해서 구한다. TL2 = TL_New(date21,time21,Value21,date22,time22,Value22); } else { //전전저점이 바뀌지 않았다면 종료시점만 변경하면 된다. date22 = date[0]; time22 = stime[0]; Value22 = (loVal[1]-loVal[2])/(loBar[2]-loBar[1])*loBar[2]+LoVal[2]; TL_SetEnd(TL2, date22,time22,Value22); //TL_SetExtRight 함수는 추세선을 오른쪽으로 연장하는 함수인데 //이 함수를 사용하면 모든 추세선이 현재봉까지 연장되어 알아볼 수가 없다. } } if hiVal[2] > hiVal[1] then { if hiBar[2][1] + 1 != hiBar[2][0] then { date31 = date[hiBar[2]]; time31 = stime[hiBar[2]]; Value31 = hiVal[2]; date32 = date[0]; time32 = stime[0]; Value32 = (hiVal[1]-hiVal[2])/(hiBar[2]-hiBar[1])*hiBar[2]+hiVal[2]; TL3 = TL_New(date31,time31,Value31,date32,time32,Value32); } else { date32 = date[0]; time32 = stime[0]; Value32 = (hiVal[1]-hiVal[2])/(hiBar[2]-hiBar[1])*hiBar[2]+hiVal[2]; TL_SetEnd(TL3, date32,time32,Value32); } } if trnd == upTr and loVal[2] > loVal[1] then TL_SetColor(TL1,BLUE); else if trnd == dnTr and hiVal[2] < hiVal[1] then TL_SetColor(TL1,RED); else TL_SetColor(TL1,BLACK); TL_SetSize(TL1,2); TL_SetColor(TL2,RED); TL_SetColor(TL3,BLUE); } 위 수식은 다른분이 사용했던 추세선 지표수식입니다 이 수식을 응용하여 사용하고자 합니다 추세선이 자동으로 끝나는 시점부터 한쪽 방향만 진행하고자 합니다 적용 수식(아래) Input : Period(12), sigPeriod(9); value1 = TRIX(Period); value2 = ema(value1, sigPeriod); # 매수/매도청산 If CrossUP(value1, value2) Then { Buy(); } # 매도/매수청산 If CrossDown(value1, value2) Then { Sell(); } 추세선이 끝나는 시점부터 한쪽방향만 진행할 수 있도록 TRIX수식에 적용하여 주세요 다시말씀 드리면 추세선 상승인 경우 매수진행만 추세선 하락인 경우 매도진행만 수식 부탁합니다
프로필 이미지
남산
2017-07-20
134
글번호 111467
시스템

지치울부자 님에 의해서 삭제되었습니다.

프로필 이미지
지치울부자
2017-07-20
4
글번호 111465
강조

지치울부자 님에 의해서 삭제되었습니다.

프로필 이미지
지치울부자
2017-07-20
0
글번호 111464
시스템