커뮤니티

수식 바로 잡아 주세요.

프로필 이미지
고가행진
2022-12-02 12:41:29
855
글번호 164310
답변완료
수고하십니다. 거래시간을 두구간으로 나누어 거래하려고 아래와 같이 작성하였는데 첫구간은 적용 안되고 두번째 구간만 거래되고 있습니다. 두구간(시작시간~종료시간, 시작시간2~종료시간2) 모두 거래될수 있도록 정정 부탁드립니다. input : 시작시간(080700); input : 종료시간(120000); input : 시작시간2(210700); input : 종료시간2(050000); if (stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간)) or (stime == 시작시간2 or (stime > 시작시간2 and stime[1] < 시작시간2)) Then{ Tcond = true; } if (stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간)) or (stime == 종료시간2 or (stime > 종료시간2 and stime[1] < 종료시간2)) Then{ Tcond = false; if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } if Tcond == true then { 진입청산로직 }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-12-02 14:12:36

안녕하세요 예스스탁입니다. input : 시작시간(080700); input : 종료시간(120000); input : 시작시간2(210700); input : 종료시간2(050000); var : Tcond(False); if (sdate != sdate[1] and stime >= 시작시간) or (sdate == sdate[1] and stime >= 시작시간 and stime[1] < 시작시간) Then { Tcond = true; } if (sdate != sdate[1] and stime >= 시작시간2) or (sdate == sdate[1] and stime >= 시작시간2 and stime[1] < 시작시간2) Then { Tcond = true; } if (sdate != sdate[1] and stime >= 종료시간) or (sdate == sdate[1] and stime >= 종료시간 and stime[1] < 종료시간) Then { Tcond = false; if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } if (sdate != sdate[1] and stime >= 종료시간2) or (sdate == sdate[1] and stime >= 종료시간2 and stime[1] < 종료시간2) Then { Tcond = false; if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } if Tcond == true then { 진입청산로직 } 즐거운 하루되세요 > 고가행진 님이 쓴 글입니다. > 제목 : 수식 바로 잡아 주세요. > 수고하십니다. 거래시간을 두구간으로 나누어 거래하려고 아래와 같이 작성하였는데 첫구간은 적용 안되고 두번째 구간만 거래되고 있습니다. 두구간(시작시간~종료시간, 시작시간2~종료시간2) 모두 거래될수 있도록 정정 부탁드립니다. input : 시작시간(080700); input : 종료시간(120000); input : 시작시간2(210700); input : 종료시간2(050000); if (stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간)) or (stime == 시작시간2 or (stime > 시작시간2 and stime[1] < 시작시간2)) Then{ Tcond = true; } if (stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간)) or (stime == 종료시간2 or (stime > 종료시간2 and stime[1] < 종료시간2)) Then{ Tcond = false; if MarketPosition == 1 Then ExitLong(); if MarketPosition == -1 Then ExitShort(); } if Tcond == true then { 진입청산로직 }