커뮤니티

전환 비율

프로필 이미지
고성
2023-03-23 11:08:36
1320
글번호 167434
답변완료
Input : 전환(0.2),굵기(3); Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""), TL1(0),TX1(0); Array:고[10,4](0),저[10,4](0); Plot1(0); HH = H; LL = L; If Index == 0 Then { 고[1,1] = HH; 고[1,2] = 0; 고[1,3] = sDate; 고[1,4] = sTime; 저[1,1] = LL; 저[1,2] = 0; 저[1,3] = sDate; 저[1,4] = sTime; } If Index > 0 Then { hiBar = hiBar + 1; loBar = loBar + 1; } If HH[hiBar] < HH Then hiBar = 0; If LL[loBar] > LL Then loBar = 0; Condition1 = 저[1,1]+전환 <= HH and hiBar == 0; Condition2 = 고[1,1]-전환 >= LL and loBar == 0; 처리구분 = ""; 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 { If 최종꼭지점 == "저점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 고[j,jj] = 고[j-1,jj]; } } 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL1 = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,RED); TX1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Red); Text_SetStyle(tx1,1,1); Text_SetBold(tx1,1); } Else If 고[1,1] < HH[hiBar] Then // 1번 고점보다 높은 고가 출현 { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]); Text_SetString(TX1,NumToStr(고[1,1]-저[1,1],2)); Text_SetLocation(TX1,고[1,3],고[1,4],고[1,1]); } 최종꼭지점 = "고점"; } If 처리구분 == "저점처리" Then { If 최종꼭지점 == "고점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 저[j,jj] = 저[j-1,jj]; } } 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL1 = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,BLUE); TX1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1]-고[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Blue); Text_SetStyle(tx1,1,0); Text_SetBold(tx1,1); } Else If 저[1,1] > LL[loBar] Then { 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]); Text_SetString(TX1,NumToStr(저[1,1]-고[1,1],2)); Text_SetLocation(TX1,저[1,3],저[1,4],저[1,1]); } 최종꼭지점 = "저점"; } a.차트 쪽 추세선을 보조지표 쪽으로 이동. b.하락추세선 크기가 0.5p 이상 커지면 그 부분만 같은 크기로 박스 표시. c.추세선을 plot화 하여 직선이 아닌 계단식으로 구현. 감사합니다.
지표
답변 3
프로필 이미지

예스스탁 예스스탁 답변

2023-03-23 11:28:49

