커뮤니티

37215 재 질문

프로필 이미지
회원
2014-07-21 19:56:24
172
글번호 76952
답변완료
우선 빠른 답변 감사 합니다. 37215번 질문에 대한 답변으로 수식을 적용 했는데 결과가 이상하게 나옵니다.뭐가 문제인지 통 모르겠습니다. 제가 적용해본 식은 if dayopen<=dayclose(1)*0.85 and dayopen>dayclose(1)*0.7 then if c<var3 then exitlong("bx1"); else if dayopen>=dayclose(1)*1.15 and dayopen<dayclose(1)*1.3 then if c<var4 then exitlong("bx2); Else if c<var5 then exitlong("bx3"); if stime==150000 then exitlong("enda,b"); 이렇게 중간에 수정해서 바꿨는데 결과는 엉뚱 합니다. 질문 내용은 1.당일 시가가 -15~-30% 갭하락dlf 경우 var3 2.당일 시가가 15~30% 갭상승일 경우 var4 3. 위 1,2 조건이 아닐경우 var5 이렇게 3가지 청산 조건인데 여기서 var3 대신 c<var3으로 var4 대신 c<var4 그리고 var5 대신 c<var5 이렇게 수정해서 다시 부탁 드립니다. 현재 사용중인식 입니다. if marketposition==1 then{ if codecategoryex==11 and baseprice<50000 then xvol = int (int((maxcontracts*1.0)/10)*10); else xvol = int(maxcontracts*1.0); if (isentryname("a")== true or isentryname("b") == true) then{ if c<var3 then exitlong("bx1"); if stime == 150000 then exitlong("enda,b");
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2014-07-22 08:40:40

안녕하세요 예스스탁입니다. 수식에 if문이 중첩될 경우 {}로 if문의 범위를 지정해 주셔야 합니다. 작성한 식은 else문이 갭상승과 갭하락에이 아닌 C < var3등에 반대문을 뜻하게 됩니다. if dayopen<=dayclose(1)*0.85 and dayopen>dayclose(1)*0.7 then{ if c<var3 then exitlong("bx1"); } else if dayopen>=dayclose(1)*1.15 and dayopen<dayclose(1)*1.3 then{ if c<var4 then exitlong("bx2"); } Else{ if c<var5 then exitlong("bx3"); } if stime==150000 then exitlong("enda,b"); 위 청산이 진입명 a나 b일때만 동작하게 하시려면 아래와 같이 작성하시면 됩니다. var : Xvol(0); if marketposition==1 then{ if codecategoryex==11 and baseprice<50000 then xvol = int (int((maxcontracts*1.0)/10)*10); else xvol = int(maxcontracts*1.0); if (isentryname("a")== true or isentryname("b") == true) then{ if dayopen<=dayclose(1)*0.85 and dayopen>dayclose(1)*0.7 then{ if c<var3 then exitlong("bx1"); } else if dayopen>=dayclose(1)*1.15 and dayopen<dayclose(1)*1.3 then{ if c<var4 then exitlong("bx2"); } Else{ if c<var5 then exitlong("bx3"); } } } if stime==150000 then exitlong("enda,b"); 즐거운 하루되세요 > WT_yu**** 님이 쓴 글입니다. > 제목 : 37215 재 질문 > 우선 빠른 답변 감사 합니다. 37215번 질문에 대한 답변으로 수식을 적용 했는데 결과가 이상하게 나옵니다.뭐가 문제인지 통 모르겠습니다. 제가 적용해본 식은 if dayopen<=dayclose(1)*0.85 and dayopen>dayclose(1)*0.7 then if c<var3 then exitlong("bx1"); else if dayopen>=dayclose(1)*1.15 and dayopen<dayclose(1)*1.3 then if c<var4 then exitlong("bx2); Else if c<var5 then exitlong("bx3"); if stime==150000 then exitlong("enda,b"); 이렇게 중간에 수정해서 바꿨는데 결과는 엉뚱 합니다. 질문 내용은 1.당일 시가가 -15~-30% 갭하락dlf 경우 var3 2.당일 시가가 15~30% 갭상승일 경우 var4 3. 위 1,2 조건이 아닐경우 var5 이렇게 3가지 청산 조건인데 여기서 var3 대신 c<var3으로 var4 대신 c<var4 그리고 var5 대신 c<var5 이렇게 수정해서 다시 부탁 드립니다. 현재 사용중인식 입니다. if marketposition==1 then{ if codecategoryex==11 and baseprice<50000 then xvol = int (int((maxcontracts*1.0)/10)*10); else xvol = int(maxcontracts*1.0); if (isentryname("a")== true or isentryname("b") == true) then{ if c<var3 then exitlong("bx1"); if stime == 150000 then exitlong("enda,b");