커뮤니티

수식부탁합니다

프로필 이미지
하늘거지
2023-01-25 22:28:33
824
글번호 165710
답변완료
input:length(6); Var:j(0),jj(0),HH(0),LL(0),최종고가(0),최종저가(0),최종꼭지점(""),처리구분(""), TL1(0),Text1(0),TL2(0),TL3(0),TL4(0),TL5(0),TL12(0),TL13(0),TL14(0),TL15(0),T(0),고점변곡(""),저점변곡(""); var : clr1(0),clr2(0),BE(0),SE(0),cnt(0),upcond(False),dncond(False),text2(0); Array:고[10,4](0),저[10,4](0); // 1:가격,2:Index,3:sDate,4:sTime #==========================================# HH = IFF(0==1,C,H); LL = IFF(0==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 { T = 1; 최종고가 = 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]); If 1 == 1 Then { Text1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1],2)); Text_SetStyle(Text1, 0, 1); Text_SetColor(Text1,Red); } TL_SetSize(TL1,1); TL_SetColor(TL1,Gray); } 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]); // 시작점은 변동없고 끝점의 위치가 현재 봉으로 연장된 것임 If 1 == 1 Then { Text_SetLocation(Text1,고[1,3],고[1,4],고[1,1]); Text_SetString(Text1,NumToStr(고[1,1],2)); } } 최종꼭지점 = "고점"; } #==========================================# If 처리구분 == "저점처리" Then { T = -1; 최종저가 = 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]); If 1 == 1 Then { Text1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1],2)); Text_SetStyle(Text1, 0, -1); Text_SetColor(Text1,Blue); } TL_SetSize(TL1,1); TL_SetColor(TL1,Gray); } 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]); If 1 == 1 Then { Text_SetLocation(Text1,저[1,3],저[1,4],저[1,1]); Text_SetString(Text1,NumToStr(저[1,1],2)); } } 최종꼭지점 = "저점"; } if T == -1 and T[1] != -1 Then { TL12 = TL_New(고[2,3],고[2,4],고[2,1],sdate,stime,고[2,1]); TL_Delete(TL13); TL13 = TL_New(고[1,3],고[1,4],고[1,1],Sdate,Stime,고[1,1]); TL_SetExtRight(TL13,true); TL_SetSize(TL13,2); TL_SetColor(TL12,clr1); TL_SetSize(TL12,2); clr1 = Pink; TL_SetColor(TL13,clr1); upcond = False; } if T == 1 and T[1] != 1 Then { TL14= TL_New(저[2,3],저[2,4],저[2,1],sdate,stime,저[2,1]); TL_Delete(TL15); TL15= TL_New(저[1,3],저[1,4],저[1,1],sdate,stime,저[1,1]); TL_SetExtRight(TL15,true); TL_SetColor(TL14,clr2); TL_SetSize(TL14,2); clr2 = LightBlue; TL_SetColor(TL15,clr2); TL_SetSize(TL15,2); dncond = False; } #===================================================# VAR:mav5(0),mav10(0),mav20(0),mav40(0),mav60(0),mav120(0),mav30(0); mav5=ma(c,5); mav10=ma(c,10); mav20=ma(c,20); mav30=ma(c,30); mav40=ma(c,40); mav60=ma(c,60); mav120=ma(c,120); #============# if (min(C,ma(c,5)) > TL_GetValue(TL13,sDate,sTime)) Then { clr1 = Red; TL_SetColor(TL13,clr1); } if max(C,ma(c,5)) < TL_GetValue(TL15,sDate,sTime) Then { clr2 = Blue; TL_SetColor(TL15,clr2); } #=========================================================================# array:Redline[4](0),Blueline[4](0),Pinkline[4](0),liblueline[4](0),libluex[4](0),Pinkx[4](0); var : Redx(0),bluex(0),고점매물대(0),Condition100(False),clr3(0); #==========================미완성==========================================# 1.고점매물대를 red 로 바꿔주세요 Condition100=t==1 and abs(고[2,1]-고[3,1])<=PriceScale*20 and abs(고[2,1]-고[4,1])<=PriceScale*20 and abs(고[3,1]-고[4,1])<=PriceScale*20 ; if Condition100 Then { 고점매물대=max(고[2,1],고[3,1],고[4,1]); } if mav20>mav30 and (min(C,ma(c,5)) >고점매물대) Then { clr3 = Red; TL_SetColor(고점매물대,clr3); } 2.red 를 카운팅 하려 합니다 Redx=0; if clr1 == Red or clr3==red Then { Bluex=0; Redx=Redx+1; } 3.if redx==1 then { 확정된 고[1,1]리턴 부탁드립니다 }
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-01-26 11:55:31

