커뮤니티
재질문 드립니다...
2013-03-05 02:03:30
203
글번호 60188
제가 설명이 좀 모자랐나보네요...
진입한 이후..
상승하여 수익(신호발생대비) 5%에 한번 도달하고...
하락했다가 다시 상승하여 5~6% 사이까지 갔다가...
고점대비 2% 하락하면 전량매도... 입니다...
일봉 기준입니다...
질문이 하나 늘었습니다...
1. if //ma(c,20)>ma(c,60) and
2. h[1]*1.02 < dayopen Then
3. {
4. buy("갭상승",AtStop,dayopen,def);
5. }
6.
7. /*if //crossup(c,dayopen*1.05) or
8. stime == 143000 Then
9. exitlong();*/
10.
11. //SetStopProfittarget(5,PercentStop);
12.
13. //setstoploss(0, PercentStop);
14.
15. SetStopEndofday(143000);
위와같은 식을 테스트 해보았는데...(예트 4.0 버전입니다)
제가 의도한건 전일 고가대비 시가가 2%이상 갭상승 출발시 시가 진입이구요...
수익 5% 도달시 매도... 또는 당일 오후 2시 30분 매도... 인데요...
진입 시점도 다르게 나오구요...
8번줄도 (물론 주석해재하고) 실행이 안되구요...
15번줄도 실행이 안되네요...
그리고 시가 진입일때 7번줄과 11번줄은 결과가 거의 같아야하지 않나요??
많이 다르군요... ㅡ.ㅡ; 왜그런지요...
그리고 상한가 청산은 어떻게 표현하는지요...
역시 초보의 길은 멀고도 험하군요.. ㅜㅜ
식 부탁드립니다...
수고하시구요~ ^^
답변 1
예스스탁 예스스탁 답변
2013-03-05 14:00:35
안녕하세요
예스스탁입니다.
1.
if MarketPosition == 1 and
highest(H,BarsSinceEntry) >= EntryPrice*1.05 and
countif(crossup(H,EntryPrice*1.05),BarsSinceEntry) >= 2 Then
exitlong("bx",AtStop,highest(H,BarsSinceEntry)*0.98);
2.
당일청산을 하시기 위해서는 분봉차트에 적용하셔야 합니다.
일봉차트에는 시간청산이 가능하지 않습니다.
시초가 수신시에 즉시 신호가 발생하게 하려면
전일 마지막봉이 완성될때(당일시초가 수신될때 조건판단하고
신호발생하게 해야 합니다. 다만 해당식의 문제점은 당일 마지막봉을 인식할 수단이
시간뿐이 없는데 시간으로 지정하면 거래가 많이 얺는 종목은 해당시간의
봉이 생기지 않을 위험이 있다는 부분입니다.
식을 2개 올려드립니다.
1번식은 만약 거래가 많이 없어 15시 봉이 생기지 않으면 신호가 발생하지 않는
위험이 있지만 정상적으로 15시 봉이 생성되면 당일시초가 수신시에
즉시 신호가 발생할수 있습니다.
2번식은 당일 첫봉완성시에 신호가 발생하게 하는 식입니다.
1번식과 같은 위험은 없지만 시초가 수신될때 즉시 주문이 나가는 것은 아니고
첫봉 완성시에 발생하게 됩니다.
두식 모두 1분봉 기준입니다.
var : 하한가(0), DnLimit(0);
var : dn1(0), dn2(0), dn3(0), dn4(0), dn5(0),dn6(0);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0);
if date >= 19981207 then { //거래소 98년 12월7일 가격제한폭 15%로 확대 변경됨
if date < 20050328 && CodeCategory() == 2 then //코스닥 2005년 3월28일 이전은 가격제한폭 12%
DnLimit = (BP * 0.12);
Else //코스닥 2005년 3월28일 이후 및 거래소98년12월 7일이후 15%
DnLimit = (BP * 0.15);
if CodeCategory() == 2 then { //코스닥 호가단위 ( 2003년 7월21일에 호가 단위 변경됨)
if date >= 20030721 then {
dn1 = int(DnLimit/100)*100; // 500,000원 이상의 하한가 호가
dn2 = int(DnLimit/100)*100; // 100,000원 이상 ~ 500,000원 미만의 하한가 호가
dn3 = int(DnLimit/100)*100; // 50,000원 이상 ~ 100,000원 미만의 하한가 호가
dn4 = int(DnLimit/50)*50; // 10,000원 이상 ~ 50,000원 미만의 하한가 호가
dn5 = int(DnLimit/10)*10; // 5,000원 이상 ~ 10,000원 미만의 하한가 호가
dn6 = int(DnLimit/5)*5; // 5,000원 미만의 하한가 호가
}
else { // 코스닥 2003년7월21일 이전
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;
}
}
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;
}
if CodeCategory() == 1 or CodeCategory() == 2 then { //kospi, kosdaq
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
하한가 = BP-dn6;
}
else if CodeCategory() == 8 or CodeCategory() == 9 then { //ETF
하한가 = 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;
}
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 stime == 150000 and
NextBarOpen >= dayhigh*1.02 Then
buy("b",AtMarket);
if MarketPosition == 1 Then
ExitLong("bx",Atlimit,상한가);
SetStopProfittarget(5,PercentStop);
SetStopEndofday(143000);
2번식
var : 하한가(0), DnLimit(0);
var : dn1(0), dn2(0), dn3(0), dn4(0), dn5(0),dn6(0);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0);
if date >= 19981207 then { //거래소 98년 12월7일 가격제한폭 15%로 확대 변경됨
if date < 20050328 && CodeCategory() == 2 then //코스닥 2005년 3월28일 이전은 가격제한폭 12%
DnLimit = (BP * 0.12);
Else //코스닥 2005년 3월28일 이후 및 거래소98년12월 7일이후 15%
DnLimit = (BP * 0.15);
if CodeCategory() == 2 then { //코스닥 호가단위 ( 2003년 7월21일에 호가 단위 변경됨)
if date >= 20030721 then {
dn1 = int(DnLimit/100)*100; // 500,000원 이상의 하한가 호가
dn2 = int(DnLimit/100)*100; // 100,000원 이상 ~ 500,000원 미만의 하한가 호가
dn3 = int(DnLimit/100)*100; // 50,000원 이상 ~ 100,000원 미만의 하한가 호가
dn4 = int(DnLimit/50)*50; // 10,000원 이상 ~ 50,000원 미만의 하한가 호가
dn5 = int(DnLimit/10)*10; // 5,000원 이상 ~ 10,000원 미만의 하한가 호가
dn6 = int(DnLimit/5)*5; // 5,000원 미만의 하한가 호가
}
else { // 코스닥 2003년7월21일 이전
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;
}
}
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;
}
if CodeCategory() == 1 or CodeCategory() == 2 then { //kospi, kosdaq
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
하한가 = BP-dn6;
}
else if CodeCategory() == 8 or CodeCategory() == 9 then { //ETF
하한가 = 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;
}
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 dayindex == 0 and
DayOpen >= dayhigh(1)*1.02 Then
buy("b");
if MarketPosition == 1 Then
ExitLong("bx",Atlimit,상한가);
SetStopProfittarget(5,PercentStop);
SetStopEndofday(143000);
즐거운 하루되세요
> 깽알신랑 님이 쓴 글입니다.
> 제목 : 재질문 드립니다...
> 제가 설명이 좀 모자랐나보네요...
진입한 이후..
상승하여 수익(신호발생대비) 5%에 한번 도달하고...
하락했다가 다시 상승하여 5~6% 사이까지 갔다가...
고점대비 2% 하락하면 전량매도... 입니다...
일봉 기준입니다...
질문이 하나 늘었습니다...
1. if //ma(c,20)>ma(c,60) and
2. h[1]*1.02 < dayopen Then
3. {
4. buy("갭상승",AtStop,dayopen,def);
5. }
6.
7. /*if //crossup(c,dayopen*1.05) or
8. stime == 143000 Then
9. exitlong();*/
10.
11. //SetStopProfittarget(5,PercentStop);
12.
13. //setstoploss(0, PercentStop);
14.
15. SetStopEndofday(143000);
위와같은 식을 테스트 해보았는데...(예트 4.0 버전입니다)
제가 의도한건 전일 고가대비 시가가 2%이상 갭상승 출발시 시가 진입이구요...
수익 5% 도달시 매도... 또는 당일 오후 2시 30분 매도... 인데요...
진입 시점도 다르게 나오구요...
8번줄도 (물론 주석해재하고) 실행이 안되구요...
15번줄도 실행이 안되네요...
그리고 시가 진입일때 7번줄과 11번줄은 결과가 거의 같아야하지 않나요??
많이 다르군요... ㅡ.ㅡ; 왜그런지요...
그리고 상한가 청산은 어떻게 표현하는지요...
역시 초보의 길은 멀고도 험하군요.. ㅜㅜ
식 부탁드립니다...
수고하시구요~ ^^