커뮤니티

예스랭귀지 Q&A

글쓰기
답변완료

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

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

지표문의

1.수식지님 파동선 atr 인데,2 예제처럼 고점 대신 볼린저밴드 상단 대입,저점 대신 볼린저밴드 하단을 넣으니 지표표현이 안되어서요. 검토해서 수정 좀 해주세요. Input:atrLength(14),multi(1); Var:j(0),dayATR(0),sum(0),upTr(100),dnTr&#65279;(-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); Array:hiVal[10](0),loVal[10](0),hiBar[10](0),loBar[10](0); //hiVal[1]은 전고점, hiVal[2]는 전전고점, hiVal[3]은 전전전고점 //hiVal[0]은 변곡점 이후 현재봉까지의 고점. 현재 고점은 진행중이므로 계속 바뀐다. //loVal[0]은 반대 개념 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] <= H or hiVal[0] == 0 then { //전고,전저점 이후 현재까지의 고점 hiVal[0] = H; //0을 체크한 이유는 초기에 값이 없는 구간이 생기기 때문 hiBar[0] = 0; //현재 고점의 위치가 0이란 것은 현재봉의 고가가 구간 고점이라는 의미 } else { hiBar[0] = hiBar[0] + 1; //현재 고점의 위치 } if loVal[0] >= L or loVal[0] == 0 then { //전고,전저점 이후 현재까지 저점 loVal[0] = L; loBar[0] = 0; } else { loBar[0] = loBar[0] + 1; //현재 구간 저점의 위치 } if trnd != dnTr && hiVal[0] > H && hiVal[0] - (dayATR * multi) > L then trnd = dnTr; //저가가 고가 대비 변동률보다 밑으로 떨어지면 하락추세로 설정 //단, 현재봉의 고가가 변곡점 이후 최고가이면 상승 추세가 진행중이라고 본다. //그래서 현재봉의 고가가 hiVal[0]보다 작다는 조건이 추가되었다. else if trnd != upTr && loVal[0] < L && loVal[0] + (dayATR * multi) < H 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] = H; //전고점이 확정되었으므로 전고점 이후 최고가는 현재봉의 고가 hiBar[0] = 0; loVal[0] = L; 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] = H; hiBar[0] = 0; loVal[0] = L; 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] = H; //전고점 이후 최고가는 현재봉의 고가 hiBar[0] = 0; loVal[0] = L; 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] = L; loBar[0] = 0; hiVal[0] = H; 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] = L; loBar[0] = 0; hiVal[0] = H; 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] = L; loBar[0] = 0; hiVal[0] = H; 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); [ 2.예제 Input:atrLength(14),multi(1),ma1(2); Input : Period(20), MultiD(2); 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),HO(0),LO(0); var : MAv(0),BBup(0),BBdn(0); Array:hiVal[10](0),loVal[10](0),hiBar[10](0),loBar[10](0); //hiVal[1]은 전고점, hiVal[2]는 전전고점, hiVal[3]은 전전전고점 //hiVal[0]은 변곡점 이후 현재봉까지의 고점. 현재 고점은 진행중이므로 계속 바뀐다. //loVal[0]은 반대 개념 HO= BollBandUp(Period,MultiD); LO= BollBandDown(Period,MultiD); sum = 0; for j = 1 to atrLength { sum = sum + Max(C[j+1],H[j]) - Min(C[j+1],L[j]); } dayATR = sum/atrLength; //일봉기준으로 ATR 산출 for j = 1 to 9 { //전고,전저점을 9개까지 보관 loBar[j] = loBar[j] + 1; //전저점의 위치. 현재 봉으로부터 떨어져 있는 거리 hiBar[j] = hiBar[j] + 1; //전고점의 위치 } if hiVal[0] <= HO or hiVal[0] == 0 then { //전고,전저점 이후 현재까지의 고점 hiVal[0] = HO; //0을 체크한 이유는 초기에 값이 없는 구간이 생기기 때문 hiBar[0] = 0; //현재 고점의 위치가 0이란 것은 현재봉의 고가가 구간 고점이라는 의미 } else { hiBar[0] = hiBar[0] + 1; //현재 고점의 위치 } if loVal[0] >= LO or loVal[0] == 0 then { //전고,전저점 이후 현재까지 저점 loVal[0] = LO; loBar[0] = 0; } else { loBar[0] = loBar[0] + 1; //현재 구간 저점의 위치 } if trnd != dnTr && hiVal[0] > HO && hiVal[0] - (dayATR * multi) > LO then trnd = dnTr; //저가가 고가 대비 변동률보다 밑으로 떨어지면 하락추세로 설정 //단, 현재봉의 고가가 변곡점 이후 최고가이면 상승 추세가 진행중이라고 본다. //그래서 현재봉의 고가가 hiVal[0]보다 작다는 조건이 추가되었다. else if trnd != upTr && loVal[0] < LO && loVal[0] + (dayATR * multi) < HO 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] = HO; //전고점이 확정되었으므로 전고점 이후 최고가는 현재봉의 고가 hiBar[0] = 0; loVal[0] = LO; 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] = HO; hiBar[0] = 0; loVal[0] = LO; 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] = HO; //전고점 이후 최고가는 현재봉의 고가 hiBar[0] = 0; loVal[0] = LO; 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] = LO; loBar[0] = 0; hiVal[0] = HO; 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] = LO; loBar[0] = 0; hiVal[0] = HO; 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] = LO; loBar[0] = 0; hiVal[0] = HO; 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 { if loBar[2][1] + 1 != loBar[2][0] then { 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,RGB(128,128,128)); else if trnd == dnTr and hiVal[2] < hiVal[1] then TL_SetColor(TL1,RGB(128,128,128)); else TL_SetColor(TL1,RGB(128,128,128)); TL_SetSize(TL1,0.5); TL_SetColor(TL2,YELLOW); TL_SetSize(TL2,1); TL_SetColor(TL3,GREEN); TL_SetSize(TL3,1); 3.그럼 수고하세요
프로필 이미지
성공예견
2015-07-07
266
글번호 88065
지표

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

