커뮤니티
질문입니다.
2013-11-19 11:45:04
142
글번호 69607
상한가를 15%로 고정한 사용자함수 부탁드립니다.
input : P1(NumericSimple),P2(NumericSimple);
var : FK(0);
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 date != date[1] Then
Condition1 = false;
#종가,고가,저가가 같고 상한가이면
if C >= 상한가 and H == C and C == L Then
Condition1 = True;
#종가가 상한가가 아니면
if C < 상한가 Then
Condition1 = false;
var1 = highest(H,P1);
var2 = lowest(L,P1);
#condition1일때 FK는 100
if Condition1 == true Then
FK = 100;
Else #아니면 기존계산식으로 계산
FK = Ceiling((c-var2)/(var1-var2)*100);
STOCMS = EMA(FK,P2);
답변 1
예스스탁 예스스탁 답변
2013-11-20 09:45:31
안녕하세요
예스스탁입니다.
input : P1(NumericSimple),P2(NumericSimple);
var : FK(0),상한가(0);
상한가 = iff(BasePrice >= 500000, int((BasePrice * 1.15) / 1000 + 0.00001) * 1000,
iff(BasePrice >= 100000, int((BasePrice * 1.15) / 500 + 0.00001) * 500,
iff(BasePrice >= 50000, int((BasePrice * 1.15) / 100 + 0.00001) * 100,
iff(BasePrice >= 10000, int((BasePrice *1.15) / 50 + 0.00001) * 50,
iff(BasePrice >= 5000, int((BasePrice * 1.15) / 10 + 0.00001) * 10,
iff(BasePrice >= 1000, int((BasePrice * 1.15) / 5 + 0.00001) * 5,
int((BasePrice * 1.15) / 1 + 0.00001) * 1))))));
if date != date[1] Then
Condition1 = false;
#종가,고가,저가가 같고 상한가이면
if C >= 상한가 and H == C and C == L Then
Condition1 = True;
#종가가 상한가가 아니면
if C < 상한가 Then
Condition1 = false;
var1 = highest(H,P1);
var2 = lowest(L,P1);
#condition1일때 FK는 100
if Condition1 == true Then
FK = 100;
Else #아니면 기존계산식으로 계산
FK = Ceiling((c-var2)/(var1-var2)*100);
STOCMS = EMA(FK,P2);
즐거운 하루되세요
> HI_JA****** 님이 쓴 글입니다.
> 제목 : 질문입니다.
> 상한가를 15%로 고정한 사용자함수 부탁드립니다.
input : P1(NumericSimple),P2(NumericSimple);
var : FK(0);
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 date != date[1] Then
Condition1 = false;
#종가,고가,저가가 같고 상한가이면
if C >= 상한가 and H == C and C == L Then
Condition1 = True;
#종가가 상한가가 아니면
if C < 상한가 Then
Condition1 = false;
var1 = highest(H,P1);
var2 = lowest(L,P1);
#condition1일때 FK는 100
if Condition1 == true Then
FK = 100;
Else #아니면 기존계산식으로 계산
FK = Ceiling((c-var2)/(var1-var2)*100);
STOCMS = EMA(FK,P2);