커뮤니티

분봉이나 틱에서 상단, 하단 터치 횟수가 다르게 나오는 것 해결 방법 문의

프로필 이미지
예스쟁이
2023-11-09 21:49:33
1040
글번호 173900
답변완료

첨부 이미지

항상 도움에 감사드립니다. 첨부된 이미지를 참고해서 보시면 같은 시간에 10틱, 1분봉, 5분봉에서 일정한 가격 사이틀 왔다갔다가 터치하는 횟수를 세는 수식을 작성했는데요. 10틱에서는 상단선과 하단선을 왔다갔다 터치하는 횟수가 잘 세어지는데요. 10틱에서 1분봉, 5분봉으로 갈 수록 상단과 하단의 터치 횟수가 줄어들게 됩니다. 이유는 하단(상단)을 터치했다가 상단(하단)을 터치할 때 봉이 완성되어야 터치 횟수가 카운트 되기 때문인데요. 1분봉, 5분봉이나 10분봉 이렇게 봉 시간이 다를때도 실시간의 경우에 터치횟수가 세어지는 것이 틱차트 처럼 셀 수 있게 수식 작성이 가능한가요? 아래는 제가 작성한 수식입니다. ------------------------------------------------------ var : hh(0),ll(0),t(0); var : upcnt(0),dncnt(0); var : oo(0); var : line_up(0), line_down(0), oo_line(0); var : up_text(0), down_text(0); var : tcond(False); input : ntime(203500), xtime(050000); if (sdate != sdate[1] and stime >= xtime) or (sdate == sdate[1] and stime >= xtime and stime[1] < xtime) Then Tcond = False; if (sdate != sdate[1] and stime >= ntime) or (sdate == sdate[1] and stime >= ntime and stime[1] < ntime) Then { Tcond = true; oo = 15373.50; hh = oo+PriceScale*5; ll = oo-PriceScale*5; t = 0; upcnt = 0; dncnt = 0; if H >= hh Then { T = 1; upcnt = upcnt+1; } if L <= ll Then { T = -1; dncnt = dncnt+1; } oo_line = TL_New(sDate,sTime,oo,NextBarSdate,NextBarStime,oo); // 선긋기 line_up = TL_New(sDate,sTime,hh,NextBarSdate,NextBarStime,hh); // 선긋기 line_down = TL_New(sDate,sTime,ll,NextBarSdate,NextBarStime,ll); // 선긋기 up_text = Text_New(NextBarSdate,NextBarStime,hh,NumToStr(upcnt,0)); down_text = Text_New(NextBarSdate,NextBarStime,ll,NumToStr(dncnt,0)); } if Tcond == true Then { if T <= 0 and H >= hh Then { T = 1; upcnt = upcnt+1; if upcnt >= 5 Then Buy(); } if T >= 0 and L <= LL Then { T = -1; dncnt = dncnt+1; if dncnt >= 5 Then Sell(); } TL_SetEnd(line_up,NextBarSdate,NextBarStime,hh); // 선 긋기 연장해줌 TL_SetEnd(line_down,NextBarSdate,NextBarStime,ll); // 선 긋기 연장해줌 TL_SetEnd(oo_line,NextBarSdate,NextBarStime,oo); // 선 긋기 연장해줌 Text_SetString(up_text,NumToStr(upcnt,0)); Text_SetString(down_text,NumToStr(dncnt,0)); Text_SetLocation(up_text,NextBarSdate,NextBarStime,hh); Text_SetLocation(down_text,NextBarSdate,NextBarStime,ll); Text_SetColor(down_text, Red); } MessageLog("상단, 하단______ %.2f, %.2f", upcnt, dncnt); MessageLog("%.2f, %.2f, %.2f", hh, ll, oo); ------------------------------------------------------------------ 예를들어 5분봉이 완성되기 전에 상단선과 하단선을 오르락 내리락 하면서 터치하게 될 경우 터치 횟수가 세어지는 수식을 작성할 수 있는지 궁금합니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-11-10 14:53:41

안녕하세요 예스스탁입니다. 문의하신 내용은 가능하지 않습니다. 수식은 봉완성시가 기준으로 하나의 봉을 세분화해 조건만족회수를 카운트하지 못합니다. 완성봉의 최종값만을 이용해 조건만족여부를 판단할 수 있습니다. 즐거운 하루되세요 > 예스쟁이 님이 쓴 글입니다. > 제목 : 분봉이나 틱에서 상단, 하단 터치 횟수가 다르게 나오는 것 해결 방법 문의 > 항상 도움에 감사드립니다. 첨부된 이미지를 참고해서 보시면 같은 시간에 10틱, 1분봉, 5분봉에서 일정한 가격 사이틀 왔다갔다가 터치하는 횟수를 세는 수식을 작성했는데요. 10틱에서는 상단선과 하단선을 왔다갔다 터치하는 횟수가 잘 세어지는데요. 10틱에서 1분봉, 5분봉으로 갈 수록 상단과 하단의 터치 횟수가 줄어들게 됩니다. 이유는 하단(상단)을 터치했다가 상단(하단)을 터치할 때 봉이 완성되어야 터치 횟수가 카운트 되기 때문인데요. 1분봉, 5분봉이나 10분봉 이렇게 봉 시간이 다를때도 실시간의 경우에 터치횟수가 세어지는 것이 틱차트 처럼 셀 수 있게 수식 작성이 가능한가요? 아래는 제가 작성한 수식입니다. ------------------------------------------------------ var : hh(0),ll(0),t(0); var : upcnt(0),dncnt(0); var : oo(0); var : line_up(0), line_down(0), oo_line(0); var : up_text(0), down_text(0); var : tcond(False); input : ntime(203500), xtime(050000); if (sdate != sdate[1] and stime >= xtime) or (sdate == sdate[1] and stime >= xtime and stime[1] < xtime) Then Tcond = False; if (sdate != sdate[1] and stime >= ntime) or (sdate == sdate[1] and stime >= ntime and stime[1] < ntime) Then { Tcond = true; oo = 15373.50; hh = oo+PriceScale*5; ll = oo-PriceScale*5; t = 0; upcnt = 0; dncnt = 0; if H >= hh Then { T = 1; upcnt = upcnt+1; } if L <= ll Then { T = -1; dncnt = dncnt+1; } oo_line = TL_New(sDate,sTime,oo,NextBarSdate,NextBarStime,oo); // 선긋기 line_up = TL_New(sDate,sTime,hh,NextBarSdate,NextBarStime,hh); // 선긋기 line_down = TL_New(sDate,sTime,ll,NextBarSdate,NextBarStime,ll); // 선긋기 up_text = Text_New(NextBarSdate,NextBarStime,hh,NumToStr(upcnt,0)); down_text = Text_New(NextBarSdate,NextBarStime,ll,NumToStr(dncnt,0)); } if Tcond == true Then { if T <= 0 and H >= hh Then { T = 1; upcnt = upcnt+1; if upcnt >= 5 Then Buy(); } if T >= 0 and L <= LL Then { T = -1; dncnt = dncnt+1; if dncnt >= 5 Then Sell(); } TL_SetEnd(line_up,NextBarSdate,NextBarStime,hh); // 선 긋기 연장해줌 TL_SetEnd(line_down,NextBarSdate,NextBarStime,ll); // 선 긋기 연장해줌 TL_SetEnd(oo_line,NextBarSdate,NextBarStime,oo); // 선 긋기 연장해줌 Text_SetString(up_text,NumToStr(upcnt,0)); Text_SetString(down_text,NumToStr(dncnt,0)); Text_SetLocation(up_text,NextBarSdate,NextBarStime,hh); Text_SetLocation(down_text,NextBarSdate,NextBarStime,ll); Text_SetColor(down_text, Red); } MessageLog("상단, 하단______ %.2f, %.2f", upcnt, dncnt); MessageLog("%.2f, %.2f, %.2f", hh, ll, oo); ------------------------------------------------------------------ 예를들어 5분봉이 완성되기 전에 상단선과 하단선을 오르락 내리락 하면서 터치하게 될 경우 터치 횟수가 세어지는 수식을 작성할 수 있는지 궁금합니다.