커뮤니티
예스랭으로 코딩 좀 부탁드립니다.
2010-07-28 10:36:45
1238
글번호 31194
수고 많으십니다. 꾸벅!
7th 감각시스템에 있는 마틴게일 전략인데요.
예스랭으로 코딩 좀 부탁드립니다.
사이버스랭을 이해할려니 더 햇갈리네요. 죄송합니다.
DD_RangeBreak(v2.3): 마틴게일, 역마틴게일 전략
Input : len(0.37), atrlen(20), len1(2.7), consec(1), contlimit(200)
Var1=highd(1)-lowd(1)
Cond1= tdate=exitdate(1) And position(1)=1
Cond2= tdate=exitdate(1) And position(1)=-1
If barnum =1 Then
Var10=1
Var11=0
End If
If currentEntrynum>1 Then
If i_position=0 And i_position(1)<>0 Then
If i_netprofit > i_netprofit(1) Then ‘1. 마틴게일
If i_netprofit < i_netprofit(1) Then ‘2. 역마틴게일
Var11=0
Else
Var11=var11+1
End If
End If
End If
If Var11>=consec And i_position=0 And i_position(1)<>0 Then
Var10=Var10*2 ‘3. 직전계약수 대비 2배로 증가
Var10=Var10+1 ‘4. 직전계약수 대비 1계약 추가
End If
If Var11<consec Then
Var10=1
End If
If Var10>contlimit Then
Var10=contlimit
End If
If ttime<1500 Then
If Cond1=False Then
Call buy("매수",Atstop,Var10,opend+var1*len)
End If
If Cond2=False Then
Call sell("매도",Atstop,Var10,opend-var1*len)
End If
End If
If position<>0 Then
Call exitlong("매수추적스탑",Atstop,hhv(1,high,barnumsinceEntry+1)-atr(atrlen)*len1)
Call exitshort("매도추적스탑",Atstop,llv(1,low,barnumsinceEntry+1)+atr(atrlen)*len1)
End If
답변 1
예스스탁 예스스탁 답변
2010-07-28 14:58:19
안녕하세요
예스스탁입니다.
Input : len(0.37), atrlen(20), len1(2.7), consec(1), contlimit(200);
var : cond1(false),cond2(false),cnt(0),currentEntrynum(0);
Var1=dayhigh(1)-daylow(1);
Cond1= sdate==exitdate(1) And MarketPosition(1)==1;
Cond2= sdate==exitdate(1) And marketposition(1)==-1;
currentEntrynum = 0;
for cnt = 0 to 20{
if sdate == EntryDate(cnt) Then
currentEntrynum = currentEntrynum+1;
}
If index == 1 then{
Var10=1;
Var11=0;
}
If currentEntrynum>1 then{
If MarketPosition ==0 And MarketPosition[1]<>0 then{
If netprofit > netprofit[1] then{ #‘1. 마틴게일
#If i_netprofit < i_netprofit(1) then{ #‘2. 역마틴게일
Var11=0;
}
Else{
Var11=var11+1;
}
}
}
If Var11>=consec And MarketPosition==0 And MarketPosition(1)<>0 then{
Var10=Var10*2; #‘3. 직전계약수 대비 2배로 증가
#Var10=Var10+1; #‘4. 직전계약수 대비 1계약 추가
}
If Var11<consec then{
Var10=1;
}
If Var10>contlimit then{
Var10=contlimit;
}
If stime < 150000 then{
If Cond1==False then{
buy("매수",Atstop,dayopen+var1*len,var10);
}
If Cond2==False then{
sell("매도",Atstop,dayopen-var1*len,var10);
}
}
If MarketPosition<>0 then{
exitlong("매수추적스탑",Atstop,Highest(high,BarsSinceEntry+1)-atr(atrlen)*len1);
exitshort("매도추적스탑",Atstop,lowest(low,BarsSinceEntry+1)+atr(atrlen)*len1);
}
즐거운 하루되세요
> brucehan 님이 쓴 글입니다.
> 제목 : 예스랭으로 코딩 좀 부탁드립니다.
> 수고 많으십니다. 꾸벅!
7th 감각시스템에 있는 마틴게일 전략인데요.
예스랭으로 코딩 좀 부탁드립니다.
사이버스랭을 이해할려니 더 햇갈리네요. 죄송합니다.
DD_RangeBreak(v2.3): 마틴게일, 역마틴게일 전략
Input : len(0.37), atrlen(20), len1(2.7), consec(1), contlimit(200)
Var1=highd(1)-lowd(1)
Cond1= tdate=exitdate(1) And position(1)=1
Cond2= tdate=exitdate(1) And position(1)=-1
If barnum =1 Then
Var10=1
Var11=0
End If
If currentEntrynum>1 Then
If i_position=0 And i_position(1)<>0 Then
If i_netprofit > i_netprofit(1) Then ‘1. 마틴게일
If i_netprofit < i_netprofit(1) Then ‘2. 역마틴게일
Var11=0
Else
Var11=var11+1
End If
End If
End If
If Var11>=consec And i_position=0 And i_position(1)<>0 Then
Var10=Var10*2 ‘3. 직전계약수 대비 2배로 증가
Var10=Var10+1 ‘4. 직전계약수 대비 1계약 추가
End If
If Var11<consec Then
Var10=1
End If
If Var10>contlimit Then
Var10=contlimit
End If
If ttime<1500 Then
If Cond1=False Then
Call buy("매수",Atstop,Var10,opend+var1*len)
End If
If Cond2=False Then
Call sell("매도",Atstop,Var10,opend-var1*len)
End If
End If
If position<>0 Then
Call exitlong("매수추적스탑",Atstop,hhv(1,high,barnumsinceEntry+1)-atr(atrlen)*len1)
Call exitshort("매도추적스탑",Atstop,llv(1,low,barnumsinceEntry+1)+atr(atrlen)*len1)
End If
다음글