커뮤니티
질문드립니다.
2019-02-26 08:46:16
207
글번호 126559
아래는 상한가를 나타내는 사용자 함수입니다.
2015년 6월이후 30%로 상한가가 변경된 부분만 나타내는 수식으로 수정부탁드립니다.
var : MAXP(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
if date >= 19981207 then {
if date < 20050328 && CodeCategory() == 2 then
UpLimit = (BP[0] * 1.12);
Else if date >= 20050328 and date < 20150615 Then
UpLimit = (BP[0] * 1.15);
Else
UpLimit = (BP[0] * 1.30);
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
MAXP = up1;
Else If BP >= 100000 Then
MAXP = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
MAXP = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
MAXP = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
MAXP = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
MAXP = iff(up5>=5000, up5, up6);
Else
MAXP = iff(up6>=1000, up6, up6);
}
Else{
If BP >= 500000 Then
MAXP = up1;
Else If BP >= 100000 Then
MAXP = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
MAXP = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
MAXP = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
MAXP = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
MAXP = iff(up5>=5000, up5, up6);
Else
MAXP = iff(up6>=1000, up6, up7);
}
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
MAXP = up6;
}
}
상한가=MAXP;
답변 1
예스스탁 예스스탁 답변
2019-02-26 15:09:55
안녕하세요
예스스탁입니다.
var : Base(0),TP(0);
Base = BasePrice*1.30;
if CodeCategory == 1 then
{
if Base < 1000 Then
TP = 1;
else if Base >= 1000 and Base < 5000 Then
TP = 5;
else if Base >= 5000 and Base < 10000 Then
TP = 10;
else if Base >= 10000 and Base < 50000 Then
TP = 50;
else if Base >= 50000 and Base < 100000 Then
TP = 100;
else if Base >= 100000 and Base < 500000 Then
TP = 500;
Else
TP = 1000;
}
if CodeCategory == 2 then
{
if Base < 1000 Then
TP = 1;
else if Base >= 1000 and Base < 5000 Then
TP = 5;
else if Base >= 5000 and Base < 10000 Then
TP = 10;
else if Base >= 10000 and Base < 50000 Then
TP = 50;
else
TP = 100;
}
상한가 = Floor(Base/TP)*TP;
즐거운 하루되세요
> 7007 님이 쓴 글입니다.
> 제목 : 질문드립니다.
> 아래는 상한가를 나타내는 사용자 함수입니다.
2015년 6월이후 30%로 상한가가 변경된 부분만 나타내는 수식으로 수정부탁드립니다.
var : MAXP(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
if date >= 19981207 then {
if date < 20050328 && CodeCategory() == 2 then
UpLimit = (BP[0] * 1.12);
Else if date >= 20050328 and date < 20150615 Then
UpLimit = (BP[0] * 1.15);
Else
UpLimit = (BP[0] * 1.30);
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
MAXP = up1;
Else If BP >= 100000 Then
MAXP = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
MAXP = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
MAXP = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
MAXP = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
MAXP = iff(up5>=5000, up5, up6);
Else
MAXP = iff(up6>=1000, up6, up6);
}
Else{
If BP >= 500000 Then
MAXP = up1;
Else If BP >= 100000 Then
MAXP = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
MAXP = iff(up3>=100000, up2, up3);
Else If BP >= 10000 Then
MAXP = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
MAXP = iff(up5>=10000, up4, up5);
Else If BP >= 1000 Then
MAXP = iff(up5>=5000, up5, up6);
Else
MAXP = iff(up6>=1000, up6, up7);
}
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
MAXP = up6;
}
}
상한가=MAXP;
다음글