커뮤니티
수식 확인 부탁드리겠습니다.
2014-02-24 15:58:09
159
글번호 72871
안녕하세요.
다른 조건은 기존에 알려주신 수식과 동일하고 매수조건만 하기와 같이 변형 가능한지 확인 부탁 드리겠습니다.
#기존매수조건: 60분봉에서 0봉과 181전봉사이의 가격중 가장 높은 가격과 가장 낮은 가격의 평균 가격에 0봉의 저가 OR 종가가 2%내로 근접했을 경우 다음 봉 시초가에 매수
=>제가 원하는 것은 일봉상 조건에 부합했을 경우 그 순간에 매수가 들어가게 하고 싶습니다만 그 봉이 완성되어야 다음 봉 시초가에 매수 주문이 들어가는 것으로 알고 있기 때문에 분봉으로 매수 조건을 바꾸어서 일봉상 조건에 부합한 순간과 가장 가깝게 매수가 되는 환경을 만들고 싶습니다. 하지만 60분봉으로 만들어서 적용했더니 매수 조건과 실제 매수와의 괴리가 큰 것을 발견하였습니다. 따라서, 하기와 같이 변형을 해서 사용하고 싶은데 가능한지 확인 좀 부탁 드리겠습니다.
#1. 새로운 매수조건 옵션1: 일봉상 저가 또는 종가가 기준선 가격 2%내에 접근하였을 경우 1분봉에서 다음 봉 시초가에 매수
#2. 새로운 매수조건 옵션2: 1분봉에서 0봉과 9386전봉사이의 가격중 가장 높은 가격과 가장 낮은 가격의 평균 가격에 0봉의 저가 OR 종가가 2%내로 근접했을 경우 다음 봉 시초가에 매수
------------------------------------------------------------------------------------------------------------------------------------------
안녕하세요
예스스탁입니다.
var : 상한가(0), UpLimit(0),maP(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
var : upcond(0),upcond1(0),upcond2(0),upcond3(0),upcond4(0),upcond5(0),upcond6(0);
var : 기준선(0),dayma(0),HH(0),LL(0),cnt(0),sum(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;
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{
UPcond = 0;
UPcond1 = UPcond[1];
UPcond2 = UPcond1[1];
UPcond3 = UPcond2[1];
UPcond4 = UPcond3[1];
UPcond5 = UPcond4[1];
UPcond6 = UPcond5[1];
}
if H >= 상한가 Then
UPcond = 1;
#일봉 전일 기준선 계산
HH = dayhigh(1);
LL = daylow(1);
for cnt = 1 to 26{
if DayHigh(cnt) > HH Then
HH = DayHigh(cnt);
if DayLow(cnt) < LL Then
LL = DayLow(cnt);
}
기준선 = (HH+LL)/2;
#일봉 전일 이평계산
sum = 0;
for cnt = 1 to 20{
sum = sum+DayClose(cnt);
}
dayma = sum/maP;
var1 = highest(H,182);
var2 = lowest(L,182);
var3 = (var1+var2)/2;
if upcond1+upcond2+upcond3+upcond4+upcond5+upcond6 >= 1 And
기준선 > dayma And
(CrossDown(L,var2*1.02) or CrossDown(C,var2*1.02)) Then
buy("b",AtMarket);
if MarketPosition == 1 Then
ExitLong("bx",AtStop,EntryPrice*0.95);
즐거운 하루되세요
> 아일랜드전설 님이 쓴 글입니다.
> 제목 : 수식 확인 부탁드리겠습니다.
> 안녕하세요.
항상 도움에 감사드립니다.
하기와 같은 시스템 수식 확인 부탁드리겠습니다.
- 전제 조건 -
#1. 일봉 기준: 1봉전 상한가 or
#2. 일봉 기준: 2봉전 상한가 or
#3. 일봉 기준: 3봉전 상한가 or
#4. 일봉 기준: 4봉전 상한가 or
#5. 일봉 기준: 5봉전 상한가 or
#6. 일봉 기준: 6봉전 상한가가 한 번은 나와야 함.(즉 1봉전부터 6봉전까지 상한가가 한번 나와야 함)
그리고 일봉 기준 1봉전 일목균형표 기준선 가격이 20일 이동 평균 가격 보다 반드시 커야 함.
#매수조건: 60분봉에서 0봉과 181전봉사이의 가격중 가장 높은 가격과 가장 낮은 가격의 평균 가격에 0봉의 저가 OR 종가가 2%내로 근접했을 경우 다음 봉 시초가에 매수
#매도조건: 매수가격에 5% 이익이 났을 경우 매도
위와 조건에 부합하는 수식 확인 부탁드리겠습니다.
고맙습니다.
답변 1
예스스탁 예스스탁 답변
2014-02-24 17:57:10
안녕하세요
예스스탁입니다.
해당식 한가지 문제가 있습니다.
식으로 작성하면 아래와 같습니다.
다만 분봉에서 일간의 데이터가 차트의 첫번째 날 +99일만 제공이 됩니다.
현재 사용하시는 식에서는 당일포함182일치가 필요한데
너무 낮은 주기에서는 데이터가 부족하게 됩니다.
plot1(dayhigh(181));
위 지표를 적용해서 값이 출력이 되는 분봉 주기에서만 가능합니다.
주기설정에 유의하시기 바랍니다.
var : 상한가(0), UpLimit(0),maP(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
var : upcond(0),upcond1(0),upcond2(0),upcond3(0),upcond4(0),upcond5(0),upcond6(0);
var : 기준선(0),dayma(0),HH(0),LL(0),cnt(0),sum(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;
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{
UPcond = 0;
UPcond1 = UPcond[1];
UPcond2 = UPcond1[1];
UPcond3 = UPcond2[1];
UPcond4 = UPcond3[1];
UPcond5 = UPcond4[1];
UPcond6 = UPcond5[1];
}
if H >= 상한가 Then
UPcond = 1;
#일봉 전일 기준선 계산
HH = dayhigh(1);
LL = daylow(1);
for cnt = 1 to 26{
if DayHigh(cnt) > HH Then
HH = DayHigh(cnt);
if DayLow(cnt) < LL Then
LL = DayLow(cnt);
}
기준선 = (HH+LL)/2;
#일봉 전일 이평계산
sum = 0;
for cnt = 1 to 20{
sum = sum+DayClose(cnt);
}
dayma = sum/maP;
if dayhigh(181) > 0 and daylow(181) > 0 Then{
var1 = dayhigh(0);
var2 = DayLow(0);
for cnt = 0 to 181 {
if dayhigh(cnt) > var1 Then
var1 = dayhigh(cnt);
if DayLow(cnt) < var2 Then
var2 = DayLow(cnt);
}
var3 = (var1+var2)/2;
if upcond1+upcond2+upcond3+upcond4+upcond5+upcond6 >= 1 And
기준선 > dayma And
(CrossDown(L,var3*1.02) or CrossDown(C,var3*1.02)) Then
buy("b",AtMarket);
}
if MarketPosition == 1 Then
ExitLong("bx",AtStop,EntryPrice*0.95);
즐거운 하루되세요
> 아일랜드전설 님이 쓴 글입니다.
> 제목 : 수식 확인 부탁드리겠습니다.
> 안녕하세요.
다른 조건은 기존에 알려주신 수식과 동일하고 매수조건만 하기와 같이 변형 가능한지 확인 부탁 드리겠습니다.
#기존매수조건: 60분봉에서 0봉과 181전봉사이의 가격중 가장 높은 가격과 가장 낮은 가격의 평균 가격에 0봉의 저가 OR 종가가 2%내로 근접했을 경우 다음 봉 시초가에 매수
=>제가 원하는 것은 일봉상 조건에 부합했을 경우 그 순간에 매수가 들어가게 하고 싶습니다만 그 봉이 완성되어야 다음 봉 시초가에 매수 주문이 들어가는 것으로 알고 있기 때문에 분봉으로 매수 조건을 바꾸어서 일봉상 조건에 부합한 순간과 가장 가깝게 매수가 되는 환경을 만들고 싶습니다. 하지만 60분봉으로 만들어서 적용했더니 매수 조건과 실제 매수와의 괴리가 큰 것을 발견하였습니다. 따라서, 하기와 같이 변형을 해서 사용하고 싶은데 가능한지 확인 좀 부탁 드리겠습니다.
#1. 새로운 매수조건 옵션1: 일봉상 저가 또는 종가가 기준선 가격 2%내에 접근하였을 경우 1분봉에서 다음 봉 시초가에 매수
#2. 새로운 매수조건 옵션2: 1분봉에서 0봉과 9386전봉사이의 가격중 가장 높은 가격과 가장 낮은 가격의 평균 가격에 0봉의 저가 OR 종가가 2%내로 근접했을 경우 다음 봉 시초가에 매수
------------------------------------------------------------------------------------------------------------------------------------------
안녕하세요
예스스탁입니다.
var : 상한가(0), UpLimit(0),maP(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
var : upcond(0),upcond1(0),upcond2(0),upcond3(0),upcond4(0),upcond5(0),upcond6(0);
var : 기준선(0),dayma(0),HH(0),LL(0),cnt(0),sum(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;
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{
UPcond = 0;
UPcond1 = UPcond[1];
UPcond2 = UPcond1[1];
UPcond3 = UPcond2[1];
UPcond4 = UPcond3[1];
UPcond5 = UPcond4[1];
UPcond6 = UPcond5[1];
}
if H >= 상한가 Then
UPcond = 1;
#일봉 전일 기준선 계산
HH = dayhigh(1);
LL = daylow(1);
for cnt = 1 to 26{
if DayHigh(cnt) > HH Then
HH = DayHigh(cnt);
if DayLow(cnt) < LL Then
LL = DayLow(cnt);
}
기준선 = (HH+LL)/2;
#일봉 전일 이평계산
sum = 0;
for cnt = 1 to 20{
sum = sum+DayClose(cnt);
}
dayma = sum/maP;
var1 = highest(H,182);
var2 = lowest(L,182);
var3 = (var1+var2)/2;
if upcond1+upcond2+upcond3+upcond4+upcond5+upcond6 >= 1 And
기준선 > dayma And
(CrossDown(L,var2*1.02) or CrossDown(C,var2*1.02)) Then
buy("b",AtMarket);
if MarketPosition == 1 Then
ExitLong("bx",AtStop,EntryPrice*0.95);
즐거운 하루되세요
> 아일랜드전설 님이 쓴 글입니다.
> 제목 : 수식 확인 부탁드리겠습니다.
> 안녕하세요.
항상 도움에 감사드립니다.
하기와 같은 시스템 수식 확인 부탁드리겠습니다.
- 전제 조건 -
#1. 일봉 기준: 1봉전 상한가 or
#2. 일봉 기준: 2봉전 상한가 or
#3. 일봉 기준: 3봉전 상한가 or
#4. 일봉 기준: 4봉전 상한가 or
#5. 일봉 기준: 5봉전 상한가 or
#6. 일봉 기준: 6봉전 상한가가 한 번은 나와야 함.(즉 1봉전부터 6봉전까지 상한가가 한번 나와야 함)
그리고 일봉 기준 1봉전 일목균형표 기준선 가격이 20일 이동 평균 가격 보다 반드시 커야 함.
#매수조건: 60분봉에서 0봉과 181전봉사이의 가격중 가장 높은 가격과 가장 낮은 가격의 평균 가격에 0봉의 저가 OR 종가가 2%내로 근접했을 경우 다음 봉 시초가에 매수
#매도조건: 매수가격에 5% 이익이 났을 경우 매도
위와 조건에 부합하는 수식 확인 부탁드리겠습니다.
고맙습니다.