커뮤니티
터틀 예제 수정부탁드립니다.
2014-04-16 21:00:24
259
글번호 74495
연구원님께서 알려주신 블로그의 터틀 예제를 이용하여
전일 가격에 관계없이 당일 가격을 이용하여 주식 데이트레이딩에 적용해보려합니다.
highest 함수가 전일 가격에 영향을 받지않도록 수식 수정 좀 부탁드리겠습니다.
Input: Capital(14000000),buylen(20),exlen(10),atrlen(3);
Var: AtrV(0), Unit(0), MP(0);
AtrV = ATR(buylen)*atrlen;
Unit = (Capital*0.02)/(AtrV);
if Unit < 1 then Unit = 1;
MP = MarketPosition;
# 진입
If MP == 0 then {
buy("B", atstop, Highest(High,buylen), Unit);
}
# 피리미딩 진입
If MP == 1 and CurrentEntries < 4 Then
buy("bp", atstop, EntryPrice+AtrV[BarsSinceEntry]*1*CurrentEntries, Unit);
# 청산
If MP == 1 Then {
ExitLong("EL", atstop,Lowest(L,exlen));
ExitLong("EL_stop",AtStop,AvgEntryPrice-2*AtrV);
}
답변 1
예스스탁 예스스탁 답변
2014-04-17 15:17:27
안녕하세요
예스스탁입니다.
방법은 2가지 입니다.
1번식과 같이 당일 봉수가 20개가 되지 않을때는 당일최고가를 사용하고
20개봉 이후부터는 20개봉의 최고가를 사용하게 하시거나
2번식과 같이 진입자체를 당일20개봉 이후에만 발생하게 조건을 주는 방법입니다.
1,
Input: Capital(14000000),buylen(20),exlen(10),atrlen(3);
Var: AtrV(0), Unit(0), MP(0),HH(0);
AtrV = ATR(buylen)*atrlen;
Unit = (Capital*0.02)/(AtrV);
if Unit < 1 then Unit = 1;
MP = MarketPosition;
if dayindex < Buylen Then
HH = dayhigh;
Else
HH = highest(h,20);
# 진입
If MP == 0 then {
buy("B", atstop, HH, Unit);
}
# 피리미딩 진입
If MP == 1 and CurrentEntries < 4 Then
buy("bp", atstop, EntryPrice+AtrV[BarsSinceEntry]*1*CurrentEntries, Unit);
# 청산
If MP == 1 Then {
ExitLong("EL", atstop,Lowest(L,exlen));
ExitLong("EL_stop",AtStop,AvgEntryPrice-2*AtrV);
}
2
Input: Capital(14000000),buylen(20),exlen(10),atrlen(3);
Var: AtrV(0), Unit(0), MP(0);
AtrV = ATR(buylen)*atrlen;
Unit = (Capital*0.02)/(AtrV);
if Unit < 1 then Unit = 1;
MP = MarketPosition;
# 진입
If MP == 0 and dayindex >= buylen then {
buy("B", atstop, highest(H,buylen), Unit);
}
# 피리미딩 진입
If MP == 1 and CurrentEntries < 4 Then
buy("bp", atstop, EntryPrice+AtrV[BarsSinceEntry]*1*CurrentEntries, Unit);
# 청산
If MP == 1 Then {
ExitLong("EL", atstop,Lowest(L,exlen));
ExitLong("EL_stop",AtStop,AvgEntryPrice-2*AtrV);
}
즐거운 하루되세요
> 훈sys 님이 쓴 글입니다.
> 제목 : 터틀 예제 수정부탁드립니다.
> 연구원님께서 알려주신 블로그의 터틀 예제를 이용하여
전일 가격에 관계없이 당일 가격을 이용하여 주식 데이트레이딩에 적용해보려합니다.
highest 함수가 전일 가격에 영향을 받지않도록 수식 수정 좀 부탁드리겠습니다.
Input: Capital(14000000),buylen(20),exlen(10),atrlen(3);
Var: AtrV(0), Unit(0), MP(0);
AtrV = ATR(buylen)*atrlen;
Unit = (Capital*0.02)/(AtrV);
if Unit < 1 then Unit = 1;
MP = MarketPosition;
# 진입
If MP == 0 then {
buy("B", atstop, Highest(High,buylen), Unit);
}
# 피리미딩 진입
If MP == 1 and CurrentEntries < 4 Then
buy("bp", atstop, EntryPrice+AtrV[BarsSinceEntry]*1*CurrentEntries, Unit);
# 청산
If MP == 1 Then {
ExitLong("EL", atstop,Lowest(L,exlen));
ExitLong("EL_stop",AtStop,AvgEntryPrice-2*AtrV);
}