커뮤니티

전환추세 당일

프로필 이미지
고성
2024-06-30 11:04:23
882
글번호 181078
답변완료

첨부 이미지

Input : 전환(0.55); Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""); Array:고[10,4](0),저[10,4](0); var : box(0),TX(0),TX2(0),TL(0),TL1(0); HH = H; LL = L; If Index == 0 or Bdate != Bdate[1] 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 and Bdate == Bdate[1] 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 최종꼭지점 == "저점" or 최종꼭지점 == "" 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; TL = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL,1); TL_SetColor(TL,RED); TX = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetSize(tx,25); Text_SetColor(tx,Red); Text_SetStyle(tx,2,1); Text_SetBold(tx,1); box = Box_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); } If 고[1,1] < HH[hiBar] Then { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL,고[1,3],고[1,4],고[1,1]); Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetLocation(TX,고[1,3],고[1,4],고[1,1]); Box_SetEnd(box,고[1,3],고[1,4],고[1,1]); } if 고[1,1] >= 저[1,1]+1.3 Then { Box_SetColor(box,Gray); Box_SetFill(box,true,40); } else if 고[1,1] < 저[1,1]+1.3 and 고[1,1] >= 저[1,1]+0.8 Then { Box_SetColor(box,Magenta); Box_SetFill(box,true,30); } else if 고[1,1] < 저[1,1]+0.8 and 고[1,1] >= 저[1,1]+0.7 Then { Box_SetColor(box,Gray); Box_SetFill(box,true,60); } else if 고[1,1] < 저[1,1]+0.7 and 고[1,1] >= 저[1,1]+0.45 Then { Box_SetColor(box,Orange); Box_SetFill(box,true,70); } else { Box_SetColor(box,Magenta); Box_SetFill(box,true,50); } 최종꼭지점 = "고점"; Plot1(고[1,1]); NoPlot(2); } If 처리구분 == "저점처리" Then { If 최종꼭지점 == "고점" or 최종꼭지점 == "" 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; TL = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL,1); TL_SetColor(TL,Green); TX = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetSize(tx,25); Text_SetColor(tx,Blue); Text_SetStyle(tx,2,0); Text_SetBold(tx,1); box = Box_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); } 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(TL,저[1,3],저[1,4],저[1,1]); Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetLocation(TX,저[1,3],저[1,4],저[1,1]); Box_SetEnd(box,저[1,3],저[1,4],저[1,1]); } if 저[1,1] > 고[1,1]-0.45 Then { Box_SetColor(box,Lime); Box_SetFill(box,true,80); } else if 저[1,1] <= 고[1,1]-0.45 and 저[1,1] > 고[1,1]-0.6 Then { Box_SetColor(box,Cyan); Box_SetFill(box,true,60); } else if 저[1,1] <= 고[1,1]-0.6 and 저[1,1] > 고[1,1]-0.9 Then { Box_SetColor(box,Yellow); Box_SetFill(box,true,90); } else if 저[1,1] <= 고[1,1]-0.9 and 저[1,1] > 고[1,1]-1.3 Then { Box_SetColor(box,Lime); Box_SetFill(box,true,70); } else if 저[1,1] <= 고[1,1]-1.3 and 저[1,1] > 고[1,1]-1.6 Then { Box_SetColor(box,Cyan); Box_SetFill(box,true,60); } else if 저[1,1] <= 고[1,1]-1.6 and 저[1,1] > 고[1,1]-1.9 Then { Box_SetColor(box,Blue); Box_SetFill(box,true,20); } else { Box_SetColor(box,Yellow); Box_SetFill(box,true,60); } 최종꼭지점 = "저점"; Plot2(저[1,1]); NoPlot(1); } 추세선이 발생한 시점의 고가가 기준이 되어야 하는데,첫봉의 고가가 고점의 기준이 됩니다. 상승추세선도 시점 최저가가 기준이 되어야 하는데, 당일 첫봉의 저가입니다. 첫봉이 기준이면 몇틱봉으로 조회하느냐에 따라 첫추세선의 수치가 다르게 나옵니다. 당일 첫추세선 기준점을, 전일은 무시하고 당일 첫봉이 아닌 당일 첫추세선 시점 최고가,최저가로 기준점을 수정 부탁드립니다.
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2024-07-01 16:00:57

