커뮤니티

야간거래할 수 있도록 시간 수식 수정

프로필 이미지
목마와숙녀
2026-08-19 05:25:45
51
글번호 233300
답변완료

아래 수식은 주간거래용 입니다.

야간거래에 사용할 수 있도록 시간 수식을 수정하여 주십시요.


항상 고맙습니다.


******************************************************************************************************************************


// [입력 변수 선언]

input : n(1);

input : 시작(182200), 끝(182600);

input : 시간18(180000);

input : 시간22(220000);

input : 시간02(020000);

input : 시간04(040000);

input : 시간06(060000);

input : dn강제손절(2.7), dn강제추적(8.2),익절(10.4);

input : eod(055500);


// [내부 변수 선언]

var : entry(0, Data2);

var : tickSpeed(0, Data2); // 체결건수 저장 변수


// [1. Data2 분당 체결건수(속도) 산출]

tickSpeed = Data2(Ticks);


// [2. 당일 진입 횟수 관리]

if Data2(bdate) != Data2(bdate[1]) Then

entry = 0;


if MarketPosition(0) != 0 and MarketPosition(0) != MarketPosition(0)[1] Then

entry = entry + 1;


// [3. Data2 기반 매도 진입 조건]

// 시작~끝 사이, 체결건수 증가(tickSpeed > tickSpeed[1]), 음봉(C < O) 시 진입

if entry < n then

{

if Data2(stime) >= 시작 and Data2(stime) < 끝 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then

{

Sell("s");

}

}




if MarketPosition == -1 Then

{

if Data2(stime) >= 시간18 and Data2(stime) < 시간22 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then

{

ExitShort("x1822");

}

}




if MarketPosition == -1 Then

{

if Data2(stime) >= 시간22 and Data2(stime) < 시간02 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then

{

ExitLong("x2202");

}

}



if MarketPosition == -1 Then

{

if Data2(stime) >= 시간02 and Data2(stime) < 시간04 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then

{

ExitShort("x0204");

}

}



if MarketPosition == -1 Then

{

if Data2(stime) >= 시간04 and Data2(stime) < 시간06 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then

{

ExitShort("x0406");

}

}




// [4. 청산 및 손절 설정]

if MarketPosition == -1 Then

{

SetStopLoss(dn강제손절, pointstop);

SetStopTrailing(dn강제추적, 0, pointstop);

SetStopProfittarget(익절,PointStop);

SetStopEndofday(eod);

}

시스템
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2026-08-19 12:43:18

안녕하세요 예스스탁입니다. // [입력 변수 선언] input : n(1); input : 시작(182200), 끝(182600); input : 시간1(180000); input : 시간2(220000); input : 시간3(020000); input : 시간4(040000); input : 시간5(060000); input : dn강제손절(2.7), dn강제추적(8.2),익절(10.4); input : eod(055500); // [내부 변수 선언] var : entry(0, Data2); var : tickSpeed(0, Data2); // 체결건수 저장 변수 var : Tcond(False),T(0); // [1. Data2 분당 체결건수(속도) 산출] tickSpeed = Data2(Ticks); // [2. 당일 진입 횟수 관리] if Data2(bdate) != Data2(bdate[1]) Then entry = 0; if MarketPosition(0) != 0 and MarketPosition(0) != MarketPosition(0)[1] Then entry = entry + 1; if Data2((sDate != sDate[1] and sTime >= 시작) or (sDate == sDate[1] and sTime >= 시작 and sTime[1] <시작)) Then { Tcond = true; T = 0; } if Data2((sDate != sDate[1] and sTime >= 끝) or (sDate == sDate[1] and sTime >= 끝 and sTime[1] < 끝)) Then Tcond = False; if data3((sDate != sDate[1] and sTime >= 시간1) or (sDate == sDate[1] and sTime >= 시간1 and sTime[1] < 시간1)) Then T = 1; if data4((sDate != sDate[1] and sTime >= 시간2) or (sDate == sDate[1] and sTime >= 시간2 and sTime[1] < 시간2)) Then T = 2; if Data2((sDate != sDate[1] and sTime >= 시간3) or (sDate == sDate[1] and sTime >= 시간3 and sTime[1] < 시간3)) Then T = 3; if Data2((sDate != sDate[1] and sTime >= 시간4) or (sDate == sDate[1] and sTime >= 시간4 and sTime[1] < 시간4)) Then T = 4; if Data2((sDate != sDate[1] and sTime >= 시간5) or (sDate == sDate[1] and sTime >= 시간5 and sTime[1] < 시간5)) Then T = -1; // [3. Data2 기반 매도 진입 조건] // 시작~끝 사이, 체결건수 증가(tickSpeed > tickSpeed[1]), 음봉(C < O) 시 진입 if entry < n then { if Tcond == true and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then { Sell("s"); } } if MarketPosition == -1 Then { if T == 1 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then { ExitShort("x1822"); } } if MarketPosition == -1 Then { if T == 2 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then { ExitLong("x2202"); } } if MarketPosition == -1 Then { if T == 3 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then { ExitShort("x0204"); } } if MarketPosition == -1 Then { if T == 4 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then { ExitShort("x0406"); } } // [4. 청산 및 손절 설정] if MarketPosition == -1 Then { SetStopLoss(dn강제손절, pointstop); SetStopTrailing(dn강제추적, 0, pointstop); SetStopProfittarget(익절,PointStop); SetStopEndofday(eod); } 즐거운 하루되세요
프로필 이미지