안녕하세요 예스스탁입니다. TL_new, Text_new 추세선과 텍스트를 출력하는 함수 중 위 함수는 기본차트 위에 추세선과 텍스트가 출력됩니다. 아래 함수로 작성하시면 수식 적용영역에 출력이 됩니다. TL_new_self ,Text_new_self plot은 현재봉 기준 과거지점부터 그릴수 없습니다. 최초 출력이 고점이나 저점으로 전환된 첫봉입니다. 이전 저점이나 고점부터 연결되게 작성 불가합니다. Input : 전환(0.2),굵기(3); Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""), TL1(0),TX1(0); Array:고[10,4](0),저[10,4](0); var : box(0),BB(False); HH = H; LL = L; If Index == 0 Then { 고[1,1] = HH; 고[1,2] = 0; 고[1,3] = sDate; 고[1,4] = sTime; 저[1,1] = LL; 저[1,2] = 0; 저[1,3] = sDate; 저[1,4] = sTime; } If Index > 0 Then { hiBar = hiBar + 1; loBar = loBar + 1; } If HH[hiBar] < HH Then hiBar = 0; If LL[loBar] > LL Then loBar = 0; Condition1 = 저[1,1]+전환 <= HH and hiBar == 0; Condition2 = 고[1,1]-전환 >= LL and loBar == 0; 처리구분 = ""; 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 { If 최종꼭지점 == "저점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 고[j,jj] = 고[j-1,jj]; } } 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL1 = TL_New_Self(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,RED); TX1 = Text_New_Self(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Red); Text_SetStyle(tx1,1,1); Text_SetBold(tx1,1); } Else If 고[1,1] < HH[hiBar] Then // 1번 고점보다 높은 고가 출현 { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]); Text_SetString(TX1,NumToStr(고[1,1]-저[1,1],2)); Text_SetLocation(TX1,고[1,3],고[1,4],고[1,1]); } 최종꼭지점 = "고점"; Plot1(고[1,1]); NoPlot(2); } If 처리구분 == "저점처리" Then { If 최종꼭지점 == "고점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 저[j,jj] = 저[j-1,jj]; } } 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL1 = TL_New_Self(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,BLUE); TX1 = Text_New_Self(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1]-고[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Blue); Text_SetStyle(tx1,1,0); Text_SetBold(tx1,1); bb = False; if bb == False and 저[1,1] <= 고[1,1]-0.5 and 고[1,1] > 0 Then { bb= true; box = Box_New_Self(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); Box_SetColor(box,Blue); } } Else If 저[1,1] > LL[loBar] Then { 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]); Text_SetString(TX1,NumToStr(저[1,1]-고[1,1],2)); Text_SetLocation(TX1,저[1,3],저[1,4],저[1,1]); if bb == true Then Box_SetEnd(box,저[1,3],저[1,4],저[1,1]); Else { bb= true; box = Box_New_Self(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); Box_SetColor(box,Blue); } } 최종꼭지점 = "저점"; Plot2(저[1,1]); NoPlot(1); } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : 전환 비율 > Input : 전환(0.2),굵기(3); Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""), TL1(0),TX1(0); Array:고[10,4](0),저[10,4](0); Plot1(0); HH = H; LL = L; If Index == 0 Then { 고[1,1] = HH; 고[1,2] = 0; 고[1,3] = sDate; 고[1,4] = sTime; 저[1,1] = LL; 저[1,2] = 0; 저[1,3] = sDate; 저[1,4] = sTime; } If Index > 0 Then { hiBar = hiBar + 1; loBar = loBar + 1; } If HH[hiBar] < HH Then hiBar = 0; If LL[loBar] > LL Then loBar = 0; Condition1 = 저[1,1]+전환 <= HH and hiBar == 0; Condition2 = 고[1,1]-전환 >= LL and loBar == 0; 처리구분 = ""; 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 { If 최종꼭지점 == "저점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 고[j,jj] = 고[j-1,jj]; } } 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL1 = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,RED); TX1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Red); Text_SetStyle(tx1,1,1); Text_SetBold(tx1,1); } Else If 고[1,1] < HH[hiBar] Then // 1번 고점보다 높은 고가 출현 { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]); Text_SetString(TX1,NumToStr(고[1,1]-저[1,1],2)); Text_SetLocation(TX1,고[1,3],고[1,4],고[1,1]); } 최종꼭지점 = "고점"; } If 처리구분 == "저점처리" Then { If 최종꼭지점 == "고점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 저[j,jj] = 저[j-1,jj]; } } 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL1 = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,BLUE); TX1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1]-고[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Blue); Text_SetStyle(tx1,1,0); Text_SetBold(tx1,1); } Else If 저[1,1] > LL[loBar] Then { 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]); Text_SetString(TX1,NumToStr(저[1,1]-고[1,1],2)); Text_SetLocation(TX1,저[1,3],저[1,4],저[1,1]); } 최종꼭지점 = "저점"; } a.차트 쪽 추세선을 보조지표 쪽으로 이동. b.하락추세선 크기가 0.5p 이상 커지면 그 부분만 같은 크기로 박스 표시. c.추세선을 plot화 하여 직선이 아닌 계단식으로 구현. 감사합니다.
프로필 이미지

고성

2023-03-23 11:54:20

