예스스탁
예스스탁 답변
2022-07-12 10:31:27
안녕하세요
예스스탁입니다.
기존식이 상한가체크기간과 이평기간이 같았습니다.
이평기간을 별도로 설정하게 수정해 드립니다.
input : P(20),이평기간(5);
var : cnt(0),sum1(0),mav1(0),sum2(0),mav2(0),t(0),count(0);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
Array : 상[100](False);
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
상한가 = 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 Bdate != Bdate[1] Then
{
For cnt = 99 DownTo 1
{
상[cnt] = 상[cnt-1];
}
}
if C == 상한가 Then
상[0] = true;
Else
상[0] = False;
count = 0;
For cnt = 0 to P-1
{
if 상[cnt] == true Then
count = count+1;
}
sum1 = 0;
sum2 = NextBarOpen;
For cnt = 0 to 이평기간-1
{
sum1 = sum1 + DayClose(cnt);
if cnt < P-1 Then
sum2 = sum2 + DayClose(cnt);
}
mav1 = sum1/이평기간;
mav2 = sum2/이평기간;
if NextBarSdate != sDate Then
{
T = 0;
if C <= mav1*1.05 and C >= mav1*0.95 and count >= 1 Then
{
T = 1;
if NextBarOpen < mav2 Then
{
T = 2;
Buy("b11",AtMarket);
}
Else
{
T = 3;
Buy("b12",AtLimit,mav2);
}
}
Condition1 = False;
}
Else
{
if L <= mav1 Then
Condition1 = true;
if Condition1 == False and T == 3 Then
Buy("b2",AtLimit,mav2);
}
SetStopEndofday(151800);
SetStopLoss(5,PercentStop);
즐거운 하루되세요
> 대한이 님이 쓴 글입니다.
> 제목 : 수식 수정 부탁드립니다.
> 안녕하십니까
수식 수정 부탁드립니다.
--------------------------------------------------------------
input : P(20);
var : cnt(0),sum1(0),mav1(0),sum2(0),mav2(0),t(0),count(0);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
Array : 상[100](False);
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
상한가 = 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 Bdate != Bdate[1] Then
{
For cnt = 99 DownTo 1
{
상[cnt] = 상[cnt-1];
}
}
if C == 상한가 Then
상[0] = true;
Else
상[0] = False;
sum1 = 0;
sum2 = NextBarOpen;
count = 0;
For cnt = 0 to P-1
{
sum1 = sum1 + DayClose(cnt);
if cnt < P-1 Then
sum2 = sum2 + DayClose(cnt);
if 상[cnt] == true Then
count = count+1;
}
mav1 = sum1/P;
mav2 = sum2/P;
if NextBarSdate != sDate Then
{
T = 0;
if C <= mav1*1.05 and C >= mav1*0.95 and count >= 1 Then
{
T = 1;
if NextBarOpen < mav2 Then
{
T = 2;
Buy("b11",AtMarket);
}
Else
{
T = 3;
Buy("b12",AtLimit,mav2);
}
}
Condition1 = False;
}
Else
{
if L <= mav1 Then
Condition1 = true;
if Condition1 == False and T == 3 Then
Buy("b2",AtLimit,mav2);
}
SetStopEndofday(151800);
SetStopLoss(5,PercentStop);
현재 조건
#ㅇ 매수
# 1. 최근 20거래일 중 종가 상한가
# 2. 일봉 상 가격 형성이 20일선 기준 +-5% 이내
# 3. 당일 시가가 일봉기준 20일선 위에서 시작하면 20일 평균가격으로 매수 주문
# (가격을 지정하여 매수 주문이 불가능 하면, 당일 일봉 상 20일 평균가격에 닿거나 하향하면 바로 매수)
# 4. 당일 시가가 일봉기준 20일선 아래에 위치하면 시가로 매수 주문
#매수 주문은 시가가 전일종가 대비 +-20 이내에서 형성될때만 나갈수있게 부탁드립니다.
#ㅇ 매도
#오후 3시 18분 전량매도
수정요청
위 조건 중 기준선 을 5일, 10일 선으로 각각 수정부탁드립니다.
잘 부탁드립니다.
감사합니다.