커뮤니티
다시한번 문의드립니다.
2013-01-07 22:49:49
288
글번호 57884
안녕하세요
예스스탁입니다.
1분봉에 적용하시면 됩니다.
시초가에 주문을 내기 위해서는
전일 마지막봉에 if문을 만족시켜
다음날 첫시세 들어올때 주문이 발생시켜야만 합니다.
적용하신 종목의 거래가 없어 15시에 거래가 없으면
해당종목은 주문이 나가지 않습니다.
input : 투입금액(1000000);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0);
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;
}
}
#수량계산
if CodeCategory == 1 Then{
if BasePrice < 50000 Then
Var1 = int(int((투입금액*0.5)/C)/10)*10;
Else
Var1 = int((투입금액*0.5)/C);
}
if CodeCategory == 2 or CodeCategory == 8 Then
Var1 = int(투입금액/C);
#시가신호
if stime == 150000 and dayhigh >= 상한가 Then
buy("b1",AtMarket,def,var1);
#전일종가-3%
if MarketPosition == 1 Then
buy("b2",atlimit,DayClose(1)*0.97,var1);
#매도
if MarketPosition == 1 Then{
#시가신호만 발생했을때
if maxEntries == 1 Then{
exitlong("bx",AtStop,EntryPrice*0.9);
}
#추가매수도 된경우
if MaxEntries == 2 Then{
if CodeCategory == 1 and BasePrice < 50000 Then{
value1 = int(int(MaxContracts*0.5)/10)*10;
value2 = int(int(MaxContracts*0.25)/10)*10;
}
Else{
value1 = int(int(MaxContracts*0.5)/10)*10;
value2 = int(int(MaxContracts*0.25)/10)*10;
}
if countif(crossup(PositionProfit,투입금액*0.1),BarsSinceEntry) == 1 and crossup(PositionProfit,투입금액*0.1) Then
exitlong("bx1",OnClose,def,"",value1,1);
if countif(crossup(PositionProfit,투입금액*0.2),BarsSinceEntry) == 1 and crossup(PositionProfit,투입금액*0.2) Then
exitlong("bx2",OnClose,def,"",value2,1);
if countif(crossup(PositionProfit,투입금액*0.3),BarsSinceEntry) == 1 and crossup(PositionProfit,투입금액*0.3) Then
exitlong("bx3");
if CurrentContracts < MaxContracts Then
exitlong("bx4",AtStop,highest(H,BarsSinceEntry)*0.9);
}
}
전일 상한가친 종목에 대한 매매방법에 대해서 다음과 같이 코딩해 주셨는데요
1분봉상에서 시뮬레이션이 안되서 다시한번 문의 드립니다.
코딩 점검 부탁드립니다.
답변 1
예스스탁 예스스탁 답변
2013-01-08 11:27:46
안녕하세요
예스스탁입니다.
시초가에 주문을 내고자하는 식을 구현하기 위해서는
시스템은 봉을 기준으로 수행이 되므로
몇분봉에 적용할것인지를 주기를 알아야 합니다.
올려드린 식은 1분봉에서도 정상적으로
신호가 발생하는 식으로 시뮬레이션이 되는 식입니다.
코딩자체에 수정할 부분이 사용하시는 주기에 따른
시간조정뿐이 없습니다.
좀더 자세한 내용 올려주시기 바랍니다.
즐거운 하루되세요
> 썬보이 님이 쓴 글입니다.
> 제목 : 다시한번 문의드립니다.
> 안녕하세요
예스스탁입니다.
1분봉에 적용하시면 됩니다.
시초가에 주문을 내기 위해서는
전일 마지막봉에 if문을 만족시켜
다음날 첫시세 들어올때 주문이 발생시켜야만 합니다.
적용하신 종목의 거래가 없어 15시에 거래가 없으면
해당종목은 주문이 나가지 않습니다.
input : 투입금액(1000000);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0);
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;
}
}
#수량계산
if CodeCategory == 1 Then{
if BasePrice < 50000 Then
Var1 = int(int((투입금액*0.5)/C)/10)*10;
Else
Var1 = int((투입금액*0.5)/C);
}
if CodeCategory == 2 or CodeCategory == 8 Then
Var1 = int(투입금액/C);
#시가신호
if stime == 150000 and dayhigh >= 상한가 Then
buy("b1",AtMarket,def,var1);
#전일종가-3%
if MarketPosition == 1 Then
buy("b2",atlimit,DayClose(1)*0.97,var1);
#매도
if MarketPosition == 1 Then{
#시가신호만 발생했을때
if maxEntries == 1 Then{
exitlong("bx",AtStop,EntryPrice*0.9);
}
#추가매수도 된경우
if MaxEntries == 2 Then{
if CodeCategory == 1 and BasePrice < 50000 Then{
value1 = int(int(MaxContracts*0.5)/10)*10;
value2 = int(int(MaxContracts*0.25)/10)*10;
}
Else{
value1 = int(int(MaxContracts*0.5)/10)*10;
value2 = int(int(MaxContracts*0.25)/10)*10;
}
if countif(crossup(PositionProfit,투입금액*0.1),BarsSinceEntry) == 1 and crossup(PositionProfit,투입금액*0.1) Then
exitlong("bx1",OnClose,def,"",value1,1);
if countif(crossup(PositionProfit,투입금액*0.2),BarsSinceEntry) == 1 and crossup(PositionProfit,투입금액*0.2) Then
exitlong("bx2",OnClose,def,"",value2,1);
if countif(crossup(PositionProfit,투입금액*0.3),BarsSinceEntry) == 1 and crossup(PositionProfit,투입금액*0.3) Then
exitlong("bx3");
if CurrentContracts < MaxContracts Then
exitlong("bx4",AtStop,highest(H,BarsSinceEntry)*0.9);
}
}
전일 상한가친 종목에 대한 매매방법에 대해서 다음과 같이 코딩해 주셨는데요
1분봉상에서 시뮬레이션이 안되서 다시한번 문의 드립니다.
코딩 점검 부탁드립니다.