> 예스스탁 님이 쓴 글입니다. > 제목 : Re : 전환 비율 > 안녕하세요 예스스탁입니다. TL_new, Text_new 추세선과 텍스트를 출력하는 함수 중 위 함수는 기본차트 위에 추세선과 텍스트가 출력됩니다. 아래 함수로 작성하시면 수식 적용영역에 출력이 됩니다. TL_new_self ,Text_new_self plot은 현재봉 기준 과거지점부터 그릴수 없습니다. 최초 출력이 고점이나 저점으로 전환된 첫봉입니다. 이전 저점이나 고점부터 연결되게 작성 불가합니다. Input : 전환(0.2),굵기(3); Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""), TL1(0),TX1(0); Array:고[10,4](0),저[10,4](0); var : box(0),BB(False); HH = H; LL = L; If Index == 0 Then { 고[1,1] = HH; 고[1,2] = 0; 고[1,3] = sDate; 고[1,4] = sTime; 저[1,1] = LL; 저[1,2] = 0; 저[1,3] = sDate; 저[1,4] = sTime; } If Index > 0 Then { hiBar = hiBar + 1; loBar = loBar + 1; } If HH[hiBar] < HH Then hiBar = 0; If LL[loBar] > LL Then loBar = 0; Condition1 = 저[1,1]+전환 <= HH and hiBar == 0; Condition2 = 고[1,1]-전환 >= LL and loBar == 0; 처리구분 = ""; 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 { If 최종꼭지점 == "저점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 고[j,jj] = 고[j-1,jj]; } } 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL1 = TL_New_Self(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,RED); TX1 = Text_New_Self(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Red); Text_SetStyle(tx1,1,1); Text_SetBold(tx1,1); } Else If 고[1,1] < HH[hiBar] Then // 1번 고점보다 높은 고가 출현 { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]); Text_SetString(TX1,NumToStr(고[1,1]-저[1,1],2)); Text_SetLocation(TX1,고[1,3],고[1,4],고[1,1]); } 최종꼭지점 = "고점"; Plot1(고[1,1]); NoPlot(2); } If 처리구분 == "저점처리" Then { If 최종꼭지점 == "고점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 저[j,jj] = 저[j-1,jj]; } } 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL1 = TL_New_Self(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,BLUE); TX1 = Text_New_Self(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1]-고[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Blue); Text_SetStyle(tx1,1,0); Text_SetBold(tx1,1); bb = False; if bb == False and 저[1,1] <= 고[1,1]-0.5 and 고[1,1] > 0 Then { bb= true; box = Box_New_Self(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); Box_SetColor(box,Blue); } } Else If 저[1,1] > LL[loBar] Then { 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]); Text_SetString(TX1,NumToStr(저[1,1]-고[1,1],2)); Text_SetLocation(TX1,저[1,3],저[1,4],저[1,1]); if bb == true Then Box_SetEnd(box,저[1,3],저[1,4],저[1,1]); Else { bb= true; box = Box_New_Self(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); Box_SetColor(box,Blue); } } 최종꼭지점 = "저점"; Plot2(저[1,1]); NoPlot(1); } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : 전환 비율 > Input : 전환(0.2),굵기(3); Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""), TL1(0),TX1(0); Array:고[10,4](0),저[10,4](0); Plot1(0); HH = H; LL = L; If Index == 0 Then { 고[1,1] = HH; 고[1,2] = 0; 고[1,3] = sDate; 고[1,4] = sTime; 저[1,1] = LL; 저[1,2] = 0; 저[1,3] = sDate; 저[1,4] = sTime; } If Index > 0 Then { hiBar = hiBar + 1; loBar = loBar + 1; } If HH[hiBar] < HH Then hiBar = 0; If LL[loBar] > LL Then loBar = 0; Condition1 = 저[1,1]+전환 <= HH and hiBar == 0; Condition2 = 고[1,1]-전환 >= LL and loBar == 0; 처리구분 = ""; 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 { If 최종꼭지점 == "저점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 고[j,jj] = 고[j-1,jj]; } } 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL1 = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,RED); TX1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Red); Text_SetStyle(tx1,1,1); Text_SetBold(tx1,1); } Else If 고[1,1] < HH[hiBar] Then // 1번 고점보다 높은 고가 출현 { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]); Text_SetString(TX1,NumToStr(고[1,1]-저[1,1],2)); Text_SetLocation(TX1,고[1,3],고[1,4],고[1,1]); } 최종꼭지점 = "고점"; } If 처리구분 == "저점처리" Then { If 최종꼭지점 == "고점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 저[j,jj] = 저[j-1,jj]; } } 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL1 = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,BLUE); TX1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1]-고[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Blue); Text_SetStyle(tx1,1,0); Text_SetBold(tx1,1); } Else If 저[1,1] > LL[loBar] Then { 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]); Text_SetString(TX1,NumToStr(저[1,1]-고[1,1],2)); Text_SetLocation(TX1,저[1,3],저[1,4],저[1,1]); } 최종꼭지점 = "저점"; } a.차트 쪽 추세선을 보조지표 쪽으로 이동. b.하락추세선 크기가 0.5p 이상 커지면 그 부분만 같은 크기로 박스 표시. c.추세선을 plot화 하여 직선이 아닌 계단식으로 구현. 감사합니다. 재문의 0.5p 보다 큰 하락추세선만 박스처리. (작아도 표시됨)
프로필 이미지

