커뮤니티

수식수정부탁드립니다

프로필 이미지
수색대대
2020-04-27 13:56:58
899
글번호 138363
답변완료
input :N1(1),카운팅시작일자(20200417), 카운팅시작시간(070000); input : n(13),x(8); var : Tcond(false),T(0),상승량(0), 하락량(0), 이평선(0), 상승(0), 하락(0),cnt(0); Array : V1[10](0),V2[10](0); var : idx(0),hh(0),ll(0),dd(0),tt(0); var : tl1(0),tl2(0),tl3(0),tl4(0); if sdate >= 카운팅시작일자 and stime >= 카운팅시작시간 Then Tcond = true; if Tcond == true Then { if (sdate != sdate[1] and stime >= 카운팅시작시간) or (sdate == sdate[1] and stime >= 카운팅시작시간 and stime[1] < 카운팅시작시간) Then { var1 = 0; var2 = 0; 상승량 = 0; 하락량 = 0; } Condition1 = 상승량+V >상승량+V[1]; for cnt = 0 to N1-1{ IF O[cnt] < C[cnt] Then { IF H[cnt]-C[cnt] >=0.15 AND H[cnt]-C[cnt] > Abs(O[cnt]-C[cnt]) AND H[cnt]-C[cnt] >= O[cnt]-L[cnt] Then 하락량 = V[cnt]; ELse 상승량 = V[cnt]; } ELse IF O[cnt] > C[cnt] Then { IF C[cnt]-L[cnt] >=0.15 AND C[cnt]-L[cnt] > Abs(O[cnt]-C[cnt]) AND C[cnt]-L[cnt] >= H[cnt]-O[cnt] Then 상승량 = V[cnt]; ELse 하락량 = V[cnt]; } ELse { IF H[cnt]-C[cnt] < C[cnt]-L[cnt] Then 상승량 = V[cnt]; ELse IF H[cnt]-C[cnt] > C[cnt]-L[cnt] Then 하락량 = V[cnt]; ELse{ 하락량 = V[cnt]; 상승량 = V[cnt]; } } if dayindex >= 0 Then{ if C > O or (C == O and C >= C[1]) Then value1 =상승량; Else value1 = 하락량; value13=상승량-하락량; if value13 > value13[1] Then T = 1; if value13 < value13[1] Then T = -1; var21 = highest(H,n); var22 = lowest(L,n); Condition21 = C <= var21[1] and C >= var22[1]; if Condition21 == true and Condition21[1] == false Then { idx = 0; hh = c; ll = c; dd = sdate; tt = stime; } if Condition21 == true Then { idx = idx+1; if c > hh Then hh = c; if c < ll Then ll = c; if idx == x Then { tl1 = TL_New(dd,tt,hh,dd,tt,ll); tl2 = TL_New(dd,tt,hh,sdate,stime,hh); tl3 = TL_New(dd,tt,ll,sdate,stime,ll); tl4 = TL_New(sdate,stime,hh,sdate,stime,ll); } if idx > x Then { TL_SetBegin(tl1,dd,tt,hh); TL_SetEnd(tl1,dd,tt,ll); TL_SetBegin(tl2,dd,tt,hh); TL_SetEnd(tl2,sdate,stime,hh); TL_SetBegin(tl3,dd,tt,ll); TL_SetEnd(tl3,sdate,stime,ll); TL_SetBegin(tl4,sdate,stime,hh); TL_SetEnd(tl4,sdate,stime,ll); value21 = HH; value22 = LL; } } If hh <= C Then { TL_SetColor(TL1,WHITE); TL_SetColor(TL2,WHITE); TL_SetColor(TL3,WHITE); TL_SetColor(TL4,WHITE); } Else { TL_SetColor(TL1,WHITE); TL_SetColor(TL2,WHITE); TL_SetColor(TL3,WHITE); TL_SetColor(TL4,WHITE); } TL_SetSize(TL1,0); //좌측세로선 굵기 TL_SetSize(TL2,1); //상단가로선 굵기 TL_SetSize(TL3,1); //하측가로선 굵기 TL_SetSize(TL4,0); //우측세로선 굵기 TL_SetStyle(TL1,3); //좌측세로선 점선 TL_SetStyle(TL4,3); //우측세로선 점선 if Condition1[1]==true and T == 1 and Condition1[1]==True and crossup(value13,0) or crossup(C,value21) Then buy(); if Condition1[1]==true and T == -1and Condition1[1]==True and crossdown(value13,0)or CrossDown(C,value22) Then sell(); }}} 상기 수식을 실행하니 buy,sell 조건에 상이하게 표현됩니다 수식검토 부탁드립니다
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-04-27 18:53:11

안녕하세요 예스스탁입니다. 올려주신 내용만으로는 어느 부분을 수정해 드려야 할지 알수 없습니다 만약 진입조건이 의도와 맞지 않으시면 if문에 and와 or로 조건이 조합되어 있는데 조건의 조합이 잘못된것일것 같습니다. A조건이 만족하고 B조거나 C조건 중 하나이상 만족할떄 신호이면 A조건 and (B조건 or C조건) 으로 문장이 작성되어야 합니다. if Condition1[1]==true and T == 1 and Condition1[1]==True and crossup(value13,0) or crossup(C,value21) Then buy(); if Condition1[1]==true and T == -1and Condition1[1]==True and crossdown(value13,0)or CrossDown(C,value22) Then sell(); 작성하신 식에서는 or를 기준으로 ( )괄호가 없습니다. 아래와 같이 변경해 보시기 바랍니다 if Condition1[1]==true and T == 1 and Condition1[1]==True and (crossup(value13,0) or crossup(C,value21)) Then buy(); if Condition1[1]==true and T == -1and Condition1[1]==True and (crossdown(value13,0)or CrossDown(C,value22)) Then sell(); 즐거운 하루되세요 > 수색대대 님이 쓴 글입니다. > 제목 : 수식수정부탁드립니다 > input :N1(1),카운팅시작일자(20200417), 카운팅시작시간(070000); input : n(13),x(8); var : Tcond(false),T(0),상승량(0), 하락량(0), 이평선(0), 상승(0), 하락(0),cnt(0); Array : V1[10](0),V2[10](0); var : idx(0),hh(0),ll(0),dd(0),tt(0); var : tl1(0),tl2(0),tl3(0),tl4(0); if sdate >= 카운팅시작일자 and stime >= 카운팅시작시간 Then Tcond = true; if Tcond == true Then { if (sdate != sdate[1] and stime >= 카운팅시작시간) or (sdate == sdate[1] and stime >= 카운팅시작시간 and stime[1] < 카운팅시작시간) Then { var1 = 0; var2 = 0; 상승량 = 0; 하락량 = 0; } Condition1 = 상승량+V >상승량+V[1]; for cnt = 0 to N1-1{ IF O[cnt] < C[cnt] Then { IF H[cnt]-C[cnt] >=0.15 AND H[cnt]-C[cnt] > Abs(O[cnt]-C[cnt]) AND H[cnt]-C[cnt] >= O[cnt]-L[cnt] Then 하락량 = V[cnt]; ELse 상승량 = V[cnt]; } ELse IF O[cnt] > C[cnt] Then { IF C[cnt]-L[cnt] >=0.15 AND C[cnt]-L[cnt] > Abs(O[cnt]-C[cnt]) AND C[cnt]-L[cnt] >= H[cnt]-O[cnt] Then 상승량 = V[cnt]; ELse 하락량 = V[cnt]; } ELse { IF H[cnt]-C[cnt] < C[cnt]-L[cnt] Then 상승량 = V[cnt]; ELse IF H[cnt]-C[cnt] > C[cnt]-L[cnt] Then 하락량 = V[cnt]; ELse{ 하락량 = V[cnt]; 상승량 = V[cnt]; } } if dayindex >= 0 Then{ if C > O or (C == O and C >= C[1]) Then value1 =상승량; Else value1 = 하락량; value13=상승량-하락량; if value13 > value13[1] Then T = 1; if value13 < value13[1] Then T = -1; var21 = highest(H,n); var22 = lowest(L,n); Condition21 = C <= var21[1] and C >= var22[1]; if Condition21 == true and Condition21[1] == false Then { idx = 0; hh = c; ll = c; dd = sdate; tt = stime; } if Condition21 == true Then { idx = idx+1; if c > hh Then hh = c; if c < ll Then ll = c; if idx == x Then { tl1 = TL_New(dd,tt,hh,dd,tt,ll); tl2 = TL_New(dd,tt,hh,sdate,stime,hh); tl3 = TL_New(dd,tt,ll,sdate,stime,ll); tl4 = TL_New(sdate,stime,hh,sdate,stime,ll); } if idx > x Then { TL_SetBegin(tl1,dd,tt,hh); TL_SetEnd(tl1,dd,tt,ll); TL_SetBegin(tl2,dd,tt,hh); TL_SetEnd(tl2,sdate,stime,hh); TL_SetBegin(tl3,dd,tt,ll); TL_SetEnd(tl3,sdate,stime,ll); TL_SetBegin(tl4,sdate,stime,hh); TL_SetEnd(tl4,sdate,stime,ll); value21 = HH; value22 = LL; } } If hh <= C Then { TL_SetColor(TL1,WHITE); TL_SetColor(TL2,WHITE); TL_SetColor(TL3,WHITE); TL_SetColor(TL4,WHITE); } Else { TL_SetColor(TL1,WHITE); TL_SetColor(TL2,WHITE); TL_SetColor(TL3,WHITE); TL_SetColor(TL4,WHITE); } TL_SetSize(TL1,0); //좌측세로선 굵기 TL_SetSize(TL2,1); //상단가로선 굵기 TL_SetSize(TL3,1); //하측가로선 굵기 TL_SetSize(TL4,0); //우측세로선 굵기 TL_SetStyle(TL1,3); //좌측세로선 점선 TL_SetStyle(TL4,3); //우측세로선 점선 if Condition1[1]==true and T == 1 and Condition1[1]==True and crossup(value13,0) or crossup(C,value21) Then buy(); if Condition1[1]==true and T == -1and Condition1[1]==True and crossdown(value13,0)or CrossDown(C,value22) Then sell(); }}} 상기 수식을 실행하니 buy,sell 조건에 상이하게 표현됩니다 수식검토 부탁드립니다