안녕하세요 예스스탁입니다. 현재 수식에 3개 고점 중 최고가를 그리는 선이 없습니다. 지정한 조건만족하면 이전 3개의 고점 중 최고 고점의 색을 red로 변경하게 수정해 드립니다. input:length(6); Var:j(0),jj(0),HH(0),LL(0),최종고가(0),최종저가(0),최종꼭지점(""),처리구분(""), TL1(0),Text1(0),TL2(0),TL3(0),TL4(0),TL5(0),TL13(0),TL14(0),TL15(0),T(0),고점변곡(""),저점변곡(""); var : clr1(0),clr2(0),BE(0),SE(0),cnt(0),upcond(False),dncond(False),text2(0); Array : TL12[10](0); Array:고[10,4](0),저[10,4](0); // 1:가격,2:Index,3:sDate,4:sTime #==========================================# HH = IFF(0==1,C,H); LL = IFF(0==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 { T = 1; 최종고가 = 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]); If 1 == 1 Then { Text1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1],2)); Text_SetStyle(Text1, 0, 1); Text_SetColor(Text1,Red); } TL_SetSize(TL1,1); TL_SetColor(TL1,Gray); } 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]); // 시작점은 변동없고 끝점의 위치가 현재 봉으로 연장된 것임 If 1 == 1 Then { Text_SetLocation(Text1,고[1,3],고[1,4],고[1,1]); Text_SetString(Text1,NumToStr(고[1,1],2)); } } 최종꼭지점 = "고점"; } #==========================================# If 처리구분 == "저점처리" Then { T = -1; 최종저가 = 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]); If 1 == 1 Then { Text1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1],2)); Text_SetStyle(Text1, 0, -1); Text_SetColor(Text1,Blue); } TL_SetSize(TL1,1); TL_SetColor(TL1,Gray); } 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]); If 1 == 1 Then { Text_SetLocation(Text1,저[1,3],저[1,4],저[1,1]); Text_SetString(Text1,NumToStr(저[1,1],2)); } } 최종꼭지점 = "저점"; } if T == -1 and T[1] != -1 Then { TL12[1] = TL_New(고[2,3],고[2,4],고[2,1],sdate,stime,고[2,1]); TL12[2] = TL12[1][1]; TL12[3] = TL12[2][1]; TL12[4] = TL12[3][1]; TL_Delete(TL13); TL13 = TL_New(고[1,3],고[1,4],고[1,1],Sdate,Stime,고[1,1]); TL_SetExtRight(TL13,true); TL_SetSize(TL13,2); TL_SetColor(TL12[1],clr1); TL_SetSize(TL12[1],2); clr1 = Pink; TL_SetColor(TL13,clr1); upcond = False; } if T == 1 and T[1] != 1 Then { TL14= TL_New(저[2,3],저[2,4],저[2,1],sdate,stime,저[2,1]); TL_Delete(TL15); TL15= TL_New(저[1,3],저[1,4],저[1,1],sdate,stime,저[1,1]); TL_SetExtRight(TL15,true); TL_SetColor(TL14,clr2); TL_SetSize(TL14,2); clr2 = LightBlue; TL_SetColor(TL15,clr2); TL_SetSize(TL15,2); dncond = False; } #===================================================# VAR:mav5(0),mav10(0),mav20(0),mav40(0),mav60(0),mav120(0),mav30(0); mav5=ma(c,5); mav10=ma(c,10); mav20=ma(c,20); mav30=ma(c,30); mav40=ma(c,40); mav60=ma(c,60); mav120=ma(c,120); #============# if (min(C,ma(c,5)) > TL_GetValue(TL13,sDate,sTime)) Then { clr1 = Red; TL_SetColor(TL13,clr1); } if max(C,ma(c,5)) < TL_GetValue(TL15,sDate,sTime) Then { clr2 = Blue; TL_SetColor(TL15,clr2); } #=========================================================================# array:Redline[4](0),Blueline[4](0),Pinkline[4](0),liblueline[4](0),libluex[4](0),Pinkx[4](0); var : Redx(0),bluex(0),고점매물대(0),Condition100(False),clr3(0),iii(0); #==========================미완성==========================================# #1.고점매물대를 red 로 바꿔주세요 if T == 1 Then { if T != T[1] Then { Condition100 = False; if abs(고[2,1]-고[3,1])<=PriceScale*20 and abs(고[2,1]-고[4,1])<=PriceScale*20 and abs(고[3,1]-고[4,1])<=PriceScale*20 Then { 고점매물대 = 0; iii = 0; For cnt = 1 to 3 { if 고[cnt,1] > 고점매물대 Then { 고점매물대 = 고[cnt,1]; iii = cnt; } } Condition100 = true; } } if Condition100 == true and mav20>mav30 and (min(C,ma(c,5)) >고점매물대) Then { Condition100 = False; TL_new(sDate,sTime,0,sDate,sTime,99999999); clr3 = Red; TL_SetColor(TL12[iii],clr3); } } Redx=0; if clr1 == Red or clr3==red Then { Bluex=0; Redx=Redx+1; } if redx==1 then { if t == 1 Then var1 = 고[2,1]; Else var1 = 고[1,1]; } 즐거운 하루되세요 > 하늘거지 님이 쓴 글입니다. > 제목 : 수식부탁합니다 > input:length(6); Var:j(0),jj(0),HH(0),LL(0),최종고가(0),최종저가(0),최종꼭지점(""),처리구분(""), TL1(0),Text1(0),TL2(0),TL3(0),TL4(0),TL5(0),TL12(0),TL13(0),TL14(0),TL15(0),T(0),고점변곡(""),저점변곡(""); var : clr1(0),clr2(0),BE(0),SE(0),cnt(0),upcond(False),dncond(False),text2(0); Array:고[10,4](0),저[10,4](0); // 1:가격,2:Index,3:sDate,4:sTime #==========================================# HH = IFF(0==1,C,H); LL = IFF(0==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 { T = 1; 최종고가 = 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]); If 1 == 1 Then { Text1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1],2)); Text_SetStyle(Text1, 0, 1); Text_SetColor(Text1,Red); } TL_SetSize(TL1,1); TL_SetColor(TL1,Gray); } 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]); // 시작점은 변동없고 끝점의 위치가 현재 봉으로 연장된 것임 If 1 == 1 Then { Text_SetLocation(Text1,고[1,3],고[1,4],고[1,1]); Text_SetString(Text1,NumToStr(고[1,1],2)); } } 최종꼭지점 = "고점"; } #==========================================# If 처리구분 == "저점처리" Then { T = -1; 최종저가 = 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]); If 1 == 1 Then { Text1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1],2)); Text_SetStyle(Text1, 0, -1); Text_SetColor(Text1,Blue); } TL_SetSize(TL1,1); TL_SetColor(TL1,Gray); } 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]); If 1 == 1 Then { Text_SetLocation(Text1,저[1,3],저[1,4],저[1,1]); Text_SetString(Text1,NumToStr(저[1,1],2)); } } 최종꼭지점 = "저점"; } if T == -1 and T[1] != -1 Then { TL12 = TL_New(고[2,3],고[2,4],고[2,1],sdate,stime,고[2,1]); TL_Delete(TL13); TL13 = TL_New(고[1,3],고[1,4],고[1,1],Sdate,Stime,고[1,1]); TL_SetExtRight(TL13,true); TL_SetSize(TL13,2); TL_SetColor(TL12,clr1); TL_SetSize(TL12,2); clr1 = Pink; TL_SetColor(TL13,clr1); upcond = False; } if T == 1 and T[1] != 1 Then { TL14= TL_New(저[2,3],저[2,4],저[2,1],sdate,stime,저[2,1]); TL_Delete(TL15); TL15= TL_New(저[1,3],저[1,4],저[1,1],sdate,stime,저[1,1]); TL_SetExtRight(TL15,true); TL_SetColor(TL14,clr2); TL_SetSize(TL14,2); clr2 = LightBlue; TL_SetColor(TL15,clr2); TL_SetSize(TL15,2); dncond = False; } #===================================================# VAR:mav5(0),mav10(0),mav20(0),mav40(0),mav60(0),mav120(0),mav30(0); mav5=ma(c,5); mav10=ma(c,10); mav20=ma(c,20); mav30=ma(c,30); mav40=ma(c,40); mav60=ma(c,60); mav120=ma(c,120); #============# if (min(C,ma(c,5)) > TL_GetValue(TL13,sDate,sTime)) Then { clr1 = Red; TL_SetColor(TL13,clr1); } if max(C,ma(c,5)) < TL_GetValue(TL15,sDate,sTime) Then { clr2 = Blue; TL_SetColor(TL15,clr2); } #=========================================================================# array:Redline[4](0),Blueline[4](0),Pinkline[4](0),liblueline[4](0),libluex[4](0),Pinkx[4](0); var : Redx(0),bluex(0),고점매물대(0),Condition100(False),clr3(0); #==========================미완성==========================================# 1.고점매물대를 red 로 바꿔주세요 Condition100=t==1 and abs(고[2,1]-고[3,1])<=PriceScale*20 and abs(고[2,1]-고[4,1])<=PriceScale*20 and abs(고[3,1]-고[4,1])<=PriceScale*20 ; if Condition100 Then { 고점매물대=max(고[2,1],고[3,1],고[4,1]); } if mav20>mav30 and (min(C,ma(c,5)) >고점매물대) Then { clr3 = Red; TL_SetColor(고점매물대,clr3); } 2.red 를 카운팅 하려 합니다 Redx=0; if clr1 == Red or clr3==red Then { Bluex=0; Redx=Redx+1; } 3.if redx==1 then { 확정된 고[1,1]리턴 부탁드립니다 }