예스스탁 예스스탁 답변

2023-03-23 11:52:38

수정한식입니다. Input : 전환(0.2),굵기(3); Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""), TL1(0),TX1(0); Array:고[10,4](0),저[10,4](0); var : box(0),BB(False); HH = H; LL = L; If Index == 0 Then { 고[1,1] = HH; 고[1,2] = 0; 고[1,3] = sDate; 고[1,4] = sTime; 저[1,1] = LL; 저[1,2] = 0; 저[1,3] = sDate; 저[1,4] = sTime; } If Index > 0 Then { hiBar = hiBar + 1; loBar = loBar + 1; } If HH[hiBar] < HH Then hiBar = 0; If LL[loBar] > LL Then loBar = 0; Condition1 = 저[1,1]+전환 <= HH and hiBar == 0; Condition2 = 고[1,1]-전환 >= LL and loBar == 0; 처리구분 = ""; 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 { If 최종꼭지점 == "저점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 고[j,jj] = 고[j-1,jj]; } } 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL1 = TL_New_Self(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,RED); TX1 = Text_New_Self(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Red); Text_SetStyle(tx1,1,1); Text_SetBold(tx1,1); } Else If 고[1,1] < HH[hiBar] Then // 1번 고점보다 높은 고가 출현 { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,고[1,3],고[1,4],고[1,1]); Text_SetString(TX1,NumToStr(고[1,1]-저[1,1],2)); Text_SetLocation(TX1,고[1,3],고[1,4],고[1,1]); } 최종꼭지점 = "고점"; Plot1(고[1,1]); NoPlot(2); } If 처리구분 == "저점처리" Then { If 최종꼭지점 == "고점" Then { For j = 10 DownTo 2 { For jj = 1 To 4 { 저[j,jj] = 저[j-1,jj]; } } 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL1 = TL_New_Self(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL1,2); TL_SetColor(TL1,BLUE); TX1 = Text_New_Self(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1]-고[1,1],2)); Text_SetSize(tx1,25); Text_SetColor(Tx1,Blue); Text_SetStyle(tx1,1,0); Text_SetBold(tx1,1); bb = False; if bb == False and 저[1,1] <= 고[1,1]-0.5 and 고[1,1] > 0 Then { bb= true; box = Box_New_Self(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); Box_SetColor(box,Blue); } } Else If 저[1,1] > LL[loBar] Then { 저[1,1] = LL[loBar]; 저[1,2] = Index - loBar; 저[1,3] = sDate[loBar]; 저[1,4] = sTime[loBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL1,저[1,3],저[1,4],저[1,1]); Text_SetString(TX1,NumToStr(저[1,1]-고[1,1],2)); Text_SetLocation(TX1,저[1,3],저[1,4],저[1,1]); if bb == true Then Box_SetEnd(box,저[1,3],저[1,4],저[1,1]); Else { if bb == False and 저[1,1] <= 고[1,1]-0.5 and 고[1,1] > 0 Then { bb= true; box = Box_New_Self(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); Box_SetColor(box,Blue); } } } 최종꼭지점 = "저점"; Plot2(저[1,1]); NoPlot(1); }