커뮤니티

지표 수정 부탁드립니다.

프로필 이미지
superman
2022-05-20 09:53:12
966
글번호 159081
답변완료
오늘도 수고 많으십니다.아래에 식은 지그재그 수식에 고점저점 수치와 진폭을 표시한 지표 입니다. 이수식을 전일과 연결되지 않고 당일,당일마다 끊어서 추세선과 수치가 표시되게 할수 있을까요? 미리 감사합니다. 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); Array:고점[10,2](0),저점[10,2](0); 처리구분 = ""; 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)+NewLine+NumToStr(고점[1,1],2)); 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)+NewLine+NumToStr(저점[1,1],2)); 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,3); TL_SetColor(TL1,CYAN); TL_SetSize(TL2,2); TL_SetSize(TL3,2); TL_Val1 = 0; TL_Val2 = 0; If 고점[2,1] > 고점[1,1] and 고점[2,1] > 고점[3,1] Then { If 고점[1,2] < 저점[1,2] and 저점[3,1] < 저점[2,1] Then TL_Val1 = (저점[2,1]-저점[3,1])/(저점[2,2]-저점[3,2]) * (Index-저점[3,2])+저점[3,1]; If 저점[1,2] < 고점[1,2] and 저점[2,1] < 저점[1,1] Then TL_Val1 = (저점[1,1]-저점[2,1])/(저점[1,2]-저점[2,2]) * (Index-저점[2,2])+저점[2,1]; } If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] Then { If 저점[1,2] < 고점[1,2] and 고점[3,1] > 고점[2,1] Then TL_Val2 = (고점[2,1]-고점[3,1])/(고점[2,2]-고점[3,2]) * (Index-고점[3,2])+고점[3,1]; If 고점[1,2] < 저점[1,2] and 고점[2,1] > 고점[1,1] Then TL_Val2 = (고점[1,1]-고점[2,1])/(고점[1,2]-고점[2,2]) * (Index-고점[2,2])+고점[2,1]; } If TL_Val1 > 0 Then Plot1(TL_Val1,"추세선1",BLUE); //점그래프 If TL_Val2 > 0 Then Plot2(TL_Val2,"추세선2",RED); //점그래프
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2022-05-20 15:06:55

안녕하세요 예스스탁입니다. 당일 첫 고점이나 저점은 고점값이나 저점값만 표시되고 비교할 값이 없으므로 등락틱수는 표시되지 않습니다. 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),T(0); Array:고점[10,2](0),저점[10,2](0); if Bdate != Bdate[1] Then { T = 0; For j = 10 DownTo 0 { 고점[j,1] = 0; 고점[j,2] = 0; 저점[j,1] = 0; 저점[j,2] = 0; } } 처리구분 = ""; 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 { t = 1; 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); } if 저점[1,1] > 0 Then { 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)+NewLine+NumToStr(고점[1,1],2)); Text_SetStyle(Text1, 2, 1); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NewLine+NumToStr(고점[1,1],2)); Text_SetStyle(Text1, 2, 1); } 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 { T = -1; 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); } if 고점[1,1] > 0 Then { 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)+NewLine+NumToStr(저점[1,1],2)); Text_SetStyle(Text1, 2, 0); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(저점[1,1],2)); 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,3); TL_SetColor(TL1,CYAN); TL_SetSize(TL2,2); TL_SetSize(TL3,2); TL_Val1 = 0; TL_Val2 = 0; If 고점[2,1] > 고점[1,1] and 고점[2,1] > 고점[3,1] and 고점[3,1] > 0 Then { If 고점[1,2] < 저점[1,2] and 저점[3,1] < 저점[2,1] Then TL_Val1 = (저점[2,1]-저점[3,1])/(저점[2,2]-저점[3,2]) * (Index-저점[3,2])+저점[3,1]; If 저점[1,2] < 고점[1,2] and 저점[2,1] < 저점[1,1] Then TL_Val1 = (저점[1,1]-저점[2,1])/(저점[1,2]-저점[2,2]) * (Index-저점[2,2])+저점[2,1]; } If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] and 저점[3,1] > 0 Then { If 저점[1,2] < 고점[1,2] and 고점[3,1] > 고점[2,1] Then TL_Val2 = (고점[2,1]-고점[3,1])/(고점[2,2]-고점[3,2]) * (Index-고점[3,2])+고점[3,1]; If 고점[1,2] < 저점[1,2] and 고점[2,1] > 고점[1,1] Then TL_Val2 = (고점[1,1]-고점[2,1])/(고점[1,2]-고점[2,2]) * (Index-고점[2,2])+고점[2,1]; } If TL_Val1 > 0 Then Plot1(TL_Val1,"추세선1",BLUE); //점그래프 Else NoPlot(1); If TL_Val2 > 0 Then Plot2(TL_Val2,"추세선2",RED); //점그래프 Else NoPlot(2); 즐거운 하루되세요 > superman 님이 쓴 글입니다. > 제목 : 지표 수정 부탁드립니다. > 오늘도 수고 많으십니다.아래에 식은 지그재그 수식에 고점저점 수치와 진폭을 표시한 지표 입니다. 이수식을 전일과 연결되지 않고 당일,당일마다 끊어서 추세선과 수치가 표시되게 할수 있을까요? 미리 감사합니다. 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); Array:고점[10,2](0),저점[10,2](0); 처리구분 = ""; 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)+NewLine+NumToStr(고점[1,1],2)); 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)+NewLine+NumToStr(저점[1,1],2)); 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,3); TL_SetColor(TL1,CYAN); TL_SetSize(TL2,2); TL_SetSize(TL3,2); TL_Val1 = 0; TL_Val2 = 0; If 고점[2,1] > 고점[1,1] and 고점[2,1] > 고점[3,1] Then { If 고점[1,2] < 저점[1,2] and 저점[3,1] < 저점[2,1] Then TL_Val1 = (저점[2,1]-저점[3,1])/(저점[2,2]-저점[3,2]) * (Index-저점[3,2])+저점[3,1]; If 저점[1,2] < 고점[1,2] and 저점[2,1] < 저점[1,1] Then TL_Val1 = (저점[1,1]-저점[2,1])/(저점[1,2]-저점[2,2]) * (Index-저점[2,2])+저점[2,1]; } If 저점[2,1] < 저점[1,1] and 저점[2,1] < 저점[3,1] Then { If 저점[1,2] < 고점[1,2] and 고점[3,1] > 고점[2,1] Then TL_Val2 = (고점[2,1]-고점[3,1])/(고점[2,2]-고점[3,2]) * (Index-고점[3,2])+고점[3,1]; If 고점[1,2] < 저점[1,2] and 고점[2,1] > 고점[1,1] Then TL_Val2 = (고점[1,1]-고점[2,1])/(고점[1,2]-고점[2,2]) * (Index-고점[2,2])+고점[2,1]; } If TL_Val1 > 0 Then Plot1(TL_Val1,"추세선1",BLUE); //점그래프 If TL_Val2 > 0 Then Plot2(TL_Val2,"추세선2",RED); //점그래프