커뮤니티
시간제어식 요청
2019-01-03 12:29:01
180
글번호 124921
하루에 3번을 진입할수있는데,
시간대별로 1번씩 진입조건충족하면 진입하고, 청산조건이면 청산하고자합니다
090000>=Stime and 093000<Stime 에 1회
093000>=Stime and 100000<Stime 에 1회
100000>=Stime and 1200000<Stime 에 1회 진입하는식입니다.
아래식이 가능한지요?. 아니면 다른 방법이 있는지요?
Input:N(1);
var :count(0);
Count=0;
for Value15=0 to 10{
If EntryDate( Value15)== sDate Then
count =count+1;}
#진입
If Count<N and marketposition==0 Then {
If 090000>=Stime and 093000<Stime Then {
if crossup(A,B) then buy();
}
If Count<N and marketposition==0 Then {
If 093000>=Stime and 100000<Stime Then {
if crossup(A,B) then buy();
}
If Count<N and marketposition==0 Then {
If 100000>=Stime and 1200000<Stime Then {
if crossup(A,B) then buy();
}
If marketposition==1 Then {
if crossup(A,B) then exitlong();
}
감사합니다
답변 1
예스스탁 예스스탁 답변
2019-01-03 16:08:28
안녕하세요
예스스탁입니다.
1
작성하신 수식에서 진입횟수 카운트는 당일 진입횟수입니다.
시간별이 아닙니다.
2
090000>=Stime and 093000<Stime
현재봉의 시간이 9시 이전이고 9시30분 이후라는 내용으로
시간 지정내용에 오류가 있습니다. 조건이 성립될수 없는 내용입니다.
9시~9시 30분 사이는 stime >= 090000 and stime < 093000
과 같이 표현하셔야 합니다.
3
1200000<Stime
시간은 HHMMSS로 6자리 입니다.
12시는 12000로 지정하셔야 합니다.
4
수정한 식입니다.
Input:N(1);
var :count(0);
if (sdate != sdate[1] and stime >= 90000) or
(sdate == sdate[1] and stime >= 90000 and stime[1] < 90000) Then
T1 = TotalTrades;
if (sdate != sdate[1] and stime >= 093000) or
(sdate == sdate[1] and stime >= 093000 and stime[1] < 093000) Then
T1 = TotalTrades;
if (sdate != sdate[1] and stime >= 100000) or
(sdate == sdate[1] and stime >= 100000 and stime[1] < 100000) Then
T1 = TotalTrades;
if MarketPosition == 0 Then
count = TotalTrades-t1;
Else
count = TotalTrades-t1+1;
#진입
If Count<N and marketposition==0 Then
{
If Stime >= 090000 and Stime < 093000 Then
{
if crossup(A,B) then buy();
}
If Stime >= 093000 and Stime < 100000 Then
{
if crossup(A,B) then buy();
}
If Stime >= 100000 and Stime < 120000 Then
{
if crossup(A,B) then buy();
}
}
If marketposition==1 Then {
if crossup(A,B) then exitlong();
}
즐거운 하루되세요
> tao 님이 쓴 글입니다.
> 제목 : 시간제어식 요청
> 하루에 3번을 진입할수있는데,
시간대별로 1번씩 진입조건충족하면 진입하고, 청산조건이면 청산하고자합니다
090000>=Stime and 093000<Stime 에 1회
093000>=Stime and 100000<Stime 에 1회
100000>=Stime and 1200000<Stime 에 1회 진입하는식입니다.
아래식이 가능한지요?. 아니면 다른 방법이 있는지요?
Input:N(1);
var :count(0);
Count=0;
for Value15=0 to 10{
If EntryDate( Value15)== sDate Then
count =count+1;}
#진입
If Count<N and marketposition==0 Then {
If 090000>=Stime and 093000<Stime Then {
if crossup(A,B) then buy();
}
If Count<N and marketposition==0 Then {
If 093000>=Stime and 100000<Stime Then {
if crossup(A,B) then buy();
}
If Count<N and marketposition==0 Then {
If 100000>=Stime and 1200000<Stime Then {
if crossup(A,B) then buy();
}
If marketposition==1 Then {
if crossup(A,B) then exitlong();
}
감사합니다