답변완료
수식 수정 의뢰드립니다!
안녕하세요!
아래 수식은 지난번에 만들어 주신 수식이고 현재 매매에 사용하고 있습니다.
다름이 아니라 수식을 좀 보강하여 매매에 도움을 받고 싶습니다!.
이해를 돕고져 참고 이미지 첨부 합니다!
항상 도움을 주셔서 감사드립니다!
Input:length(10),종가사용여부(0),파동선두께(2),수치표시(1);
Var:j(0),jj(0),HH(0),LL(0),최종고가(0),최종저가(0),최종꼭지점(""),처리구분(""),
TL1(0),Text1(0),text2(0),TL2(0);
Array:고[10,4](0),저[10,4](0); // 1:가격,2:Index,3:sDate,4:sTime
#==========================================#
HH = IFF(종가사용여부==1,C,H);
LL = IFF(종가사용여부==1,C,L);
If Index == 0 Then
{
고[1,1] = HH;
저[1,1] = LL;
}
Condition1 = Highest(HH,length) == HH and 최종고가 <> HH;
Condition2 = Lowest (LL,length) == LL and 최종저가 <> LL;
처리구분 = "";
If Condition1 and Condition2 Then // 기간고점과 기간저점 동시 발생
{
If 최종꼭지점 == "저점" Then
{
If 저[1,1] > LL Then 처리구분 = "저점처리";
Else 처리구분 = "고점처리";
}
Else If 최종꼭지점 == "고점" Then
{
If 고[1,1] < HH Then 처리구분 = "고점처리";
Else 처리구분 = "저점처리";
}
}
Else If Condition1 Then 처리구분 = "고점처리";
Else If Condition2 Then 처리구분 = "저점처리";
#==========================================#
If 처리구분 == "고점처리" Then
{
최종고가 = HH; // 신규고점을 체크하기 위해 저장
If 최종꼭지점 == "저점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
고[j,jj] = 고[j-1,jj];
}
}
고[1,1] = HH;
고[1,2] = Index;
고[1,3] = sDate;
고[1,4] = sTime;
// TL1 = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]);
var1 = 고[2,1]-저[1,1];
// TL2 = TL_New(저[1,3],저[1,4],저[1,1]-var1,sDate,sTime,저[1,1]-var1);
If 수치표시 == 1 Then
{
Text1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1],2));
Text_SetStyle(Text1, 2, 1);
Text2 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)+NewLine);
Text_SetStyle(Text2, 2, 1);
Text_SetColor(text2,RED);
}
TL_SetSize(TL1,파동선두께);
TL_SetColor(TL1,GREEN);
TL_SetSize(TL2,파동선두께);
TL_SetColor(TL2,BLUE);
}
Else If 고[1,1] < HH Then // 1번 고점보다 높은 고가 출현
{
고[1,1] = HH;
고[1,2] = Index;
고[1,3] = sDate;
고[1,4] = sTime;
TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]);
TL_SetEnd(TL2,고[1,3],고[1,4],저[1,1]-var1);
// 시작점은 변동없고 끝점의 위치가 현재 봉으로 연장된 것임
If 수치표시 == 1 Then
{
Text_SetLocation(Text1,고[1,3],고[1,4],고[1,1]);
Text_SetString(Text1,NumToStr(고[1,1],2));
Text_SetLocation(Text2,고[1,3],고[1,4],고[1,1]);
Text_SetString(Text2,NumToStr(고[1,1]-저[1,1],2)+NewLine);
}
}
최종꼭지점 = "고점";
}
#==========================================#
If 처리구분 == "저점처리" Then
{
최종저가 = LL;
If 최종꼭지점 == "고점" then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
저[j,jj] = 저[j-1,jj];
}
}
저[1,1] = LL;
저[1,2] = Index;
저[1,3] = sDate;
저[1,4] = sTime;
// TL1 = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]);
var1 = 고[1,1]-저[2,1];
// TL2 = TL_New(고[1,3],고[1,4],고[1,1]+var1,sDate,sTime,고[1,1]+var1);
If 수치표시 == 1 Then
{
Text1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1],2));
Text_SetStyle(Text1, 2, 0);
Text2 = Text_New(저[1,3],저[1,4],저[1,1],NewLine+NumToStr(저[1,1]-고[1,1],2));
Text_SetStyle(Text2, 2, 0);
Text_SetColor(text2,RED);
}
TL_SetSize(TL1,파동선두께);
TL_SetColor(TL1,GREEN);
TL_SetSize(TL2,파동선두께);
TL_SetColor(TL2,RED);
}
Else If 저[1,1] > LL then
{
저[1,1] = LL;
저[1,2] = Index;
저[1,3] = sDate;
저[1,4] = sTime;
TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]);
TL_SetEnd(TL2,저[1,3],저[1,4],고[1,1]+var1);
If 수치표시 == 1 Then
{
Text_SetLocation(Text1,저[1,3],저[1,4],저[1,1]);
Text_SetString(Text1,NumToStr(저[1,1],2));
Text_SetLocation(Text2,저[1,3],저[1,4],저[1,1]);
Text_SetString(Text2,NewLine+NumToStr(저[1,1]-고[1,1],2));
}
}
최종꼭지점 = "저점";
}
2021-10-20
962
글번호 153011
지표
답변완료
만든 지표에 대한 종목 검색 문의드립니다.
안녕하세요
일봉상 상한가 전날 일봉 종가에 가로선 표기 수식 질문을 드렸었는데요
알려주신 수식은 아래와 같습니다.
input : 금액(10000000);
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 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;
}
}
var : TL(0);
if C >= 상한가 Then
{
var1 = Index;
TL_Delete(TL);
TL = TL_New(sDate[1],sTime[1],C[1],sDate,sTime,C[1]);
TL_SetExtRight(TL,true);
TL_SetExtLeft(TL,true);
TL_SetColor(TL,GREEN);
}
Else
{
if var1 > 0 and Index > var1+60 Then
TL_Delete(TL);
}
현재의 일봉이 선(이미지 파일 초록색 선)의 가격 범위 +5% ~ -10% 에 위치하고 있는
종목을 검색하고 싶습니다.
2021-10-20
1373
글번호 153010
종목검색