수고하십니다~
아래와 같이 시간설정을 하였는데
질문1 다른 시간데는 정상적으로 돌아가는데
input : StartTime3(003000),EndTime3(010000);
에서는 0시 30분 부터가 아니고 00시 부터 시작됩니다.
왜 그런지요?
질문2 1분봉 차트에서는 전체시간이 돌아가는데
틱봉에서는
input : StartTime1(183000),EndTime1(193000); 부분만 돌아가고
다른 시간대는 실행되지 않는데 틱봉에서도 설정된 전체시간이
실행되게 하려면 어떻게 해야 하나요?
input : StartTime1(183000),EndTime1(193000);
input : StartTime2(220000),EndTime2(223000);
input : StartTime3(003000),EndTime3(010000);
input : StartTime4(010000),EndTime4(013000);
input : ntime(100000),n(10);
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 (sdate != sdate[1] and stime >= StartTime1) or
(sdate == sdate[1] and stime >= StartTime1 and stime[1] < StartTime1) Then
{
Tcond = true;
SetStopEndofday(EndTime1);
}
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;
SetStopEndofday(EndTime2);
}
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;
SetStopEndofday(EndTime3);
}
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;
SetStopEndofday(EndTime4);
}
Tcond = true;
OO = O;
HH = H;
LL = L;
if Tcond == true Then
{
if TotalTrades > TotalTrades[1] Then
{
OO = O;
HH = H;
LL = L;
}
if HH > 0 and H > HH Then
HH = H;
if LL > 0 and L < LL Then
LL = L;
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*n Then
Sell("s",AtLimit,LL+PriceScale*n);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*n Then
Buy("b",AtLimit,HH-PriceScale*n);
답변 2
예스스탁
예스스탁 답변
2021-10-26 16:10:20
안녕하세요
예스스탁입니다.
1
Tcond = true;
OO = O;
HH = H;
LL = L;
수식 중간에 위와 같이 어떤 조건도 없이 매봉 값이 저장되는 내용이 있습니다.
Tcond는 지정한 시작시간에 true가 되고 지정한 종료시간에 false가 되어야 하는데
매봉 true가 되고 있습니다. OO,HH,LL도 같습니다.
아마 지정한 시간시간이 되거나 청산이 발생하면
시가, 최고가,최저가를 계산하고자 하는 내용으로 판단하여
식을 수정해 드립니다.
2
당일청산 함수는 지정한시간 이후의 진입을 막게 됩니다.
하루의 시간을 여러구간으로 구분하고 청산할때는 해당 함수를 사용하시면 안됩니다.
아래와 같이 각 종료시간 봉완성시에 청산하게 구현하셔야 합니다.
3
input : StartTime1(183000),EndTime1(193000);
input : StartTime2(220000),EndTime2(223000);
input : StartTime3(003000),EndTime3(010000);
input : StartTime4(010000),EndTime4(013000);
input : ntime(100000),n(10);
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 MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
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 MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
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 MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
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 Index == 0 or TotalTrades > TotalTrades[1] Then
{
OO = O;
HH = H;
LL = L;
}
if HH > 0 and H > HH Then
HH = H;
if LL > 0 and L < LL Then
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*n Then
Sell("s",AtLimit,LL+PriceScale*n);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*n Then
Buy("b",AtLimit,HH-PriceScale*n);
}
즐거운 하루되세요
> 예스요 님이 쓴 글입니다.
> 제목 : 문의 드립니다.~
> 수고하십니다~
아래와 같이 시간설정을 하였는데
질문1 다른 시간데는 정상적으로 돌아가는데
input : StartTime3(003000),EndTime3(010000);
에서는 0시 30분 부터가 아니고 00시 부터 시작됩니다.
왜 그런지요?
질문2 1분봉 차트에서는 전체시간이 돌아가는데
틱봉에서는
input : StartTime1(183000),EndTime1(193000); 부분만 돌아가고
다른 시간대는 실행되지 않는데 틱봉에서도 설정된 전체시간이
실행되게 하려면 어떻게 해야 하나요?
input : StartTime1(183000),EndTime1(193000);
input : StartTime2(220000),EndTime2(223000);
input : StartTime3(003000),EndTime3(010000);
input : StartTime4(010000),EndTime4(013000);
input : ntime(100000),n(10);
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 (sdate != sdate[1] and stime >= StartTime1) or
(sdate == sdate[1] and stime >= StartTime1 and stime[1] < StartTime1) Then
{
Tcond = true;
SetStopEndofday(EndTime1);
}
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;
SetStopEndofday(EndTime2);
}
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;
SetStopEndofday(EndTime3);
}
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;
SetStopEndofday(EndTime4);
}
Tcond = true;
OO = O;
HH = H;
LL = L;
if Tcond == true Then
{
if TotalTrades > TotalTrades[1] Then
{
OO = O;
HH = H;
LL = L;
}
if HH > 0 and H > HH Then
HH = H;
if LL > 0 and L < LL Then
LL = L;
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*n Then
Sell("s",AtLimit,LL+PriceScale*n);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*n Then
Buy("b",AtLimit,HH-PriceScale*n);
록시
input : ntime(100000)의 의미는 무엇인가요?
> 예스스탁 님이 쓴 글입니다.
> 제목 : Re : 문의 드립니다.~
>
안녕하세요
예스스탁입니다.
1
Tcond = true;
OO = O;
HH = H;
LL = L;
수식 중간에 위와 같이 어떤 조건도 없이 매봉 값이 저장되는 내용이 있습니다.
Tcond는 지정한 시작시간에 true가 되고 지정한 종료시간에 false가 되어야 하는데
매봉 true가 되고 있습니다. OO,HH,LL도 같습니다.
아마 지정한 시간시간이 되거나 청산이 발생하면
시가, 최고가,최저가를 계산하고자 하는 내용으로 판단하여
식을 수정해 드립니다.
2
당일청산 함수는 지정한시간 이후의 진입을 막게 됩니다.
하루의 시간을 여러구간으로 구분하고 청산할때는 해당 함수를 사용하시면 안됩니다.
아래와 같이 각 종료시간 봉완성시에 청산하게 구현하셔야 합니다.
3
input : StartTime1(183000),EndTime1(193000);
input : StartTime2(220000),EndTime2(223000);
input : StartTime3(003000),EndTime3(010000);
input : StartTime4(010000),EndTime4(013000);
input : ntime(100000),n(10);
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 MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
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 MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
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 MarketPosition == 1 Then
ExitLong();
if MarketPosition == -1 Then
ExitShort();
}
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 Index == 0 or TotalTrades > TotalTrades[1] Then
{
OO = O;
HH = H;
LL = L;
}
if HH > 0 and H > HH Then
HH = H;
if LL > 0 and L < LL Then
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*n Then
Sell("s",AtLimit,LL+PriceScale*n);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*n Then
Buy("b",AtLimit,HH-PriceScale*n);
}
즐거운 하루되세요
> 예스요 님이 쓴 글입니다.
> 제목 : 문의 드립니다.~
> 수고하십니다~
아래와 같이 시간설정을 하였는데
질문1 다른 시간데는 정상적으로 돌아가는데
input : StartTime3(003000),EndTime3(010000);
에서는 0시 30분 부터가 아니고 00시 부터 시작됩니다.
왜 그런지요?
질문2 1분봉 차트에서는 전체시간이 돌아가는데
틱봉에서는
input : StartTime1(183000),EndTime1(193000); 부분만 돌아가고
다른 시간대는 실행되지 않는데 틱봉에서도 설정된 전체시간이
실행되게 하려면 어떻게 해야 하나요?
input : StartTime1(183000),EndTime1(193000);
input : StartTime2(220000),EndTime2(223000);
input : StartTime3(003000),EndTime3(010000);
input : StartTime4(010000),EndTime4(013000);
input : ntime(100000),n(10);
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 (sdate != sdate[1] and stime >= StartTime1) or
(sdate == sdate[1] and stime >= StartTime1 and stime[1] < StartTime1) Then
{
Tcond = true;
SetStopEndofday(EndTime1);
}
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;
SetStopEndofday(EndTime2);
}
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;
SetStopEndofday(EndTime3);
}
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;
SetStopEndofday(EndTime4);
}
Tcond = true;
OO = O;
HH = H;
LL = L;
if Tcond == true Then
{
if TotalTrades > TotalTrades[1] Then
{
OO = O;
HH = H;
LL = L;
}
if HH > 0 and H > HH Then
HH = H;
if LL > 0 and L < LL Then
LL = L;
if MarketPosition == 0 and OO > 0 and LL > OO-PriceScale*n Then
Sell("s",AtLimit,LL+PriceScale*n);
if MarketPosition == 0 and OO > 0 and HH < OO+PriceScale*n Then
Buy("b",AtLimit,HH-PriceScale*n);