예스스탁 예스스탁 답변

2026-08-20 15:34:46

안녕하세요 예스스탁입니다. 당일청산을 수정했습니다. // [입력 변수 선언] input : n(1); input : 시작(182200), 끝(182600); input : 시간1(180000); input : 시간2(220000); input : 시간3(020000); input : 시간4(040000); input : 시간5(060000); input : dn강제손절(2.7), dn강제추적(8.2),익절(10.4); input : eod(055500); // [내부 변수 선언] var : entry(0, Data2); var : tickSpeed(0, Data2); // 체결건수 저장 변수 var : Tcond(False),T(0); // [1. Data2 분당 체결건수(속도) 산출] tickSpeed = Data2(Ticks); // [2. 당일 진입 횟수 관리] if Data2(bdate) != Data2(bdate[1]) Then entry = 0; if MarketPosition(0) != 0 and MarketPosition(0) != MarketPosition(0)[1] Then entry = entry + 1; IF eod > 시작 Then SetStopEndofday(eod); Else { if sDate != sDate[1] Then SetStopEndofday(eod); } if Data2((sDate != sDate[1] and sTime >= 시작) or (sDate == sDate[1] and sTime >= 시작 and sTime[1] <시작)) Then { Tcond = true; T = 0; IF eod <= 시작 Then { SetStopEndofday(0); } } if Data2((sDate != sDate[1] and sTime >= 끝) or (sDate == sDate[1] and sTime >= 끝 and sTime[1] < 끝)) Then Tcond = False; if data3((sDate != sDate[1] and sTime >= 시간1) or (sDate == sDate[1] and sTime >= 시간1 and sTime[1] < 시간1)) Then T = 1; if data4((sDate != sDate[1] and sTime >= 시간2) or (sDate == sDate[1] and sTime >= 시간2 and sTime[1] < 시간2)) Then T = 2; if Data2((sDate != sDate[1] and sTime >= 시간3) or (sDate == sDate[1] and sTime >= 시간3 and sTime[1] < 시간3)) Then T = 3; if Data2((sDate != sDate[1] and sTime >= 시간4) or (sDate == sDate[1] and sTime >= 시간4 and sTime[1] < 시간4)) Then T = 4; if Data2((sDate != sDate[1] and sTime >= 시간5) or (sDate == sDate[1] and sTime >= 시간5 and sTime[1] < 시간5)) Then T = -1; // [3. Data2 기반 매도 진입 조건] // 시작~끝 사이, 체결건수 증가(tickSpeed > tickSpeed[1]), 음봉(C < O) 시 진입 if entry < n then { if Tcond == true and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then { Sell("s"); } } if MarketPosition == -1 Then { if T == 1 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then { ExitShort("x1822"); } } if MarketPosition == -1 Then { if T == 2 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then { ExitLong("x2202"); } } if MarketPosition == -1 Then { if T == 3 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then { ExitShort("x0204"); } } if MarketPosition == -1 Then { if T == 4 and tickSpeed > tickSpeed[1] and Data2(C) < Data2(O) Then { ExitShort("x0406"); } } // [4. 청산 및 손절 설정] if MarketPosition == -1 Then { SetStopLoss(dn강제손절, pointstop); SetStopTrailing(dn강제추적, 0, pointstop); SetStopProfittarget(익절,PointStop); } 즐거운 하루되세요