커뮤니티
수식 변경 부탁드립니다.
2010-03-11 20:12:40
617
글번호 28620
<현물, 분봉>
좀 복잡할 것 같은데, 청산 부분에 대해서만 아래수식 변경 부탁드립니다.
---------------------------------------------------
-당일 10시에 상한가 이면, 청산하지 않고 익일 시가에 청산하고, 상한가가 아니면 손익에 상관없이 청산하는 식인데요...
아래처럼 변경해 주십시요.
----->
-당일 10시에, 매수가 대비 수익이면 청산. 상한가이면 청산하지 않고 익일 시가에 청산. 매수가 대비 손실이면 청산하지 않음.
-당일 12시에, 매수가 대비 수익이면 청산. 상한가이면 청산하지 않고 익일 시가에 청산. 매수가 대비 손실이면 청산하지 않음.(단, 10시에 상한가로 인하여 청산을 하지 않은 상태에서 12시에, 상한가가 풀려있고, 매수가 대비 수익 상태이면 12시에 청산되어야 함)
-당일 14시에, 매수가 대비 수익이면 청산. 상한가이면 청산하지 않고 익일 시가에 청산. 매수가 대비 손실이면 청산하지 않음.(단, 10시 혹은 12시에 상한가로 인하여 청산을 하지 않은 상태에서 14시에, 상한가가 풀려있고, 매수가 대비 수익 상태이면 14시에 청산되어야 함)
-당일 14: 48시에, 상한가이면 청산하지 않고 익일 시가에 청산. 상한가가 아니면 수익이나 손실에 상관없이 청산
감사합니다.
---------------------------------------------------
input : 전일날짜(20100308);
var : 상한가(0), UpLimit(0);
var : aaa(0), bbb(0), ccc(0), ddd(0), eee(0),fff(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 {
aaa = int(UpLimit/100+0.00001)*100;
bbb = int(UpLimit/100+0.00001)*100;
ccc = int(UpLimit/100+0.00001)*100;
ddd = int(UpLimit/50+0.00001)*50;
eee = int(UpLimit/10+0.00001)*10;
fff = int(UpLimit/5+0.00001)*5;
}
else {
aaa = int(UpLimit/1000+0.00001)*1000;
bbb = int(UpLimit/500+0.00001)*500;
ccc = int(UpLimit/100+0.00001)*100;
ddd = int(UpLimit/50+0.00001)*50;
eee = int(UpLimit/10+0.00001)*10;
fff = int(UpLimit/10+0.00001)*10;
}
}
Else {
aaa = int(UpLimit/1000+0.00001)*1000;
bbb = int(UpLimit/500+0.00001)*500;
ccc = int(UpLimit/100+0.00001)*100;
ddd = int(UpLimit/50+0.00001)*50;
eee = int(UpLimit/10+0.00001)*10;
fff = int(UpLimit/5+0.00001)*5;
}
if CodeCategory() == 1 || CodeCategory() == 2 then {
If BP >= 500000 Then
상한가 = aaa;
Else If BP >= 100000 Then
상한가 = iff(bbb>=500000, aaa, bbb);
Else If BP >= 50000 Then
상한가 = iff(ccc>=100000, bbb, ccc);
Else If BP >= 10000 Then
상한가 = iff(ddd>=50000, ccc, ddd);
Else If BP >= 5000 Then
상한가 = iff(eee>=10000, ddd, eee);
Else
상한가 = iff(fff>=5000, eee, fff);
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
상한가 = fff;
}
}
if stime == 150000 then{
if sDate == 전일날짜 and NextBarOpen >= C*1.015 and NextBarOpen <= C*1.05 Then
buy("b1",AtMarket);
if sDate == 전일날짜 and NextBarOpen <= C*0.96 and NextBarOpen >= C*0.91 Then
buy("b2",AtMarket);
}
if dayhigh <= 상한가 Then
SetStopEndofday(100000);
Else
SetStopEndofday(0);
if MarketPosition == 1 and stime == 150000 Then
exitlong("bx",AtMarket);
답변 1
예스스탁 예스스탁 답변
2010-03-12 11:46:03
안녕하세요
예스스탁입니다.
input : 전일날짜(20100308);
var : 상한가(0), UpLimit(0);
var : aaa(0), bbb(0), ccc(0), ddd(0), eee(0),fff(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 {
aaa = int(UpLimit/100+0.00001)*100;
bbb = int(UpLimit/100+0.00001)*100;
ccc = int(UpLimit/100+0.00001)*100;
ddd = int(UpLimit/50+0.00001)*50;
eee = int(UpLimit/10+0.00001)*10;
fff = int(UpLimit/5+0.00001)*5;
}
else {
aaa = int(UpLimit/1000+0.00001)*1000;
bbb = int(UpLimit/500+0.00001)*500;
ccc = int(UpLimit/100+0.00001)*100;
ddd = int(UpLimit/50+0.00001)*50;
eee = int(UpLimit/10+0.00001)*10;
fff = int(UpLimit/10+0.00001)*10;
}
}
Else {
aaa = int(UpLimit/1000+0.00001)*1000;
bbb = int(UpLimit/500+0.00001)*500;
ccc = int(UpLimit/100+0.00001)*100;
ddd = int(UpLimit/50+0.00001)*50;
eee = int(UpLimit/10+0.00001)*10;
fff = int(UpLimit/5+0.00001)*5;
}
if CodeCategory() == 1 || CodeCategory() == 2 then {
If BP >= 500000 Then
상한가 = aaa;
Else If BP >= 100000 Then
상한가 = iff(bbb>=500000, aaa, bbb);
Else If BP >= 50000 Then
상한가 = iff(ccc>=100000, bbb, ccc);
Else If BP >= 10000 Then
상한가 = iff(ddd>=50000, ccc, ddd);
Else If BP >= 5000 Then
상한가 = iff(eee>=10000, ddd, eee);
Else
상한가 = iff(fff>=5000, eee, fff);
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
상한가 = fff;
}
}
if stime == 150000 then{
if sDate == 전일날짜 and NextBarOpen >= C*1.015 and NextBarOpen <= C*1.05 Then
buy("b1",AtMarket);
if sDate == 전일날짜 and NextBarOpen <= C*0.96 and NextBarOpen >= C*0.91 Then
buy("b2",AtMarket);
}
if stime == 100000 and C > EntryPrice and H < 상한가 Then
exitlong();
if stime == 120000 and C > EntryPrice and H < 상한가 Then
exitlong();
if stime == 140000 and C > EntryPrice and H < 상한가 Then
exitlong();
if stime == 144800 and H < 상한가 Then
exitlong();
if MarketPosition == 1 and stime == 150000 Then
exitlong("bx",AtMarket);
즐거운 하루되세요
> 쌀사비팔 님이 쓴 글입니다.
> 제목 : 수식 변경 부탁드립니다.
> <현물, 분봉>
좀 복잡할 것 같은데, 청산 부분에 대해서만 아래수식 변경 부탁드립니다.
---------------------------------------------------
-당일 10시에 상한가 이면, 청산하지 않고 익일 시가에 청산하고, 상한가가 아니면 손익에 상관없이 청산하는 식인데요...
아래처럼 변경해 주십시요.
----->
-당일 10시에, 매수가 대비 수익이면 청산. 상한가이면 청산하지 않고 익일 시가에 청산. 매수가 대비 손실이면 청산하지 않음.
-당일 12시에, 매수가 대비 수익이면 청산. 상한가이면 청산하지 않고 익일 시가에 청산. 매수가 대비 손실이면 청산하지 않음.(단, 10시에 상한가로 인하여 청산을 하지 않은 상태에서 12시에, 상한가가 풀려있고, 매수가 대비 수익 상태이면 12시에 청산되어야 함)
-당일 14시에, 매수가 대비 수익이면 청산. 상한가이면 청산하지 않고 익일 시가에 청산. 매수가 대비 손실이면 청산하지 않음.(단, 10시 혹은 12시에 상한가로 인하여 청산을 하지 않은 상태에서 14시에, 상한가가 풀려있고, 매수가 대비 수익 상태이면 14시에 청산되어야 함)
-당일 14: 48시에, 상한가이면 청산하지 않고 익일 시가에 청산. 상한가가 아니면 수익이나 손실에 상관없이 청산
감사합니다.
---------------------------------------------------
input : 전일날짜(20100308);
var : 상한가(0), UpLimit(0);
var : aaa(0), bbb(0), ccc(0), ddd(0), eee(0),fff(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 {
aaa = int(UpLimit/100+0.00001)*100;
bbb = int(UpLimit/100+0.00001)*100;
ccc = int(UpLimit/100+0.00001)*100;
ddd = int(UpLimit/50+0.00001)*50;
eee = int(UpLimit/10+0.00001)*10;
fff = int(UpLimit/5+0.00001)*5;
}
else {
aaa = int(UpLimit/1000+0.00001)*1000;
bbb = int(UpLimit/500+0.00001)*500;
ccc = int(UpLimit/100+0.00001)*100;
ddd = int(UpLimit/50+0.00001)*50;
eee = int(UpLimit/10+0.00001)*10;
fff = int(UpLimit/10+0.00001)*10;
}
}
Else {
aaa = int(UpLimit/1000+0.00001)*1000;
bbb = int(UpLimit/500+0.00001)*500;
ccc = int(UpLimit/100+0.00001)*100;
ddd = int(UpLimit/50+0.00001)*50;
eee = int(UpLimit/10+0.00001)*10;
fff = int(UpLimit/5+0.00001)*5;
}
if CodeCategory() == 1 || CodeCategory() == 2 then {
If BP >= 500000 Then
상한가 = aaa;
Else If BP >= 100000 Then
상한가 = iff(bbb>=500000, aaa, bbb);
Else If BP >= 50000 Then
상한가 = iff(ccc>=100000, bbb, ccc);
Else If BP >= 10000 Then
상한가 = iff(ddd>=50000, ccc, ddd);
Else If BP >= 5000 Then
상한가 = iff(eee>=10000, ddd, eee);
Else
상한가 = iff(fff>=5000, eee, fff);
}
else if CodeCategory() == 8 || CodeCategory() == 9 then { // ETF
상한가 = fff;
}
}
if stime == 150000 then{
if sDate == 전일날짜 and NextBarOpen >= C*1.015 and NextBarOpen <= C*1.05 Then
buy("b1",AtMarket);
if sDate == 전일날짜 and NextBarOpen <= C*0.96 and NextBarOpen >= C*0.91 Then
buy("b2",AtMarket);
}
if dayhigh <= 상한가 Then
SetStopEndofday(100000);
Else
SetStopEndofday(0);
if MarketPosition == 1 and stime == 150000 Then
exitlong("bx",AtMarket);
다음글
이전글