아래식 시간변수에서 ( CME 해외선물)
8시에서 0시끼지는 설정 시간변수에 맞게 설정된 시간내에서
매매가 이루어지는데
이래와 같이 0시이후 시간설정 할 때에는 1시무터 3시까지만
매매되지 않고 다른 시간대도 매매가 이루어지고 있어
검토 바랍니다.
input : 진입틱수(5);
input : StartTime1(10000),EndTime1(30000);
var : Tcond(false);
var : OO(0),HH(0),LL(0);
if (sdate != sdate[1] and stime >= EndTime1) or
(sdate == sdate[1] and stime >= EndTime1 and stime[1] < EndTime1) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if (sdate != sdate[1] and stime >= StartTime1) or
(sdate == sdate[1] and stime >= StartTime1 and stime[1] < StartTime1) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime2) or
(sdate == sdate[1] and stime >= EndTime2 and stime[1] < EndTime2) Then
{
Tcond = False;
}
if ( sdate != sdate[1] and stime >= StartTime2) or
(sdate == sdate[1] and stime >= StartTime2 and stime[1] < StartTime2) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime3) or
(sdate == sdate[1] and stime >= EndTime3 and stime[1] < EndTime3) Then
{
Tcond = False;
}
if (sdate != sdate[1] and stime >= StartTime3) or
(sdate == sdate[1] and stime >= StartTime3 and stime[1] < StartTime3) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime4) or
(sdate == sdate[1] and stime >= EndTime4 and stime[1] < EndTime4) Then
{
Tcond = False;
}
if ( sdate != sdate[1] and stime >= StartTime4) or
(sdate == sdate[1] and stime >= StartTime4 and stime[1] < StartTime4) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if Tcond == true Then
{
if L < LL Then
LL = L;
if H > HH Then
HH = H;
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*진입틱수 Then
Sell("시작매도",AtLimit,LL+PriceScale*진입틱수);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*진입틱수 Then
Buy("시작메수",AtLimit,HH-PriceScale*진입틱수);
}
답변 1
예스스탁
예스스탁 답변
2022-11-07 13:04:05
안녕하세요
예스스탁입니다.
새벽장을 확인하시기 바랍니다.
월요일의 경우 지난토요일 새벽에 장이 종료되면
월요일 새벽은 바로 7시(8시)에 시작이 됩니다.
이런경우 Tcond가 true인 조건과 false인 조건이 동시 충족하게 되는데
수식이 위에서 아래로 읽어 내려가므로 기존과 반대로 false를 하단에 배치하시면 됩니다.
input : 진입틱수(5);
input : StartTime1(10000),EndTime1(30000);
var : Tcond(false);
var : OO(0),HH(0),LL(0);
if (sdate != sdate[1] and stime >= StartTime1 ) or
(sdate == sdate[1] and stime >= StartTime1 and stime[1] < StartTime1 ) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime1) or
(sdate == sdate[1] and stime >= EndTime1 and stime[1] < EndTime1) Then
{
Tcond = False;
}
즐거운 하루되세요
> 예스요 님이 쓴 글입니다.
> 제목 : 문의 드립니다.~~~~
> 아래식 시간변수에서 ( CME 해외선물)
8시에서 0시끼지는 설정 시간변수에 맞게 설정된 시간내에서
매매가 이루어지는데
이래와 같이 0시이후 시간설정 할 때에는 1시무터 3시까지만
매매되지 않고 다른 시간대도 매매가 이루어지고 있어
검토 바랍니다.
input : 진입틱수(5);
input : StartTime1(10000),EndTime1(30000);
var : Tcond(false);
var : OO(0),HH(0),LL(0);
if (sdate != sdate[1] and stime >= EndTime1) or
(sdate == sdate[1] and stime >= EndTime1 and stime[1] < EndTime1) Then
{
Tcond = False;
if MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
if (sdate != sdate[1] and stime >= StartTime1) or
(sdate == sdate[1] and stime >= StartTime1 and stime[1] < StartTime1) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime2) or
(sdate == sdate[1] and stime >= EndTime2 and stime[1] < EndTime2) Then
{
Tcond = False;
}
if ( sdate != sdate[1] and stime >= StartTime2) or
(sdate == sdate[1] and stime >= StartTime2 and stime[1] < StartTime2) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime3) or
(sdate == sdate[1] and stime >= EndTime3 and stime[1] < EndTime3) Then
{
Tcond = False;
}
if (sdate != sdate[1] and stime >= StartTime3) or
(sdate == sdate[1] and stime >= StartTime3 and stime[1] < StartTime3) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if (sdate != sdate[1] and stime >= EndTime4) or
(sdate == sdate[1] and stime >= EndTime4 and stime[1] < EndTime4) Then
{
Tcond = False;
}
if ( sdate != sdate[1] and stime >= StartTime4) or
(sdate == sdate[1] and stime >= StartTime4 and stime[1] < StartTime4) Then
{
Tcond = true;
OO = O;
HH = H;
LL = L;
}
if Tcond == true Then
{
if L < LL Then
LL = L;
if H > HH Then
HH = H;
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*진입틱수 Then
Sell("시작매도",AtLimit,LL+PriceScale*진입틱수);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*진입틱수 Then
Buy("시작메수",AtLimit,HH-PriceScale*진입틱수);
}