커뮤니티
시스템 문의입니다
2008-12-23 11:10:10
642
글번호 18960
var : cnt(0),count(0);
setstopendofday(1500);
setstoptrailing(0.3,2.5,pointstop);//청산기준
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
##당일 첫진입
if MarketPosition() == 0 and count == 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
buy();
if stime >=093000 and ma(C,4) < ma(C,20) then
sell();
}
##청산
if MarketPosition() != 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
ExitShort();
if stime >=093000 and ma(C,4) < ma(C,20) then
exitlong();
}
##당일 첫진입 이후
if MarketPosition() == 0 and count >= 1 Then{
if BarsSinceExit(1) == 1 and MarketPosition(1) == -1 then
buy();
if BarsSinceExit(1) == 1 and MarketPosition(1) == 1 then
sell();
}
저번에 문의한거 답변을 이렇게 받았는데 첫날만 진입하고 2번째날부터 진입이 안되더군요 모가 문제 일까요?^^;;
답변 1
예스스탁 예스스탁 답변
2008-12-23 11:45:20
안녕하세요
예스스타입니다.
죄송합니다.
for문의 count변수값을 초기화 하는 부분이 누락됐습니다.
수정해서 올려드립니다.
var : cnt(0),count(0);
setstopendofday(1500);
setstoptrailing(0.3,2.5,pointstop);//청산기준
count = 0;
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
##당일 첫진입
if MarketPosition() == 0 and count == 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
buy();
if stime >=093000 and ma(C,4) < ma(C,20) then
sell();
}
##청산
if MarketPosition() != 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
ExitShort();
if stime >=093000 and ma(C,4) < ma(C,20) then
exitlong();
}
##당일 첫진입 이후
if MarketPosition() == 0 and count >= 1 Then{
if BarsSinceExit(1) == 1 and MarketPosition(1) == -1 then
buy();
if BarsSinceExit(1) == 1 and MarketPosition(1) == 1 then
sell();
}
즐거운 하루되세요
> 반포동 님이 쓴 글입니다.
> 제목 : 시스템 문의입니다
> var : cnt(0),count(0);
setstopendofday(1500);
setstoptrailing(0.3,2.5,pointstop);//청산기준
for cnt = 0 to 10{
if sdate == EntryDate(cnt) Then
count = count+1;
}
##당일 첫진입
if MarketPosition() == 0 and count == 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
buy();
if stime >=093000 and ma(C,4) < ma(C,20) then
sell();
}
##청산
if MarketPosition() != 0 Then{
if stime >=093000 and ma(C,4) > ma(C,20) then
ExitShort();
if stime >=093000 and ma(C,4) < ma(C,20) then
exitlong();
}
##당일 첫진입 이후
if MarketPosition() == 0 and count >= 1 Then{
if BarsSinceExit(1) == 1 and MarketPosition(1) == -1 then
buy();
if BarsSinceExit(1) == 1 and MarketPosition(1) == 1 then
sell();
}
저번에 문의한거 답변을 이렇게 받았는데 첫날만 진입하고 2번째날부터 진입이 안되더군요 모가 문제 일까요?^^;;