커뮤니티
수정부탁드립니다.
2012-02-23 05:31:42
298
글번호 48090
아래식에서..
1차매수후 수익실현이 되면 2차매수가 안되는데....1차매수후 10프로이상 주가가 상승하지 않으면 2차매수가 되게 수정바랍니다..
2차매수후에도 평단가대비 주가가 10프로이상 오르지않으면 3차 매수되게해주세요..
3차매수후에도.....
그리고 중요한거
2차이후 매수가되면 매도수량이 이상하게 나가게 됩니다..
즉 2차 매수후 5프로에서 보유수량의 절반만 매도로 나가야되는데 더많이 나가게 되네요..3차 4차도 그렇고 ....이것도 수정해주세요..
var1 = ma(c,240);
var2 = ma(c,360);
var3 = ma(c,480);
var4 = ma(c,600);
var5 = ma(c,750);
if MarketPosition == 0 And (CrossDown(c,var1*1.01) or crossup(c,var1*0.99)) Then
buy("b1");
if MarketPosition == 1 Then{
if CurrentContracts < CurrentContracts[1] Then
Condition1 = true;
if Condition1 == false Then{
if MaxEntries == 1 And (CrossDown(c,var2*1.01) or crossup(c,var2*0.99)) then
buy("b2");
if MaxEntries == 2 And (CrossDown(c,var3*1.01) or crossup(c,var3*0.99)) then
buy("b3");
if MaxEntries == 3 And (CrossDown(c,var4*1.01) or crossup(c,var4*0.99)) then
buy("b4");
}
if MaxEntries == 1 Then{
exitlong("bx11",atlimit,EntryPrice*1.05,"",int(CurrentContracts*0.5),1);
exitlong("bx12",atlimit,EntryPrice*1.10,"",int(CurrentContracts*0.5),1);
}
if MaxEntries == 2 Then{
exitlong("bx21",atlimit,avgEntryPrice*1.05,"",int(CurrentContracts*0.5),1);
exitlong("bx22",atlimit,avgEntryPrice*1.10,"",int(CurrentContracts*0.5),1);
}
if MaxEntries == 3 Then{
exitlong("bx31",atlimit,avgEntryPrice*1.03,"",int(CurrentContracts*0.5),1);
exitlong("bx32",atlimit,avgEntryPrice*1.05,"",int(CurrentContracts*0.5),1);
}
if MaxEntries == 4 Then{
exitlong("bx41",atlimit,avgEntryPrice,"",int(CurrentContracts*0.5),1);
exitlong("bx42",atlimit,avgEntryPrice*1.03,"",int(CurrentContracts*0.5),1);
}
if CrossDown(c,var5) Then
exitlong();
}
Else
Condition1 = false;
답변 1
예스스탁 예스스탁 답변
2012-02-23 14:53:33
안녕하세요
예스스탁입니다.
1차진입후 진입가 대비 10%이상 상승하지 않았으면 2차매수가 들어갈수 있게 변경했습니다.
2차진입후 평균단가 대비 10%이상 상승하지 않았으면 3차매수가 들어갈수 있게 변경했습니다.
3차진입후 퍙균단가 대비 5%이상 상승하지 않았으면 4차매수가 들어갈수 있게 변경했습니다.
원식 자체가 현재 보유수량의 50%가 청산되도록 작성이 되어 있었습니다.
적용하신 종목에 따라 1주단위, 10주단위가 있으므로
현재 보유수량 50%를 계산하도록 내용 추가했습니다.
var : vol50(0);
var1 = ma(c,240);
var2 = ma(c,360);
var3 = ma(c,480);
var4 = ma(c,600);
var5 = ma(c,750);
if MarketPosition == 0 And (CrossDown(c,var1*1.01) or crossup(c,var1*0.99)) Then
buy("b1");
if MarketPosition == 1 Then{
#코스피,코스닥,옵션별로 현재보유수량의 50% 계산
if CodeCategory == 1 Then{ #코스피
if BasePrice < 50000 Then
vol50 = int((CurrentContracts*0.5)/10)*10;
Else
vol50 = int(CurrentContracts*0.5);
}
if CodeCategory == 2 Then#코스닥
vol50 = int(CurrentContracts*0.5);
if CodeCategory == 6 Then#옵션
vol50 = int(CurrentContracts*0.5);
#1차매수후 진입가대비 10%이상 상승하면 Condition1은 true 아니면 false
if MaxEntries == 1 and H >= EntryPrice*1.1 Then
Condition1 = true;
#2차매수후 평균단가 대비 10%이상 상승하면 Condition2는 true 아니면 false
if MaxEntries == 2 and H >= AvgEntryPrice*1.1 Then
Condition2 = true;
#3차매수후 평균단가 대비 5%이상 상승하면 Condition1은 true 아니면 false
if MaxEntries == 3 and H >= AvgEntryPrice*1.05 Then
Condition2 = true;
if Condition1 == False and MaxEntries == 1 And (CrossDown(c,var2*1.01) or crossup(c,var2*0.99)) then
buy("b2");
if Condition2 == False and MaxEntries == 2 And (CrossDown(c,var3*1.01) or crossup(c,var3*0.99)) then
buy("b3");
if Condition3 == False and MaxEntries == 3 And (CrossDown(c,var4*1.01) or crossup(c,var4*0.99)) then
buy("b4");
if MaxEntries == 1 Then{
exitlong("bx11",atlimit,EntryPrice*1.05,"",vol50,1);
exitlong("bx12",atlimit,EntryPrice*1.10,"",vol50,1);
}
if MaxEntries == 2 Then{
exitlong("bx21",atlimit,avgEntryPrice*1.05,"",vol50,1);
exitlong("bx22",atlimit,avgEntryPrice*1.10,"",vol50,1);
}
if MaxEntries == 3 Then{
exitlong("bx31",atlimit,avgEntryPrice*1.03,"",vol50,1);
exitlong("bx32",atlimit,avgEntryPrice*1.05,"",vol50,1);
}
if MaxEntries == 4 Then{
exitlong("bx41",atlimit,avgEntryPrice,"",vol50,1);
exitlong("bx42",atlimit,avgEntryPrice*1.03,"",vol50,1);
}
if CrossDown(c,var5) Then
exitlong();
}
Else{
Condition1 = false;
Condition2 = false;
Condition3 = false;
}
즐거운 하루되세요
> 상위1프로되기 님이 쓴 글입니다.
> 제목 : 수정부탁드립니다.
> 아래식에서..
1차매수후 수익실현이 되면 2차매수가 안되는데....1차매수후 10프로이상 주가가 상승하지 않으면 2차매수가 되게 수정바랍니다..
2차매수후에도 평단가대비 주가가 10프로이상 오르지않으면 3차 매수되게해주세요..
3차매수후에도.....
그리고 중요한거
2차이후 매수가되면 매도수량이 이상하게 나가게 됩니다..
즉 2차 매수후 5프로에서 보유수량의 절반만 매도로 나가야되는데 더많이 나가게 되네요..3차 4차도 그렇고 ....이것도 수정해주세요..
var1 = ma(c,240);
var2 = ma(c,360);
var3 = ma(c,480);
var4 = ma(c,600);
var5 = ma(c,750);
if MarketPosition == 0 And (CrossDown(c,var1*1.01) or crossup(c,var1*0.99)) Then
buy("b1");
if MarketPosition == 1 Then{
if CurrentContracts < CurrentContracts[1] Then
Condition1 = true;
if Condition1 == false Then{
if MaxEntries == 1 And (CrossDown(c,var2*1.01) or crossup(c,var2*0.99)) then
buy("b2");
if MaxEntries == 2 And (CrossDown(c,var3*1.01) or crossup(c,var3*0.99)) then
buy("b3");
if MaxEntries == 3 And (CrossDown(c,var4*1.01) or crossup(c,var4*0.99)) then
buy("b4");
}
if MaxEntries == 1 Then{
exitlong("bx11",atlimit,EntryPrice*1.05,"",int(CurrentContracts*0.5),1);
exitlong("bx12",atlimit,EntryPrice*1.10,"",int(CurrentContracts*0.5),1);
}
if MaxEntries == 2 Then{
exitlong("bx21",atlimit,avgEntryPrice*1.05,"",int(CurrentContracts*0.5),1);
exitlong("bx22",atlimit,avgEntryPrice*1.10,"",int(CurrentContracts*0.5),1);
}
if MaxEntries == 3 Then{
exitlong("bx31",atlimit,avgEntryPrice*1.03,"",int(CurrentContracts*0.5),1);
exitlong("bx32",atlimit,avgEntryPrice*1.05,"",int(CurrentContracts*0.5),1);
}
if MaxEntries == 4 Then{
exitlong("bx41",atlimit,avgEntryPrice,"",int(CurrentContracts*0.5),1);
exitlong("bx42",atlimit,avgEntryPrice*1.03,"",int(CurrentContracts*0.5),1);
}
if CrossDown(c,var5) Then
exitlong();
}
Else
Condition1 = false;
다음글
이전글