프로필 이미지
2wnwn
2015-07-07
10
글번호 88064
시스템
답변완료

성과분석 문의

if MarketPosition == 0 and entry == 0 and cond1 == true Then{ if V7 > V8 Then sell("s1",AtStop,V7); if V7 < V8 Then sell("s2",Atlimit,V8); V7이나 V8 지정가에 매도진입하는 것보다 0.02pt 낮게 진입하는 것, 즉, if MarketPosition == 0 and entry == 0 and cond1 == true Then{ if V7 > V8 Then sell("s1",AtStop,V7-0.02); if V7 < V8 Then sell("s2",Atlimit,V8-0.02); 의 성과분석이 더 수익률과 수익금이 더 좋은 경우는 왜 그럴까요? 다른 조건은 모두 동일하며 체결이 안될 위험이 없다면 하면 비싸게 매도하는 것이 더 수익이 좋아야 하는데 싸게 매도하는데도 성과는 오히려 좋습니다.
프로필 이미지
통큰베팅
2015-07-07
166
글번호 88063
시스템
답변완료

목표수익 달성 또는 손실시 진입제한 수식 부탁합니다.

크루드 오일 거래시스템을 만들려고합니다. 거래시간은 아침9시부터 다음날 새벽2시까지이고요... 거래시간동안 누적수익이 20틱이상 발생하거나, 누적손실이 30틱 발생하면 진입을 중단시키고 싶습니다. 수식 수정 부탁드립니다. Input : shortPeriod(5), longPeriod(20), period(15); Input : 거래시간1(1), 시작시간1(090000), 끝시간1(020000); value1 = ma(C, shortPeriod); value2 = ma(C, longPeriod); value3 = ma(C, Period); Value4 = C/Value1*100; Value5 = PositionProfit; condition2 = IsExitName("stoploss",1); condition3 = 거래시간1==1 and (stime>=시작시간1 or stime<끝시간1); if condition3==true then { If condition2 == false then {IF 매수조건 Then Buy("매수"); } Else { IF BarsSinceExit(1) >= 3 and 매수조건 Then Buy("매수진입"); } IF BarsSinceEntry > 3 and 청산조건 Then ExitLong("매도"); } SetStopTrailing(0.1,0.35,PointStop); SetStopLoss(0.10,PointStop); # 새벽2시50에 모두 청산하고자 하시면 아래 내용도 추가하시면 됩니다. if stime == 025000 or (stime > 025000 and stime[1] < 025000) Then { exitlong(); }
프로필 이미지
참새사냥꾼
2015-07-07
168
글번호 88062
시스템
답변완료

수식문의드립니다.

첨부한 그림처럼 1.1분봉에서 2.trix(12,9)지표에서 trix 12의 값 3.전일기준으로 이전 4일동안의 최고값.최저값 (예- 오늘이 10일이라면 9일,8일,7일,6일의 1분봉 trix 12의 최저값과 최고값) 4.전일의 trix 12의 최고값,최저값 부탁드립니다.
프로필 이미지
산인
2015-07-06
171
글번호 88061
지표

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

프로필 이미지
회원
2015-07-06
8
글번호 88060
지표
답변완료

문의드립니다

120이평 위에서 봉4개의 고점을 돌파시매수 봉4개의 저점을 깨면청산 120이평 아래에서 봉4개의 저점을 하향돌파시 매도 봉4개의 고점을 상향 돌파시청산 봉의기준을4개에서 10개등으로 변경가능하게 부탁드립니다 늘 예스스탁에 고맙습니다!!!!
프로필 이미지
원칙준수
2015-07-06
147
글번호 88059
시스템
답변완료

시스템 수식 수정 부탁드립니다.

아래의 수식에 대해서 몇가지 수정을 부탁드립니다. 매수와 매도는 잘 적용되는 것을 확인했습니다. 1. 기준봉이 음봉인 경우를 배제하고 양봉인 경우로만 설정 부탁드립니다. 2. 손절 규정이 적용이 안된것 같아서요. 손절 규정을 손절 1: 기준봉의 저가 -1%를 이탈시 전량매도 손절 2: 기준봉의 저가 -!%를 이탈시 보유수량의 50% 매도 이렇게 두개를 만들어주시면 제가 더 테스트를 해보고 둘중 하나를 빼도록 하겠습니다. 3. 상한가 규정이 오류가 간혹 있습니다. 6월 15일 이후 챠트에서도 15%에서 매도되는 경우가 있군요. 한번더 점검 부탁드립니다. - 아 래 - input : 기준봉날짜 (20150701); var : 하한가(0), DnLimit(0); var : dn1(0), dn2(0), dn3(0), dn4(0), dn5(0),dn6(0),dn7(0); var : 상한가(0), UpLimit(0); var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0); if date >= 19981207 then { if date < 20050328 && CodeCategory() == 2 then DnLimit = (BP * 0.12); Else if date >= 20050328 and date < 20150615 Then DnLimit = (BP * 0.15); Else DnLimit = (BP * 0.30); if CodeCategory() == 2 then { if date >= 20030721 then { dn1 = int(DnLimit/100)*100; dn2 = int(DnLimit/100)*100; dn3 = int(DnLimit/100)*100; dn4 = int(DnLimit/50)*50; dn5 = int(DnLimit/10)*10; dn6 = int(DnLimit/5)*5; dn7 = int(DnLimit/1)*1; } else { dn1 = int(DnLimit/1000)*1000; dn2 = int(DnLimit/500)*500; dn3 = int(DnLimit/100)*100; dn4 = int(DnLimit/50)*50; dn5 = int(DnLimit/10)*10; dn6 = int(DnLimit/10)*10; dn7 = int(DnLimit/1)*1; } } Else { dn1 = int(DnLimit/1000)*1000; dn2 = int(DnLimit/500)*500; dn3 = int(DnLimit/100)*100; dn4 = int(DnLimit/50)*50; dn5 = int(DnLimit/10)*10; dn6 = int(DnLimit/5)*5; dn7 = int(DnLimit/1)*1; } if CodeCategory() == 1 or CodeCategory() == 2 then { if sdate < 20101004 Then{ If BP >= 500000 Then 하한가 = BP-dn1; Else If BP >= 100000 Then 하한가 = BP-dn2; Else If BP >= 50000 Then 하한가 = BP-dn3; Else If BP >= 10000 Then 하한가 = BP-dn4; Else If BP >= 5000 Then 하한가 = BP-dn5; Else If BP >= 1000 Then 하한가 = BP-dn6; Else 하한가 = BP-dn6; } else{ If BP >= 500000 Then 하한가 = BP-dn1; Else If BP >= 100000 Then 하한가 = BP-dn2; Else If BP >= 50000 Then 하한가 = BP-dn3; Else If BP >= 10000 Then 하한가 = BP-dn4; Else If BP >= 5000 Then 하한가 = BP-dn5; Else If BP >= 1000 Then 하한가 = BP-dn6; Else 하한가 = BP-dn7; } } else if CodeCategory() == 8 or CodeCategory() == 9 then { 하한가 = BP-dn6; } } 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 sdate == 기준봉날짜 Then{ value1 = abs(DayClose-dayopen); value2 = max(DayClose,dayopen); if DayClose > DayOpen Then{ var1 = dayopen+value1*0.75; var2 = dayopen+value1*0.50; var3 = dayopen+value1*0.25; } Else{ var1 = dayopen-value1*0.75; var2 = dayopen-value1*0.50; var3 = dayopen-value1*0.25; } } if sdate > 기준봉날짜 Then{ #var1(75%)터치시 매수 if Condition1 == false and H < var1 Then Buy("매수11",AtStop,var1); if Condition1 == false and L > var1 Then Buy("매수12",Atlimit,var1); #var2(50%)터치시 매수 if Condition2 == false and H < var2 Then Buy("매수21",AtStop,var2); if Condition2 == false and L > var2 Then Buy("매수22",Atlimit,var2); #var3(25%)터치시 매수 if Condition3 == false and H < var3 Then Buy("매수31",AtStop,var3); if Condition3 == false and L > var3 Then Buy("매수32",Atlimit,var3); } if MarketPosition == 1 Then{ if LatestEntryName(0) == "매수11" or LatestEntryName(0) == "매수12" Then Condition1 = true; if LatestEntryName(0) == "매수21" or LatestEntryName(0) == "매수22" Then Condition2 = true; if LatestEntryName(0) == "매수31" or LatestEntryName(0) == "매수32" Then Condition3 = true; ExitLong("상한가매도",atlimit,상한가); if daylow(1)*0.99 > value2 Then Exitlong("매도",AtStop,daylow(1)*0.99); } Else{ Condition1 = false; Condition2 = false; Condition3 = false; }
프로필 이미지
승부사1
2015-07-06
198
글번호 88058
시스템
답변완료

부탁 드립니다.

운영자님~~! 수식작성 노고에 깊이 감사드립니다. a)10분봉 차트에서 (유로화 기준) 1)10분봉의 Bollinger Bands 2)60분봉으로계산되는 Bollinger Bands 3)120분봉으로계산되는 Bollinger Bands 4)일봉으로 계산되는 Bollinger Bands 를 10분봉 차트에서 동시에 구현 하고 싶을때의 지표식과 변수값 부탁 드립니다 미리 감사드리오며 경배 올립니다.
프로필 이미지
yes
2015-07-06
196
글번호 88057
지표