커뮤니티
부탁드립니다.
2015-01-13 11:39:37
131
글번호 82200
아래의 식을 적용하니 진입이 되지 않습니다.
무엇이 문제인지 검토부탁드립니다.
첫번째질문
제가 원하는 수식은 어제 종가의 가격으로 다음날 아침 시초가로 진입하는 것입니다.
차트는 분봉에 적용예정입니다.
input : 어제(20150112), 세시(150000), 진입가격(0), 수량(500) ; //시초가 진입
var : Hval(0), HH(0);
input: mult(2);
/*-----시초가 진입------*/
if sdate >= 어제 and stime == 세시 Then{
buy("By2",AtLimit,def,수량);
HH = H;
Condition1 = true;
}
두번째, N일전 상한가 발생시...그때의 고가, 저가를 저장하고 현재까지 고가 밑으로 떨어지지 않는다면....
세번째 N일전 상한가 발생시...그때의 고가, 저가를 저장하고 현재까지 저가 밑으로 떨어지지 않는다면.... 을 수식으로 표현부탁합니다.
답변 1
예스스탁 예스스탁 답변
2015-01-13 14:24:32
안녕하세요
예스스탁입니다.
1.
Atlimit은 매수에서 지정한 가격이하의 시세가 발생하면
신호가 발생합니다.
def로 가격을 지정하시면 가격이 없으므로 신호가 발생하지 않습니다.
C로 지정하시면 3시의 종가보다 다음봉(다음날) 첫봉의 시세가
해당 종가보다 낮은 시세가 발생하면 신호가 발생합니다.
즉 atlimit뒤에 특정값을 지정하셔야 합니다.
input : 어제(20150112), 세시(150000), 진입가격(0), 수량(500) ; //시초가 진입
var : Hval(0), HH(0);
input: mult(2);
if sdate >= 어제 and stime == 세시 Then{
buy("By2",AtLimit,C,수량);
HH = H;
Condition1 = true;
}
2.
아래 내용 참고하시기 바랍니다.
input : N(5);
var : 하한가(0), DnLimit(0);
var : dn1(0), dn2(0), dn3(0), dn4(0), dn5(0),dn6(0),dn7(0);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
var : Dcnt(0);
if date >= 19981207 then {
if date < 20050328 && CodeCategory() == 2 then
DnLimit = (BP * 0.12);
Else
DnLimit = (BP * 0.15);
if CodeCategory() == 2 then {
if date >= 20030721 then {
dn1 = int(DnLimit/100)*100;
dn2 = int(DnLimit/100)*100;
dn3 = int(DnLimit/100)*100;
dn4 = int(DnLimit/50)*50;
dn5 = int(DnLimit/10)*10;
dn6 = int(DnLimit/5)*5;
dn7 = int(DnLimit/1)*1;
}
else {
dn1 = int(DnLimit/1000)*1000;
dn2 = int(DnLimit/500)*500;
dn3 = int(DnLimit/100)*100;
dn4 = int(DnLimit/50)*50;
dn5 = int(DnLimit/10)*10;
dn6 = int(DnLimit/10)*10;
dn7 = int(DnLimit/1)*1;
}
}
Else {
dn1 = int(DnLimit/1000)*1000;
dn2 = int(DnLimit/500)*500;
dn3 = int(DnLimit/100)*100;
dn4 = int(DnLimit/50)*50;
dn5 = int(DnLimit/10)*10;
dn6 = int(DnLimit/5)*5;
dn7 = int(DnLimit/1)*1;
}
if CodeCategory() == 1 or CodeCategory() == 2 then {
if sdate < 20101004 Then{
If BP >= 500000 Then
하한가 = BP-dn1;
Else If BP >= 100000 Then
하한가 = BP-dn2;
Else If BP >= 50000 Then
하한가 = BP-dn3;
Else If BP >= 10000 Then
하한가 = BP-dn4;
Else If BP >= 5000 Then
하한가 = BP-dn5;
Else If BP >= 1000 Then
하한가 = BP-dn6;
Else
하한가 = BP-dn6;
}
else{
If BP >= 500000 Then
하한가 = BP-dn1;
Else If BP >= 100000 Then
하한가 = BP-dn2;
Else If BP >= 50000 Then
하한가 = BP-dn3;
Else If BP >= 10000 Then
하한가 = BP-dn4;
Else If BP >= 5000 Then
하한가 = BP-dn5;
Else If BP >= 1000 Then
하한가 = BP-dn6;
Else
하한가 = BP-dn7;
}
}
else if CodeCategory() == 8 or CodeCategory() == 9 then {
하한가 = BP-dn6;
}
}
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;
up7 = int(UpLimit/1+0.00001)*1;
}
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;
up7 = int(UpLimit/1+0.00001)*1;
}
}
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;
up7 = int(UpLimit/1+0.00001)*1;
}
if CodeCategory() == 1 || CodeCategory() == 2 then {
if sdate < 20101004 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 If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up6);
}
Else{
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 If BP >= 1000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=1000, up6, up7);
}
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
상한가 = up6;
}
}
if date != date[1] Then
Dcnt = Dcnt+1;
if H == 상한가 Then{
var1 = index;
var11 = Dcnt;
Condition1 = false;
}
if index > var1 and C < var1 Then
Condition1 = true;
if L == 하한가 Then{
var2 = index;
var22 = Dcnt;
Condition2 = false;
}
if index > var1 and C < var2 Then
Condition2 = true;
#최소 N일전에 상한가 발생하고 종가가 상한가이하루 발생하지 않음
if Dcnt >= var11+N and Condition1 == false Then
#최소 N일전에 하한가 발생하고 종가가 하한가이하로 발생하지 않음
if Dcnt >= var22+N and Condition2 == false Then
즐거운 하루되세요
> 에리조나 님이 쓴 글입니다.
> 제목 : 부탁드립니다.
> 아래의 식을 적용하니 진입이 되지 않습니다.
무엇이 문제인지 검토부탁드립니다.
첫번째질문
제가 원하는 수식은 어제 종가의 가격으로 다음날 아침 시초가로 진입하는 것입니다.
차트는 분봉에 적용예정입니다.
input : 어제(20150112), 세시(150000), 진입가격(0), 수량(500) ; //시초가 진입
var : Hval(0), HH(0);
input: mult(2);
/*-----시초가 진입------*/
if sdate >= 어제 and stime == 세시 Then{
buy("By2",AtLimit,def,수량);
HH = H;
Condition1 = true;
}
두번째, N일전 상한가 발생시...그때의 고가, 저가를 저장하고 현재까지 고가 밑으로 떨어지지 않는다면....
세번째 N일전 상한가 발생시...그때의 고가, 저가를 저장하고 현재까지 저가 밑으로 떨어지지 않는다면.... 을 수식으로 표현부탁합니다.