커뮤니티
분할매수수식 부탁드립니다. 감사합니다.
2012-11-20 21:25:48
404
글번호 56682
날씨가 무척이나 쌀쌀해졌습니다.
건강조심하시구요...제가 고민되는 수식도 부탁드리겠습니다.
전일이 상한가이면 시가로 매수를 적용하고싶습니다.
조건1: 1차매수(5만원)-----> 상한가다음날 시가<시가의 5% 이익실현>
조건2: 시가의 5%이익실현 됐을시......
1차재매수(5만원)-----> 전일종가 (상다음날만적용)
2차매수 (5만원)-----> 전일종가의 -7% (상다음날부터 4일간동안만적용)
3차매수 (5만원)-----> 전일종가의 -14% (상다음날부터 4일간동안만적용)
4차매수 (5만원)-----> 전일종가의 -17% (상다음날부터 4일간동안만적용)
조건3: 시가의 5%이익실현 못했을경우(안됐을경우)......
2차매수 (5만원)-----> 당일시가의 -7% (상다음날부터 4일간동안만적용)
3차매수 (5만원)-----> 당일시가의 -14% (상다음날부터 4일간동안만적용)
4차매수 (5만원)-----> 당일시가의 -17% (상다음날부터 4일간동안만적용)
조건4 : 1차매수5% 이익실현 말고, 나머지 매수방법(1~4차매수)은
평균매입가의 7% 수익시 전량매도,,... 챠트를 끝내는 수식을 알고싶습니다.
1~2까지 매수하고 7% 실현하드래도 챠트를 끝내고 싶습니다.
꼭 부탁드립니다. 감사합니다.
답변 1
예스스탁 예스스탁 답변
2012-11-21 10:50:07
안녕하세요
예스스탁입니다.
input : 투입금액(50000);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0);
if CodeCategory == 1 Then{
if BasePrice < 50000 Then
Var1 = int(int(투입금액/C)/10)*10;
Else
Var1 = int(투입금액/C);
}
if CodeCategory == 2 or CodeCategory == 8 Then
Var1 = int(투입금액/C);
if date >= 19981207 then {
if date < 20050328 && CodeCategory() == 2 then
UpLimit = (BP[0] * 1.12);
Else
UpLimit = (BP[0] * 1.15);
if CodeCategory() == 2 then {
if date >= 20030721 then {
up1 = int(UpLimit/100+0.00001)*100;
up2 = int(UpLimit/100+0.00001)*100;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
}
else {
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/10+0.00001)*10;
}
}
Else {
up1 = int(UpLimit/1000+0.00001)*1000;
up2 = int(UpLimit/500+0.00001)*500;
up3 = int(UpLimit/100+0.00001)*100;
up4 = int(UpLimit/50+0.00001)*50;
up5 = int(UpLimit/10+0.00001)*10;
up6 = int(UpLimit/5+0.00001)*5;
}
if CodeCategory() == 1 || CodeCategory() == 2 then {
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 100000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=10000, up4, up5);
Else
상한가 = iff(up6>=5000, up5, up6);
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
상한가 = up6;
}
}
var : daycnt(0);
if date != date[1] Then
daycnt = daycnt+1;
if dayhigh >= 상한가 and stime == 150000 Then
buy("b1",AtMarket,def,var1);
if MarketPosition == 1 and MaxEntries == 1 and EntryDate == sdate Then
ExitLong("bx1",atlimit,EntryPrice*1.05,"b1");
if MarketPosition == 0 and ExitDate(1) == sDate and IsExitName("bx1",1) == true Then
buy("bb1",atlimit,DayClose(1),var1);
if MarketPosition == 1 and IsEntryName("bb1") == true and daycnt <= daycnt[BarsSinceEntry]+4 Then{
if CurrentEntries == 1 Then
buy("bb2",AtLimit,DayClose(1)[BarsSinceEntry]*0.93,var1);
if CurrentEntries == 2 Then
buy("bb3",AtLimit,DayClose(1)[BarsSinceEntry]*0.86,var1);
if CurrentEntries == 3 Then
buy("bb4",AtLimit,DayClose(1)[BarsSinceEntry]*0.83,var1);
}
if MarketPosition == 1 and IsEntryName("b1") == true and daycnt <= daycnt[BarsSinceEntry]+4 Then{
if CurrentEntries == 1 Then
buy("b2",AtLimit,DayOpen[BarsSinceEntry]*0.93,var1);
if CurrentEntries == 2 Then
buy("b3",AtLimit,DayOpen[BarsSinceEntry]*0.8,var16);
if CurrentEntries == 3 Then
buy("b4",AtLimit,DayOpen[BarsSinceEntry]*0.83,var1);
}
if MarketPosition == 1 Then
exitlong("bx",Atlimit,AvgEntryPrice*1.07);
즐거운 하루되세요
> 신나는파파 님이 쓴 글입니다.
> 제목 : 분할매수수식 부탁드립니다. 감사합니다.
> 날씨가 무척이나 쌀쌀해졌습니다.
건강조심하시구요...제가 고민되는 수식도 부탁드리겠습니다.
전일이 상한가이면 시가로 매수를 적용하고싶습니다.
조건1: 1차매수(5만원)-----> 상한가다음날 시가<시가의 5% 이익실현>
조건2: 시가의 5%이익실현 됐을시......
1차재매수(5만원)-----> 전일종가 (상다음날만적용)
2차매수 (5만원)-----> 전일종가의 -7% (상다음날부터 4일간동안만적용)
3차매수 (5만원)-----> 전일종가의 -14% (상다음날부터 4일간동안만적용)
4차매수 (5만원)-----> 전일종가의 -17% (상다음날부터 4일간동안만적용)
조건3: 시가의 5%이익실현 못했을경우(안됐을경우)......
2차매수 (5만원)-----> 당일시가의 -7% (상다음날부터 4일간동안만적용)
3차매수 (5만원)-----> 당일시가의 -14% (상다음날부터 4일간동안만적용)
4차매수 (5만원)-----> 당일시가의 -17% (상다음날부터 4일간동안만적용)
조건4 : 1차매수5% 이익실현 말고, 나머지 매수방법(1~4차매수)은
평균매입가의 7% 수익시 전량매도,,... 챠트를 끝내는 수식을 알고싶습니다.
1~2까지 매수하고 7% 실현하드래도 챠트를 끝내고 싶습니다.
꼭 부탁드립니다. 감사합니다.