커뮤니티

문의 드립니다

프로필 이미지
러블리
2026-05-07 16:37:59
81
글번호 231937
답변완료


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);

Text_Setbold(text1,1);

Text_SetSize(text2,13);


}


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_SetColor(text1,Red);



Text_SetString(Text1,NumToStr(고[1,1],2));


Text_SetLocation(Text2,고[1,3],고[1,4],고[1,1]);

Text_SetColor(text2,Red);

Text_Setbold(text1,1);

Text_SetSize(text2,12);



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, -1);


Text_SetColor(text2,Black);

Text_Setbold(text1,1);

Text_SetSize(text2,13);


}


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_SetColor(text1,Black);



Text_SetString(Text1,NumToStr(저[1,1],2));


Text_SetLocation(Text2,저[1,3],저[1,4],저[1,1]);

Text_SetColor(text2,Black);

Text_Setbold(text1,1);

Text_SetSize(text2,12);



Text_SetString(Text2,NewLine+NumToStr(저[1,1]-고[1,1],2));


}


}


최종꼭지점 = "저점";


}


-------------


위수식에서 고점, 저점이 텍스트로 표시되면 그 지점에 세로선이 나오게 하고 싶은데 가능할까요?

고점, 저점이 계속 갱신되면 갱신되는 대로 세로선이 나오다가 다시 갱신되지 않으면 최종 세로선이 그어지게 합니다


고점세로선 과 저점 세로선 색상은 구별가능하게 지정할수 있음 좋겠습니다

감사합니다

지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-05-08 08:47:12

안녕하세요 예스스탁입니다. 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 var : vtl1(0),vtl2(0); #==========================================# 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); vtl1 = TL_New(sDate,sTime,0,sDate,sTime,999999999); TL_SetColor(vtl1,Red); TL_SetSize(vtl1,1); 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); Text_Setbold(text1,1); Text_SetSize(text2,13); } 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); TL_SetBegin(vTL1,sDate,sTime,0); TL_SetEnd(vTL1,sDate,sTime,999999999); // 시작점은 변동없고 끝점의 위치가 현재 봉으로 연장된 것임 If 수치표시 == 1 Then { Text_SetLocation(Text1,고[1,3],고[1,4],고[1,1]); Text_SetColor(text1,Red); Text_SetString(Text1,NumToStr(고[1,1],2)); Text_SetLocation(Text2,고[1,3],고[1,4],고[1,1]); Text_SetColor(text2,Red); Text_Setbold(text1,1); Text_SetSize(text2,12); 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); vtl2 = TL_New(sDate,sTime,0,sDate,sTime,999999999); TL_SetColor(vtl2,Blue); TL_SetSize(vtl2,1); 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, -1); Text_SetColor(text2,Black); Text_Setbold(text1,1); Text_SetSize(text2,13); } 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); TL_SetBegin(vTL2,sDate,sTime,0); TL_SetEnd(vTL2,sDate,sTime,999999); If 수치표시 == 1 Then { Text_SetLocation(Text1,저[1,3],저[1,4],저[1,1]); Text_SetColor(text1,Black); Text_SetString(Text1,NumToStr(저[1,1],2)); Text_SetLocation(Text2,저[1,3],저[1,4],저[1,1]); Text_SetColor(text2,Black); Text_Setbold(text1,1); Text_SetSize(text2,12); Text_SetString(Text2,NewLine+NumToStr(저[1,1]-고[1,1],2)); } } 최종꼭지점 = "저점"; } 즐거운 하루되세요