커뮤니티
수식 요청드립니다.
2026-06-26 23:33:11
33
글번호 232587
안녕하세요.
나스닥 선물 거래하고자 합니다.
거래시간을
1. 16시 ~ 22시20분(22시20분에 진입된 계약이 있다면 모두 청산합니다.)
2. 22시30분 ~ 익일 오전 5시(오전 5시에 진입된 계약이 있다면 모두 청산합니다.)
이렇게 두 파트로 설정하고자 합니다.
AI로도 수식을 만들어 보았으나 22시 20분 청산 이후 22시 30분에 재진입을 하지 않는 문제가 발생하였는데, 수정이 되지 않습니다.
수식 도움 부탁드립니다.
감사합니다.
답변 1
예스스탁 예스스탁 답변
2026-06-29 13:28:52
안녕하세요
예스스탁입니다.
아래식 참고하시기 바랍니다.
input : starttime1(160000),Endtime1(222000);
input : starttime2(223000),Endtime2(050000);
var : Tcond(False);
if (sdate != sDate[1] and sTime >= starttime1) or
(sdate == sDate[1] and sTime >= starttime1 and sTime[1] < starttime1) Then
{
Tcond = true;
}
if (NextBarSdate != sDate and NextBarStime >= Endtime1) or
(NextBarSdate == sDate and NextBarStime >= Endtime1 and sTime < Endtime1) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong("bx1",AtMarket);
if MarketPosition == -1 Then
ExitShort("sx1",AtMarket);
}
if (sdate != sDate[1] and sTime >= starttime2) or
(sdate == sDate[1] and sTime >= starttime2 and sTime[1] < starttime2) Then
{
Tcond = true;
}
if (NextBarSdate != sDate and NextBarStime >= Endtime2) or
(NextBarSdate == sDate and NextBarStime >= Endtime2 and sTime < Endtime2) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong("bx2",AtMarket);
if MarketPosition == -1 Then
ExitShort("sx2",AtMarket);
}
if tcond == true Then
{
//진입청산 수식
//아래는 예시로 이평 돌파 진입입니다.
if CrossUp(C,ma(C,5)) Then
Buy();
if CrossDown(C,ma(C,5)) Then
Sell();
}
즐거운 하루되세요