커뮤니티
수고하십니다.
2008-09-27 19:24:59
673
글번호 17257
var : cnt(0),Bcount(0),Scount(0);
for cnt = 1 to 10{
if entrydate(cnt) == sdate and PositionProfit(cnt) > 0 and
MarketPosition(cnt) == 1 Then
Bcount = Bcount +1;
if entrydate(cnt) == sdate and PositionProfit(cnt) > 0 and
MarketPosition(cnt) == -1 Then
Scount = Scount +1;
}
if 매수식 and Bcount < 1 Then
buy();
if 매도식 and Scount < 1 Then
sell();
매수로 수익거래가 발생하면 당일 매수진입 금지
매도로 수익거래가 발생하면 당일 매도진입 금지
이렇게 해서 시뮬레이션을 돌려보면.... 맨 앞쪽날만 매매횟수가 2번 이루어지고 그 이후로는 매매진입이 안되네요... 그날에만 설정하고. 다음날은 초기화해서 다시 이런식의 접근이 가능하게 하고 싶습니다.
답변 1
예스스탁 예스스탁 답변
2008-09-29 11:15:35
안녕하세요
예스스탁입니다.
Bcount와 Scount는 누적되는 값이므로
식을 수행시 한번씩 초기화를 해주어야 합니다.
초기화 부분이 없으면 한번 누적되고 그 값이 계속 유지가 되어 이후
신호가 나오지 않습니다
var : cnt(0),Bcount(0),Scount(0);
Bcount = 0; //초기화
Scount = 0; //초기화
for cnt = 1 to 10{
if entrydate(cnt) == sdate and PositionProfit(cnt) > 0 and
MarketPosition(cnt) == 1 Then
Bcount = Bcount +1;
if entrydate(cnt) == sdate and PositionProfit(cnt) > 0 and
MarketPosition(cnt) == -1 Then
Scount = Scount +1;
}
if 매수식 and Bcount < 1 Then
buy();
if 매도식 and Scount < 1 Then
sell();
즐거운 하루되세요
> CJ_coco 님이 쓴 글입니다.
> 제목 : 수고하십니다.
> var : cnt(0),Bcount(0),Scount(0);
for cnt = 1 to 10{
if entrydate(cnt) == sdate and PositionProfit(cnt) > 0 and
MarketPosition(cnt) == 1 Then
Bcount = Bcount +1;
if entrydate(cnt) == sdate and PositionProfit(cnt) > 0 and
MarketPosition(cnt) == -1 Then
Scount = Scount +1;
}
if 매수식 and Bcount < 1 Then
buy();
if 매도식 and Scount < 1 Then
sell();
매수로 수익거래가 발생하면 당일 매수진입 금지
매도로 수익거래가 발생하면 당일 매도진입 금지
이렇게 해서 시뮬레이션을 돌려보면.... 맨 앞쪽날만 매매횟수가 2번 이루어지고 그 이후로는 매매진입이 안되네요... 그날에만 설정하고. 다음날은 초기화해서 다시 이런식의 접근이 가능하게 하고 싶습니다.
다음글
이전글