커뮤니티
함수요청
2019-10-17 12:57:38
148
글번호 132860
안녕하세요?
전략이 A, B 이렇게 2개가 있습니다.
한종목으로
9시부터 17시까지는 A전략을
19시부터 익일 3시까지는 B전략을
적용하고 싶습니다.
답변 1
예스스탁 예스스탁 답변
2019-10-18 11:16:57
안녕하세요
예스스탁입니다.
input : starttime1(90000),endtime1(170000);
var : Tcond1(false);
if (sdate != sdate[1] and stime >= endtime1) or
(sdate == sdate[1] and stime >= endtime1 and stime[1] < endtime1) then
{
Tcond1 = false;
if MarketPosition == 1 Then
ExitLong("bx1");
if MarketPosition == -1 Then
ExitShort("sx1");
}
if (sdate != sdate[1] and stime >= starttime1) or
(sdate == sdate[1] and stime >= starttime1 and stime[1] < starttime1) then
{
Tcond1 = true;
}
if Tcond1 == true then
{
A전략내용
}
input : starttime2(190000),endtime2(030000);
var : Tcond2(false);
if (sdate != sdate[1] and stime >= endtime2) or
(sdate == sdate[1] and stime >= endtime2 and stime[1] < endtime2) then
{
Tcond2 = false;
if MarketPosition == 1 Then
ExitLong("bx2");
if MarketPosition == -1 Then
ExitShort("sx2");
}
if (sdate != sdate[1] and stime >= starttime2) or
(sdate == sdate[1] and stime >= starttime2 and stime[1] < starttime2) then
{
Tcond2 = true;
}
if Tcond2 == true then
{
B전략내용
}
즐거운 하루되세요
> 흰둥이아빠 님이 쓴 글입니다.
> 제목 : 함수요청
> 안녕하세요?
전략이 A, B 이렇게 2개가 있습니다.
한종목으로
9시부터 17시까지는 A전략을
19시부터 익일 3시까지는 B전략을
적용하고 싶습니다.