커뮤니티

문의 드립니다

프로필 이미지
러블리
2026-07-06 13:09:22
104
글번호 232690
답변완료

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


          }


       }


       최종꼭지점 = "저점";


    }  


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


위수식에서 length 대신 %를 넣을수 있을가요?

length  기준이 아니라 몇% 움직임을 기준으로 결과수치가 나오게..

예를들어 1% 상승하면 결과수치를 표시

1% 하락하면 결과수치를 표시..


감사합니다

지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-07-06 15:55:19

안녕하세요 예스스탁입니다. Input:Per(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 = HH >= 저[1,1]*(1+Per/100); Condition2 = LL <= 고[1,1]*(1-Per/100); 처리구분 = ""; 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)); } } 최종꼭지점 = "저점"; } 즐거운 하루되세요