안녕하세요 예스스탁입니다. Input : 전환(0.55); Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""); Array:고[10,4](0),저[10,4](0); var : box(0),TX(0),TX2(0),TL(0),TL1(0); HH = H; LL = L; If Index == 0 or Bdate != Bdate[1] 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 최종꼭지점 == "" Then { if HH > 고[1,1] Then { 고[1,1] = HH; 고[1,2] = 0; 고[1,3] = sDate; 고[1,4] = sTime; } if LL < 저[1,1] Then { 저[1,1] = LL; 저[1,2] = 0; 저[1,3] = sDate; 저[1,4] = sTime; } } If Index > 0 and Bdate == Bdate[1] 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 최종꼭지점 == "저점" or 최종꼭지점 == "" 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; TL = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL,1); TL_SetColor(TL,RED); TX = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetSize(tx,25); Text_SetColor(tx,Red); Text_SetStyle(tx,2,1); Text_SetBold(tx,1); box = Box_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); } If 고[1,1] < HH[hiBar] Then { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL,고[1,3],고[1,4],고[1,1]); Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetLocation(TX,고[1,3],고[1,4],고[1,1]); Box_SetEnd(box,고[1,3],고[1,4],고[1,1]); } if 고[1,1] >= 저[1,1]+1.3 Then { Box_SetColor(box,Gray); Box_SetFill(box,true,40); } else if 고[1,1] < 저[1,1]+1.3 and 고[1,1] >= 저[1,1]+0.8 Then { Box_SetColor(box,Magenta); Box_SetFill(box,true,30); } else if 고[1,1] < 저[1,1]+0.8 and 고[1,1] >= 저[1,1]+0.7 Then { Box_SetColor(box,Gray); Box_SetFill(box,true,60); } else if 고[1,1] < 저[1,1]+0.7 and 고[1,1] >= 저[1,1]+0.45 Then { Box_SetColor(box,Orange); Box_SetFill(box,true,70); } else { Box_SetColor(box,Magenta); Box_SetFill(box,true,50); } 최종꼭지점 = "고점"; Plot1(고[1,1]); NoPlot(2); } If 처리구분 == "저점처리" Then { If 최종꼭지점 == "고점" or 최종꼭지점 == "" 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; TL = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL,1); TL_SetColor(TL,Green); TX = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetSize(tx,25); Text_SetColor(tx,Blue); Text_SetStyle(tx,2,0); Text_SetBold(tx,1); box = Box_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); } 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(TL,저[1,3],저[1,4],저[1,1]); Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetLocation(TX,저[1,3],저[1,4],저[1,1]); Box_SetEnd(box,저[1,3],저[1,4],저[1,1]); } if 저[1,1] > 고[1,1]-0.45 Then { Box_SetColor(box,Lime); Box_SetFill(box,true,80); } else if 저[1,1] <= 고[1,1]-0.45 and 저[1,1] > 고[1,1]-0.6 Then { Box_SetColor(box,Cyan); Box_SetFill(box,true,60); } else if 저[1,1] <= 고[1,1]-0.6 and 저[1,1] > 고[1,1]-0.9 Then { Box_SetColor(box,Yellow); Box_SetFill(box,true,90); } else if 저[1,1] <= 고[1,1]-0.9 and 저[1,1] > 고[1,1]-1.3 Then { Box_SetColor(box,Lime); Box_SetFill(box,true,70); } else if 저[1,1] <= 고[1,1]-1.3 and 저[1,1] > 고[1,1]-1.6 Then { Box_SetColor(box,Cyan); Box_SetFill(box,true,60); } else if 저[1,1] <= 고[1,1]-1.6 and 저[1,1] > 고[1,1]-1.9 Then { Box_SetColor(box,Blue); Box_SetFill(box,true,20); } else { Box_SetColor(box,Yellow); Box_SetFill(box,true,60); } 최종꼭지점 = "저점"; Plot2(저[1,1]); NoPlot(1); } 즐거운 하루되세요 > 고성 님이 쓴 글입니다. > 제목 : 전환추세 당일 > Input : 전환(0.55); Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""); Array:고[10,4](0),저[10,4](0); var : box(0),TX(0),TX2(0),TL(0),TL1(0); HH = H; LL = L; If Index == 0 or Bdate != Bdate[1] 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 and Bdate == Bdate[1] 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 최종꼭지점 == "저점" or 최종꼭지점 == "" 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; TL = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); TL_SetSize(TL,1); TL_SetColor(TL,RED); TX = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetSize(tx,25); Text_SetColor(tx,Red); Text_SetStyle(tx,2,1); Text_SetBold(tx,1); box = Box_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]); } If 고[1,1] < HH[hiBar] Then { 고[1,1] = HH[hiBar]; 고[1,2] = Index - hiBar; 고[1,3] = sDate[hiBar]; 고[1,4] = sTime[hiBar]; hiBar = -1; loBar = -1; TL_SetEnd(TL,고[1,3],고[1,4],고[1,1]); Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetLocation(TX,고[1,3],고[1,4],고[1,1]); Box_SetEnd(box,고[1,3],고[1,4],고[1,1]); } if 고[1,1] >= 저[1,1]+1.3 Then { Box_SetColor(box,Gray); Box_SetFill(box,true,40); } else if 고[1,1] < 저[1,1]+1.3 and 고[1,1] >= 저[1,1]+0.8 Then { Box_SetColor(box,Magenta); Box_SetFill(box,true,30); } else if 고[1,1] < 저[1,1]+0.8 and 고[1,1] >= 저[1,1]+0.7 Then { Box_SetColor(box,Gray); Box_SetFill(box,true,60); } else if 고[1,1] < 저[1,1]+0.7 and 고[1,1] >= 저[1,1]+0.45 Then { Box_SetColor(box,Orange); Box_SetFill(box,true,70); } else { Box_SetColor(box,Magenta); Box_SetFill(box,true,50); } 최종꼭지점 = "고점"; Plot1(고[1,1]); NoPlot(2); } If 처리구분 == "저점처리" Then { If 최종꼭지점 == "고점" or 최종꼭지점 == "" 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; TL = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); TL_SetSize(TL,1); TL_SetColor(TL,Green); TX = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetSize(tx,25); Text_SetColor(tx,Blue); Text_SetStyle(tx,2,0); Text_SetBold(tx,1); box = Box_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]); } 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(TL,저[1,3],저[1,4],저[1,1]); Text_SetString(TX,NumToStr(고[1,1]-저[1,1],2)+" "); Text_SetLocation(TX,저[1,3],저[1,4],저[1,1]); Box_SetEnd(box,저[1,3],저[1,4],저[1,1]); } if 저[1,1] > 고[1,1]-0.45 Then { Box_SetColor(box,Lime); Box_SetFill(box,true,80); } else if 저[1,1] <= 고[1,1]-0.45 and 저[1,1] > 고[1,1]-0.6 Then { Box_SetColor(box,Cyan); Box_SetFill(box,true,60); } else if 저[1,1] <= 고[1,1]-0.6 and 저[1,1] > 고[1,1]-0.9 Then { Box_SetColor(box,Yellow); Box_SetFill(box,true,90); } else if 저[1,1] <= 고[1,1]-0.9 and 저[1,1] > 고[1,1]-1.3 Then { Box_SetColor(box,Lime); Box_SetFill(box,true,70); } else if 저[1,1] <= 고[1,1]-1.3 and 저[1,1] > 고[1,1]-1.6 Then { Box_SetColor(box,Cyan); Box_SetFill(box,true,60); } else if 저[1,1] <= 고[1,1]-1.6 and 저[1,1] > 고[1,1]-1.9 Then { Box_SetColor(box,Blue); Box_SetFill(box,true,20); } else { Box_SetColor(box,Yellow); Box_SetFill(box,true,60); } 최종꼭지점 = "저점"; Plot2(저[1,1]); NoPlot(1); } 추세선이 발생한 시점의 고가가 기준이 되어야 하는데,첫봉의 고가가 고점의 기준이 됩니다. 상승추세선도 시점 최저가가 기준이 되어야 하는데, 당일 첫봉의 저가입니다. 첫봉이 기준이면 몇틱봉으로 조회하느냐에 따라 첫추세선의 수치가 다르게 나옵니다. 당일 첫추세선 기준점을, 전일은 무시하고 당일 첫봉이 아닌 당일 첫추세선 시점 최고가,최저가로 기준점을 수정 부탁드립니다.