커뮤니티
시스템식 부탁드려요
2013-06-18 07:07:49
201
글번호 64421
다음과 같은 조건으로 매매하려 할 때의 시스템식을 부탁드립니다.
1. n1,n2는 최적화 가능하게끔 처리
2. 동일방향 연속진입 금지(전일거래분 포함)
3. 각각의 거래에서 수익과 손실의 의미는 3틱이상만 수익횟수와 손실횟수에 포함
(수수료와 슬리피지는 0으로 계산)(연속횟수 계산시 전일거래 포함)
(1) 연속손실횟수가 0,1,2회일 때 : 1계약 진입
(2) 연속손실횟수가 3회일 때 : 3계약 진입(연속3회)
손실-손실-손실
손실-손실-손실-수익
손실-손실-손실-수익-수익
손실-손실-손실-수익-손실
(3)연속손실횟수가 5회일 때 : 5계약 진입(연속3회)
손실-손실-손실-손실-손실
손실-손실-손실-손실-손실-수익
손실-손실-손실-손실-손실-수익-수익
손실-손실-손실-손실-손실-수익-손실
(4) 3연속 수익이면 2차례 매매진입을 쉼(이게 불가능하면 나머지만이라도 부탁해요)
4. 익절 : 21틱(계약당)
5. 당일순이익(총수익-총손실)이 총124틱이상이면 당일매매종료
6. 거래시간 : 오전7시-익일오전5시55분
매수조건 : ema(c,n1)[1]>ema(c,n2)[1] and
ema(O,n1)[1]>ema(c,n2)[1]
매수청산조건 : ema(c,n1)<ema(c,n2) and
ema(O,n1)<ema(c,n2)
매도조건 : ema(c,n1)[1]<ema(c,n2)[1] and
ema(O,n1)[1]<ema(c,n2)[1]
매도청산조건 : ema(c,n1)>ema(c,n2) and
ema(O,n1)>ema(c,n2)
답변 1
예스스탁 예스스탁 답변
2013-06-18 17:01:37
안녕하세요
예스스탁입니다.
4번 제외한 내용입니다.
수량설정중 (2),(3)외에는 모두 1계약 진입입니다.
input : n1(10),n2(20);
var : vol(0),cnt(0),exitcnt(0);
Array : PL[11](0);
#+-3틱이상의 손익이 발생한 거래만 저장
if BarsSinceExit(1) == 1 Then{
if PositionProfit(1) >= PriceScale*3 or PositionProfit(1) <= -PriceScale*3 Then{
ExitCnt = ExitCnt+1;
PL[1] = PositionProfit(1);
for cnt = 2 to 10{
PL[cnt] = PL[cnt-1][1];
}
}
}
vol = 1;
#연속손실
if ExitCnt == 3 and
PL[1] <= -PriceScale*3 and
PL[2] <= -PriceScale*3 and
PL[3] <= -PriceScale*3 Then
vol = 3;
if ExitCnt > 3 and
PL[1] <= -PriceScale*3 and
PL[2] <= -PriceScale*3 and
PL[3] <= -PriceScale*3 and
PL[4] >= PriceScale*3 Then
vol = 3;
if ExitCnt == 4 and
PL[1] >= PriceScale*3 and
PL[2] <= -PriceScale*3 and
PL[3] <= -PriceScale*3 and
PL[4] <= -PriceScale*3 Then
vol = 3;
if ExitCnt > 4 and
PL[1] >= PriceScale*3 and
PL[2] <= -PriceScale*3 and
PL[3] <= -PriceScale*3 and
PL[4] <= -PriceScale*3 and
PL[4] >= PriceScale*3 Then
vol = 3;
if ExitCnt == 5 and
(PL[1] >= PriceScale*3 or PL[1] <= -PriceScale*3) and
PL[2] >= PriceScale*3 and
PL[3] <= -PriceScale*3 and
PL[4] <= -PriceScale*3 and
PL[5] <= -PriceScale*3 Then
vol = 3;
if ExitCnt > 5 and
(PL[1] >= PriceScale*3 or PL[1] <= -PriceScale*3) and
PL[2] >= PriceScale*3 and
PL[3] <= -PriceScale*3 and
PL[4] <= -PriceScale*3 and
PL[5] <= -PriceScale*3 and
PL[6] >= PriceScale*3 Then
vol = 3;
if ExitCnt == 5 and
PL[1] <= -PriceScale*3 and
PL[2] <= -PriceScale*3 and
PL[3] <= -PriceScale*3 and
PL[4] <= -PriceScale*3 and
PL[5] <= -PriceScale*3 Then
vol = 5;
if ExitCnt > 5 and
PL[1] <= -PriceScale*3 and
PL[2] <= -PriceScale*3 and
PL[3] <= -PriceScale*3 and
PL[4] <= -PriceScale*3 and
PL[5] <= -PriceScale*3 and
PL[6] >= 0 Then
vol = 5;
if ExitCnt == 6 and
PL[1] >= PriceScale*3 and
PL[2] <= -PriceScale*3 and
PL[3] <= -PriceScale*3 and
PL[4] <= -PriceScale*3 and
PL[5] <= -PriceScale*3 and
PL[6] <= -PriceScale*3 Then
vol = 5;
if ExitCnt > 6 and
PL[1] >= PriceScale*3 and
PL[2] <= -PriceScale*3 and
PL[3] <= -PriceScale*3 and
PL[4] <= -PriceScale*3 and
PL[5] <= -PriceScale*3 and
PL[6] <= -PriceScale*3 and
PL[7] >= 0 Then
vol = 5;
if ExitCnt == 7 and
(PL[1] <= -PriceScale*3 or PL[1] >= PriceScale*3) and
PL[2] >= PriceScale*3 and
PL[3] <= -PriceScale*3 and
PL[4] <= -PriceScale*3 and
PL[5] <= -PriceScale*3 and
PL[6] <= -PriceScale*3 and
PL[7] <= -PriceScale*3 Then
vol = 5;
if ExitCnt > 7 and
(PL[1] <= -PriceScale*3 or PL[1] >= PriceScale*3) and
PL[2] >= PriceScale*3 and
PL[3] <= -PriceScale*3 and
PL[4] <= -PriceScale*3 and
PL[5] <= -PriceScale*3 and
PL[6] <= -PriceScale*3 and
PL[7] <= -PriceScale*3 and
PL[8] >= 0 Then
vol = 5;
value1 = NetProfit;
if date != date[1] Then
value2 = value1[1];
value3 = value1-value2;
if (stime >= 070000 or stime < 055500) and value3 < PriceScale*124 then{
if ema(c,n1)[1]>ema(c,n2)[1] and ema(O,n1)[1]>ema(c,n2)[1] Then
buy("b",OnClose,def,vol);
if ema(c,n1)<ema(c,n2) and ema(O,n1)<ema(c,n2) Then
ExitLong();
if ema(c,n1)[1]<ema(c,n2)[1] and ema(O,n1)[1]<ema(c,n2)[1] Then
sell("s",OnClose,def,vol);
if ema(c,n1)>ema(c,n2) and ema(O,n1)>ema(c,n2) Then
ExitShort();
}
SetStopProfittarget(PriceScale*21,PointStop);
즐거운 하루되세요
> 묘선낭자 님이 쓴 글입니다.
> 제목 : 시스템식 부탁드려요
> 다음과 같은 조건으로 매매하려 할 때의 시스템식을 부탁드립니다.
1. n1,n2는 최적화 가능하게끔 처리
2. 동일방향 연속진입 금지(전일거래분 포함)
3. 각각의 거래에서 수익과 손실의 의미는 3틱이상만 수익횟수와 손실횟수에 포함
(수수료와 슬리피지는 0으로 계산)(연속횟수 계산시 전일거래 포함)
(1) 연속손실횟수가 0,1,2회일 때 : 1계약 진입
(2) 연속손실횟수가 3회일 때 : 3계약 진입(연속3회)
손실-손실-손실
손실-손실-손실-수익
손실-손실-손실-수익-수익
손실-손실-손실-수익-손실
(3)연속손실횟수가 5회일 때 : 5계약 진입(연속3회)
손실-손실-손실-손실-손실
손실-손실-손실-손실-손실-수익
손실-손실-손실-손실-손실-수익-수익
손실-손실-손실-손실-손실-수익-손실
(4) 3연속 수익이면 2차례 매매진입을 쉼(이게 불가능하면 나머지만이라도 부탁해요)
4. 익절 : 21틱(계약당)
5. 당일순이익(총수익-총손실)이 총124틱이상이면 당일매매종료
6. 거래시간 : 오전7시-익일오전5시55분
매수조건 : ema(c,n1)[1]>ema(c,n2)[1] and
ema(O,n1)[1]>ema(c,n2)[1]
매수청산조건 : ema(c,n1)<ema(c,n2) and
ema(O,n1)<ema(c,n2)
매도조건 : ema(c,n1)[1]<ema(c,n2)[1] and
ema(O,n1)[1]<ema(c,n2)[1]
매도청산조건 : ema(c,n1)>ema(c,n2) and
ema(O,n1)>ema(c,n2)