커뮤니티

중심선 좀 부탁 드립니다.

프로필 이미지
요타
2026-05-07 06:57:27
76
글번호 231913
답변완료

image.png


ㅇ 항상 많은 도움 고맙습니다.

ㅇ 아래 수식에서 중심선 좀 부탁 드립니다. (수직선 포함)

ㅇ 중심선은 다음 지그재그선 까지  요청 드림니다.(그림  "중심선 연장")

  → 중심선은 최소 20봉 이상

ㅇ 중심선이 출력 될때 소리음도 부탁 드림니다. PlaySound("C:\CyberOrO\Wav\3\tl4.wav");


##





input:length(12);

Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0),처리구분(""),

     TL_Val1(0),TL_Val2(0),Year(0),month(0),nday(0);

Array:고점[10,2](0),저점[10,2](0);



Year = Floor(bDate / 10000);

month = Floor(FracPortion(bdate/10000)*100);

nday = date - int(date/100)*100;


처리구분 = "";

If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then

{   

    If 저점[1,1] > L Then 처리구분 = "저점처리";

    If 고점[1,1] < H Then 처리구분 = "고점처리";

}   

Else If Highest(H,length) == H and lastHiVal <> H Then 처리구분 = "고점처리";

Else If Lowest(L,length) == L and lastLoVal <> L  Then 처리구분 = "저점처리";

  

If 처리구분 == "고점처리" Then

{

    lastHiVal = H;

    If 고점[1,2] < 저점[1,2] Then

    {

       For j = 10 DownTo 2

       {

           고점[j,1] = 고점[j-1,1];

           고점[j,2] = 고점[j-1,2];

       }

    }

    If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then

    {

       고점[1,1] = H;

       고점[1,2] = Index;

       sBar = Index - 저점[1,2];

       eBar = 0;

       If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then

       {

          TL_Delete(TL1);

          Text_Delete(Text1);

          If 고점[3,1][1] < 고점[2,1][1] and 고점[2,1][1] > 고점[1,1][1] and 저점[2,1][1] < 저점[1,1][1] Then

             TL_Delete(TL2);

       }

       TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);

       Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1]),2)+

"("+NumToStr((고점[1,1]-저점[1,1])/저점[1,1]*100,2)+"%)"+

NewLine+NumToStr(고점[1,1],2)+

NewLine+NumToStr(year[eBar],0)+"/"+NumToStr(month[eBar],0)+"/"+NumToStr(nday[eBar],0));


       Text_SetStyle(Text1, 2, 1);


      // If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then

//       {

//          sBar = Index - 저점[2,2];

//          eBar = Index - 저점[1,2];

//          TL2 = TL_New(sDate[sBar],sTime[sBar],저점[2,1],sDate[eBar],sTime[eBar],저점[1,1]);

//          TL_SetColor(TL2,BLUE);

//       }

    }

}


If 처리구분 == "저점처리" Then

{

    lastLoVal = L;

    If 저점[1,2] < 고점[1,2] Then

    {

       For j = 10 DownTo 2

       {

           저점[j,1] = 저점[j-1,1];

           저점[j,2] = 저점[j-1,2];

       }

    }

    If 저점[1,2] < 고점[1,2] or 저점[1,1] > L Then

    {

       저점[1,1] = L;

       저점[1,2] = Index;

       sBar = Index - 고점[1,2];

       eBar = 0;

       If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then

       {

          TL_Delete(TL1);

          Text_Delete(Text1);

          If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1] > 고점[1,1][1] Then

             TL_Delete(TL3);

       }

       TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);

     //  Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1]),2)+

// "("+NumToStr((저점[1,1]-고점[1,1])/고점[1,1]*100,2)+"%)"+

// NewLine+NumToStr(저점[1,1],2)+

// NewLine+NumToStr(year[eBar],0)+"/"+NumToStr(month[eBar],0)+"/"+NumToStr(nday[eBar],0));

//       Text_SetStyle(Text1, 2, 0);


       If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then

       {

          sBar = Index - 고점[2,2];

          eBar = Index - 고점[1,2];

          TL3 = TL_New(sDate[sBar],sTime[sBar],고점[2,1],sDate[eBar],sTime[eBar],고점[1,1]);

          TL_SetColor(TL3,RED);

       }

    }

}

TL_SetSize(TL1,1);  

TL_SetColor(TL1,Rgb(255,0,0));

TL_SetSize(TL2,1);

TL_SetSize(TL3,1);





ㅇ 고맙 습니다.




지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2026-05-07 13:09:52

안녕하세요 예스스탁입니다.

"중심선은 최소 20봉 이상"

