커뮤니티
수식 수정좀 부탁드립니다.
2011-04-12 22:32:39
601
글번호 37560
어제 '18053번' 에서 문의한 대로 수식을 작성해 주셨는데 시뮬레이션 해본 결과 피라미딩이 작동하지 않습니다. 최초에 진입만 한 채 이후로는 매수가 되지 않습니다. 수식을 검토해 보고 수정 부탁드립니다.
어제 올린 글과 작성해 주신 수식입니다.
<원래질문>
처음 진입가격이 0.5 미만이면 1.0 포인트 상승시마다 추가진입하고, 처음진입가격이 0.5 이상이면 최초진입 가격에서 20% 상승시 마다 추가진입하게끔 식을 세분화 하고 싶습니다. 수정된 수식좀 부탁드립니다.
<작성해 주신 수식>
var : EP(0);
#최초진입
if MarketPosition == 0 and C > 0.15 and daylow*1.3 < dayhigh and stime < 150000 Then{
buy("b",AtStop,daylow*1.3);
}
if MarketPosition == 1 and CurrentEntries == 1 Then
EP = EntryPrice;
#추가진입
if countif(CurrentEntries < CurrentEntries[1],BarsSinceEntry) < 1 Then{
if MarketPosition == 1 and CurrentEntries == 1 and highest(H,BarsSinceEntry) < EntryPrice+0.1 Then
buy("BB",AtStop,iff(EP < 0.5,EntryPrice+1,EntryPrice*1.2));
if MarketPosition == 1 and CurrentEntries == 2 and highest(H,BarsSinceEntry) < EntryPrice+0.2 Then
buy("CC",AtStop,iff(EP < 0.5,EntryPrice+2,EntryPrice*1.4));
if MarketPosition == 1 and CurrentEntries == 3 and highest(H,BarsSinceEntry) < EntryPrice+0.3 Then
buy("DD",AtStop,iff(EP < 0.5,EntryPrice+3,EntryPrice*1.6));
if MarketPosition == 1 and CurrentEntries == 4 and highest(H,BarsSinceEntry) < EntryPrice+0.4 Then
buy("EE",AtStop,iff(EP < 0.5,EntryPrice+4,EntryPrice*1.8));
}
if MarketPosition == 1 Then
exitlong("bx",AtStop,AvgEntryPrice,"BB");
if MarketPosition == 1 Then
exitlong("cx",AtStop,AvgEntryPrice,"CC");
if MarketPosition == 1 Then
exitlong("dx",AtStop,AvgEntryPrice,"DD");
if MarketPosition == 1 Then
exitlong("ex",AtStop,AvgEntryPrice,"EE");
SetStopEndofday(143000);
답변 1
예스스탁 예스스탁 답변
2011-04-13 10:33:58
안녕하세요
예스스탁입니다.
각 추가진입의 if문의 조건내용 때문에 발생한 문제였습니다.
수정한 식입니다.
var : EP(0);
#최초진입
if MarketPosition == 0 and C > 0.15 and daylow*1.3 < dayhigh and stime < 150000 Then{
buy("b",AtStop,daylow*1.3);
}
if MarketPosition == 1 and CurrentEntries == 1 Then
EP = EntryPrice;
#추가진입
if countif(CurrentEntries < CurrentEntries[1],BarsSinceEntry) < 1 Then{
if MarketPosition == 1 and CurrentEntries == 1 and highest(H,BarsSinceEntry) < iff(EP < 0.5,EntryPrice+1,EntryPrice*1.2) Then
buy("BB",AtStop,iff(EP < 0.5,EntryPrice+1,EntryPrice*1.2));
if MarketPosition == 1 and CurrentEntries == 2 and highest(H,BarsSinceEntry) < iff(EP < 0.5,EntryPrice+2,EntryPrice*1.4) Then
buy("CC",AtStop,iff(EP < 0.5,EntryPrice+2,EntryPrice*1.4));
if MarketPosition == 1 and CurrentEntries == 3 and highest(H,BarsSinceEntry) < iff(EP < 0.5,EntryPrice+3,EntryPrice*1.6) Then
buy("DD",AtStop,iff(EP < 0.5,EntryPrice+3,EntryPrice*1.6));
if MarketPosition == 1 and CurrentEntries == 4 and highest(H,BarsSinceEntry) < iff(EP < 0.5,EntryPrice+4,EntryPrice*1.8) Then
buy("EE",AtStop,iff(EP < 0.5,EntryPrice+4,EntryPrice*1.8));
}
if MarketPosition == 1 Then
exitlong("bx",AtStop,AvgEntryPrice,"BB");
if MarketPosition == 1 Then
exitlong("cx",AtStop,AvgEntryPrice,"CC");
if MarketPosition == 1 Then
exitlong("dx",AtStop,AvgEntryPrice,"DD");
if MarketPosition == 1 Then
exitlong("ex",AtStop,AvgEntryPrice,"EE");
SetStopEndofday(143000);
즐거운 하루되세요
> WT_mbloc 님이 쓴 글입니다.
> 제목 : 수식 수정좀 부탁드립니다.
> 어제 '18053번' 에서 문의한 대로 수식을 작성해 주셨는데 시뮬레이션 해본 결과 피라미딩이 작동하지 않습니다. 최초에 진입만 한 채 이후로는 매수가 되지 않습니다. 수식을 검토해 보고 수정 부탁드립니다.
어제 올린 글과 작성해 주신 수식입니다.
<원래질문>
처음 진입가격이 0.5 미만이면 1.0 포인트 상승시마다 추가진입하고, 처음진입가격이 0.5 이상이면 최초진입 가격에서 20% 상승시 마다 추가진입하게끔 식을 세분화 하고 싶습니다. 수정된 수식좀 부탁드립니다.
<작성해 주신 수식>
var : EP(0);
#최초진입
if MarketPosition == 0 and C > 0.15 and daylow*1.3 < dayhigh and stime < 150000 Then{
buy("b",AtStop,daylow*1.3);
}
if MarketPosition == 1 and CurrentEntries == 1 Then
EP = EntryPrice;
#추가진입
if countif(CurrentEntries < CurrentEntries[1],BarsSinceEntry) < 1 Then{
if MarketPosition == 1 and CurrentEntries == 1 and highest(H,BarsSinceEntry) < EntryPrice+0.1 Then
buy("BB",AtStop,iff(EP < 0.5,EntryPrice+1,EntryPrice*1.2));
if MarketPosition == 1 and CurrentEntries == 2 and highest(H,BarsSinceEntry) < EntryPrice+0.2 Then
buy("CC",AtStop,iff(EP < 0.5,EntryPrice+2,EntryPrice*1.4));
if MarketPosition == 1 and CurrentEntries == 3 and highest(H,BarsSinceEntry) < EntryPrice+0.3 Then
buy("DD",AtStop,iff(EP < 0.5,EntryPrice+3,EntryPrice*1.6));
if MarketPosition == 1 and CurrentEntries == 4 and highest(H,BarsSinceEntry) < EntryPrice+0.4 Then
buy("EE",AtStop,iff(EP < 0.5,EntryPrice+4,EntryPrice*1.8));
}
if MarketPosition == 1 Then
exitlong("bx",AtStop,AvgEntryPrice,"BB");
if MarketPosition == 1 Then
exitlong("cx",AtStop,AvgEntryPrice,"CC");
if MarketPosition == 1 Then
exitlong("dx",AtStop,AvgEntryPrice,"DD");
if MarketPosition == 1 Then
exitlong("ex",AtStop,AvgEntryPrice,"EE");
SetStopEndofday(143000);
다음글
이전글