답변완료
수식 질문합니다.
안녕하세요.
상한가 몸통의 중심을 이탈하는 종목을 검색하는 수식에서
상한가 발생 후 N봉내(초기값 10) 이탈하는 종목을 검색하는 수식을
아래처럼 만들어 봤습니다.
최근 상한가 외에도 이전 상한가 중심을 이탈하는 종목까지 검색되는데, 최근 상한가 중심선을 N봉내에 처음으로 이탈하는 종목만 검색하려면 어떻게 해야 하는지 궁금합니다.
-------------------------------------------------------
input: nbar(10);
var : 상한가(0), UpLimit(0);
var : up1(0), up2(0), up3(0), up4(0), up5(0),up6(0),Up7(0);
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 date >= 20230125 Then
{
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;
}
Else
{
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 date >= 20230125 Then
{
If BP >= 500000 Then
상한가 = up1;
Else If BP >= 200000 Then
상한가 = iff(up2>=500000, up1, up2);
Else If BP >= 50000 Then
상한가 = iff(up3>=200000, up2, up3);
Else If BP >= 20000 Then
상한가 = iff(up4>=50000, up3, up4);
Else If BP >= 5000 Then
상한가 = iff(up5>=20000, up4, up5);
Else If BP >= 2000 Then
상한가 = iff(up5>=5000, up5, up6);
Else
상한가 = iff(up6>=2000, up6, up7);
}
Else
{
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;
}
}
var : S(0);
if H >= 상한가 Then
{
S = (C+C[1])/2;
}
condition1= H >= 상한가;
condition2 = S > 0 and C < O and CrossDown(C,S);
if CountIf(condition1,nbar)>1 and CountIf(condition1,nbar)<=10 and condition2==true Then
Find(1);
2023-12-28
724
글번호 175299
종목검색
답변완료
수식 요청 드립니다.
주신식을 현재 선물 차트에 그대로 적용한 결과인데요.
9시 종가인 356.10을 기준으로 위아래 같은 갭으로 선이 그어져야 하는데
화면을 보면 9시 5분봉 종가인 355.50을 기준으로 그려지는거 같습니다.
제가 무슨 설정을 잘못 한건지 해결 부탁드립니다.
-----------------------------------------------------------------------
안녕하세요
예스스탁입니다.
9시봉 종가기준으로 변경해 드립니다.
Input : mult(0.75);
var : hh(0),ll(0),hh1(0),ll1(0),oo(0),cc(0);
if (sdate != sdate[1] and stime >= 90000) or
(sdate == sdate[1] and stime >= 90000 and stime[1] < 90000) Then
{
oo = o;
cc = c;
hh = h;
ll = l;
hh1 = hh[1];
ll1 = ll[1];
}
if sTime >= 90000 Then
{
if h > hh Then
hh = h;
if l < ll Then
ll = l;
}
if hh1 > 0 and ll1 > 0 Then
{
var1 = (hh1 - ll1)*mult;
plot1(cc+var1);
plot2(cc-var1);
}
새해 복 많이 받으세요
> mizz 님이 쓴 글입니다.
> 제목 : 수식 요청 드립니다.
> 아래 답변을 받았는데 적용해보니
분봉이 바뀔 때마다 수치가 살짝식 바뀝니다.
5분봉 사용중인데 5분봉 9시 종가를 수식에 맞출 수 있을까요?
5분봉의 종가 딱 9시 가격이 기준이도록 부탁 드립니다.
-----------------------------------------------------------------
안녕하세요
예스스탁입니다.
Input : mult(0.75);
var : hh(0),ll(0),hh1(0),ll1(0),oo(0);
if (sdate != sdate[1] and stime >= 90000) or
(sdate == sdate[1] and stime >= 90000 and stime[1] < 90000) Then
{
oo = o;
hh = h;
ll = l;
hh1 = hh[1];
ll1 = ll[1];
}
if sTime >= 90000 Then
{
if h > hh Then
hh = h;
if l < ll Then
ll = l;
}
if hh1 > 0 and ll1 > 0 Then
{
var1 = (hh1 - ll1)*mult;
plot1(oo+var1);
plot2(oo-var1);
}
즐거운 하루되세요
> mizz 님이 쓴 글입니다.
> 제목 : 수식 요청 드립니다.
> Input : mult(0.75);
var1 = (DayHigh(1) - DayLow(1))*mult;
plot1(dayopen+var1);
plot2(dayopen-var1);
위에 수식에서 데이오픈이 9시였던게 8시 45분으로 장 시작 시간이 바뀌면서
여러가지가 변해 수식의 시작 시간을 9시로 만들고 싶습니다.
뭘 바꿔야 하는지 답변 부탁드립니다.
2023-12-28
937
글번호 175280
지표