고점 저점 사이가 최소 20봉 이상인 것만 중심선을 그리게 작성해 드립니다. input:length(12); Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),TL3(0),Text1(0),처리구분(""), TL_Val1(0),TL_Val2(0),Year(0),month(0),nday(0),vtl1(0),vtl2(0),htl1(0),htl2(0); Array:고점[10,2](0),저점[10,2](0); Year = Floor(bDate / 10000); month = Floor(FracPortion(bdate/10000)*100); nday = date - int(date/100)*100; 처리구분 = ""; If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then { If 저점[1,1] > L Then 처리구분 = "저점처리"; If 고점[1,1] < H Then 처리구분 = "고점처리"; } Else If Highest(H,length) == H and lastHiVal <> H Then 처리구분 = "고점처리"; Else If Lowest(L,length) == L and lastLoVal <> L Then 처리구분 = "저점처리"; If 처리구분 == "고점처리" Then { lastHiVal = H; If 고점[1,2] < 저점[1,2] Then { For j = 10 DownTo 2 { 고점[j,1] = 고점[j-1,1]; 고점[j,2] = 고점[j-1,2]; } } If 고점[1,2] < 저점[1,2] or 고점[1,1] < H Then { 고점[1,1] = H; 고점[1,2] = Index; sBar = Index - 저점[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); If 고점[3,1][1] < 고점[2,1][1] and 고점[2,1][1] > 고점[1,1][1] and 저점[2,1][1] < 저점[1,1][1] Then TL_Delete(TL2); TL_Delete(vtl1); if var1 > 0 Then TL_Delete(htl1); } TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(abs(고점[1,1]-저점[1,1]),2)+ "("+NumToStr((고점[1,1]-저점[1,1])/저점[1,1]*100,2)+"%)"+ NewLine+NumToStr(고점[1,1],2)+ NewLine+NumToStr(year[eBar],0)+"/"+NumToStr(month[eBar],0)+"/"+NumToStr(nday[eBar],0)); Text_SetStyle(Text1, 2, 1); // If 고점[3,1] < 고점[2,1] and 고점[2,1] > 고점[1,1] and 저점[2,1] < 저점[1,1] Then //{ //sBar = Index - 저점[2,2]; //eBar = Index - 저점[1,2]; //TL2 = TL_New(sDate[sBar],sTime[sBar],저점[2,1],sDate[eBar],sTime[eBar],저점[1,1]); //TL_SetColor(TL2,BLUE); //} vtl1 = TL_New(sDate,sTime,0,sDate,sTime,9999999999); TL_SetColor(vtl1,Lime); TL_SetSize(vtl1,1); var1 = (고점[1,1]+저점[1,1])/2; if 고점[1,2] >= 저점[1,2]+20 Then { htl1 = TL_New(sDate[Index-저점[1,2]],sTime[Index-저점[1,2]],var1,sDate,sTime,var1); TL_SetColor(htl1,Blue); TL_SetSize(htl1,1); PlaySound("C:\CyberOrO\Wav\3\tl4.wav"); } Else var1 = 0; } if var2 > 0 Then TL_SetEnd(htl2,sDate,sTime,var2); } If 처리구분 == "저점처리" Then { lastLoVal = L; If 저점[1,2] < 고점[1,2] Then { For j = 10 DownTo 2 { 저점[j,1] = 저점[j-1,1]; 저점[j,2] = 저점[j-1,2]; } } If 저점[1,2] < 고점[1,2] or 저점[1,1] > L Then { 저점[1,1] = L; 저점[1,2] = Index; sBar = Index - 고점[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); If 저점[2,1][1] < 저점[1,1][1] and 저점[2,1][1] < 저점[3,1][1] and 고점[2,1][1] > 고점[1,1][1] Then TL_Delete(TL3); TL_Delete(vtl2); if var2 > 0 Then TL_Delete(htl2); } TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]); //Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(abs(고점[1,1]-저점[1,1]),2)+ // "("+NumToStr((저점[1,1]-고점[1,1])/고점[1,1]*100,2)+"%)"+ // NewLine+NumToStr(저점[1,1],2)+ // NewLine+NumToStr(year[eBar],0)+"/"+NumToStr(month[eBar],0)+"/"+NumToStr(nday[eBar],0)); //Text_SetStyle(Text1, 2, 0); If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 고점[2,1] > 고점[1,1] Then { sBar = Index - 고점[2,2]; eBar = Index - 고점[1,2]; TL3 = TL_New(sDate[sBar],sTime[sBar],고점[2,1],sDate[eBar],sTime[eBar],고점[1,1]); TL_SetColor(TL3,RED); } vtl2 = TL_New(sDate,sTime,0,sDate,sTime,9999999999); TL_SetColor(vtl2,Lime); TL_SetSize(vtl2,1); var2 = (고점[1,1]+저점[1,1])/2; if 저점[1,2] >= 고점[1,2]+20 Then { htl2 = TL_New(sDate[Index-고점[1,2]],sTime[Index-고점[1,2]],var2,sDate,sTime,var2); TL_SetColor(htl2,Blue); TL_SetSize(htl2,1); PlaySound("C:\CyberOrO\Wav\3\tl4.wav"); } Else var2 = 0; } if var1 > 0 Then TL_SetEnd(htl1,sDate,sTime,var1); } TL_SetSize(TL1,1); TL_SetColor(TL1,Rgb(255,0,0)); TL_SetSize(TL2,1); TL_SetSize(TL3,1); 즐거운 하루되세요