커뮤니티
한 전략당 2번 매매하도록
2013-05-15 22:35:09
147
글번호 63266
수고 많으십니다. 아래를 만족하는 시스템식 문의 드립니다.
1. 한 전략당 하루 2번의 진입만 허용
2. 단 2번째 진입은 1번째 진입이 수익이건 손절이건 청산이 다 되어야 진입하도록
답변 1
예스스탁 예스스탁 답변
2013-05-16 11:32:44
안녕하세요
예스스탁입니다.
2번 내용이 전체진입에서 첫번째와 두번째이면 1번식을 사용하시면 됩니다
2번 내용인 진입별로 첫번째와 두번째 이면 2번식을 이용하시면 됩니다.
1.
var : cnt(0),totaldayentry(0),b1cnt(0),b2cnt(0),s1cnt(0),s2cnt(0);
#진입별 진입횟수 카운트
b1cnt = 0;
b2cnt = 0;
s1cnt = 0;
s2cnt = 0;
totaldayentry = 0;
for cnt = 0 to 20{
#전체 진입횟수
if EntryDate(cnt) == sdate Then
totaldayentry = totaldayentry+1;
#b1진입 횟수
if EntryDate(cnt) == sdate and IsEntryName("b1",cnt) == true Then
B1cnt = B1cnt+1;
#b2진입 횟수
if EntryDate(cnt) == sdate and IsEntryName("b2",cnt) == true Then
B2cnt = B2cnt+1;
#s1진입 횟수
if EntryDate(cnt) == sdate and IsEntryName("s1",cnt) == true Then
S1cnt = S1cnt+1;
#s2진입 횟수
if EntryDate(cnt) == sdate and IsEntryName("s2",cnt) == true Then
S2cnt = S2cnt+1;
}
if (totaldayentry < 2 and MarketPosition == 0) or (totaldayentry >= 2) Then{
if b1cnt < 2 and 매수조건1 Then
buy("b1");
if b2cnt < 2 and 매수조건2 Then
buy("b2");
if s1cnt < 2 and 매도조건1 Then
Sell("s1");
if s2cnt < 2 and 매도조건2 Then
Sell("s2");
}
2.
var : cnt(0),totaldayentry(0),b1cnt(0),b2cnt(0),s1cnt(0),s2cnt(0);
#진입별 진입횟수 카운트
b1cnt = 0;
b2cnt = 0;
s1cnt = 0;
s2cnt = 0;
totaldayentry = 0;
for cnt = 0 to 20{
#전체 진입횟수
if EntryDate(cnt) == sdate Then
totaldayentry = totaldayentry+1;
#b1진입 횟수
if EntryDate(cnt) == sdate and IsEntryName("b1",cnt) == true Then
B1cnt = B1cnt+1;
#b2진입 횟수
if EntryDate(cnt) == sdate and IsEntryName("b2",cnt) == true Then
B2cnt = B2cnt+1;
#s1진입 횟수
if EntryDate(cnt) == sdate and IsEntryName("s1",cnt) == true Then
S1cnt = S1cnt+1;
#s2진입 횟수
if EntryDate(cnt) == sdate and IsEntryName("s2",cnt) == true Then
S2cnt = S2cnt+1;
}
if (b1cnt == 0 or (b1cnt == 1 and MarketPosition == 0)) and b1cnt < 2 and 매수조건1 Then
buy("b1");
if (b2cnt == 0 or (b2cnt == 1 and MarketPosition == 0)) and b2cnt < 2 and 매수조건2 Then
buy("b2");
if (s1cnt == 0 or (s1cnt == 1 and MarketPosition == 0)) and s1cnt < 2 and 매도조건1 Then
Sell("s1");
if (s2cnt == 0 or (s2cnt == 1 and MarketPosition == 0)) and s2cnt < 2 and 매도조건2 Then
Sell("s2");
즐거운 하루되세요
> lucky93 님이 쓴 글입니다.
> 제목 : 한 전략당 2번 매매하도록
> 수고 많으십니다. 아래를 만족하는 시스템식 문의 드립니다.
1. 한 전략당 하루 2번의 진입만 허용
2. 단 2번째 진입은 1번째 진입이 수익이건 손절이건 청산이 다 되어야 진입하도록
다음글
이전글