커뮤니티

수식 문의

프로필 이미지
미래테크
2021-09-29 07:29:33
1060
글번호 152534
답변완료
아래 종목검색식이 작동이 안되는데 수정 부탁합니다 Input:length(8); Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0); Array:valArr[10](0),barArr[10](0),turnPntArr[10](""); // 봉이 새로 생겼으므로 봉개수 관리하는 변수들의 봉개수 값 1씩 증가 For j = 0 To 9 { barArr[j] = barArr[j] + 1; } // 고점조건 = 현재 봉의 고가가 기간최고가이면서 최고가 갱신되었을 때; // 저점조건 = 현재 봉의 저가가 기간최저가이면서 최저가 갱신되었을 때; // 고점,저점조건 만족시 현재 봉의 고[저]가를 변수에 저장 Condition1 = Highest(H,length) == H and lastHiVal <> H; Condition2 = Lowest(L,length) == L and lastLoVal <> L; If Condition1 Then lastHiVal = H; If Condition2 Then lastLoVal = L; // 전환점구분 null값으로 초기화; turnPntBit = ""; // if 고점조건, 저점조건 동시 만족시 then // if 이전 고점,저점 범위를 모두 벗어났을 때 // 전환점구분 = 고저점; // else if 이전 고점을 갱신했다면 전환점구분 = 고점; // else if 이전 저점을 갱신했다면 전환점구분 = 저점; // else if 고점조건 만족하면 전환점구분 = 고점; // else if 저점조건 만족하면 전환점구분 = 저점; If Condition1 and Condition2 Then { If Max(valArr[1],valArr[2]) < H and Min(valArr[1],valArr[2]) > L Then turnPntBit = "HiLo"; Else If Max(valArr[1],valArr[2]) < H Then turnPntBit = "Hi"; Else If Min(valArr[1],valArr[2]) > L Then turnPntBit = "Lo"; } Else If Condition1 Then turnPntBit = "Hi"; Else If Condition2 Then turnPntBit = "Lo"; // if 전환점구분에 값이 있을 때만 then 아래 실행, 없으면 통과 If turnPntBit <> "" Then { // if 전환점구분이 고저점이면 then // 이전 파동은 연장시키고 아래에서 새로이 파동선을 추가토록 한다. If turnPntBit == "HiLo" Then { valArr[1] = IFF(turnPntArr[1] == "Hi",H,L); barArr[1] = 0; TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]); If turnPntArr[1] == "Hi" Then turnPntBit = "Lo"; Else turnPntBit = "Hi"; } // if 신규 전환점구분이 현재(전환점배열 1번째)와 다르면 then // 배열값들을 이전값으로 Move; If turnPntBit <> turnPntArr[1] Then { for j = 8 downto 1 { valArr[j+1] = valArr[j]; barArr[j+1] = barArr[j]; turnPntArr[j+1] = turnPntArr[j]; } } // if 전환점구분이 바뀌었거나 또는 // (전환점구분은 안바뀌었는데 // (이전 고점보다 높은 고점이 발생했거나 또는 // 이전 저점보다 낮은 저점이 발생했으면)) then If turnPntBit <> turnPntArr[1] or (turnPntBit == turnPntArr[1] and ((turnPntBit == "Hi" and valArr[1] < H) or (turnPntBit == "Lo" and valArr[1] > L))) Then { // 값 배열에는 고점 또는 저점을 대입; // 봉개수 배열에는 0값 대입; // 전환점 배열에 전환점구분값을 대입; valArr[1] = IFF(turnPntBit == "Hi",H,L); barArr[1] = 0; turnPntArr[1] = turnPntBit; // if 이전봉대비 전환점구분이 바뀌었다면 추세선 새로 그리고; // else 전환점구분이 안바뀌었으면 값만 바뀐거므로 추세선 연장; If turnPntArr[1][1] <> turnPntArr[1][0] Then TL1 = TL_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],sDate[barArr[1]],sTime[barArr[1]],valArr[1]); Else TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]); If turnPntArr[1][1] <> turnPntArr[1][0] and turnPntArr[1][0] == "Hi" Then find(1); } } TL_SetSize(TL1,4); TL_SetColor(TL1,GREEN);
종목검색
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-09-29 10:14:59

안녕하세요 예스스탁입니다. 종목검색식은 추세선 사용이 의미가 없습니다. 로드를 많이 주게 되므로 종목검색에 시간이 많이 소모되는 수식으로 판단되어 서버에서 리젝될수 있으므로 추세선이나 텍스트 출력부분은 제외하고 종목검색식 만들어 사용하시기 바랍니다. 종목검색은 최대 500봉까지 제공됩니다. 속성에서 검색에 필요한 최소기간에 500봉 지정하고 검색하시면 됩니다. Input:length(8); Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0); Array:valArr[10](0),barArr[10](0),turnPntArr[10](""); For j = 0 To 9 { barArr[j] = barArr[j] + 1; } Condition1 = Highest(H,length) == H and lastHiVal <> H; Condition2 = Lowest(L,length) == L and lastLoVal <> L; If Condition1 Then lastHiVal = H; If Condition2 Then lastLoVal = L; turnPntBit = ""; If Condition1 and Condition2 Then { If Max(valArr[1],valArr[2]) < H and Min(valArr[1],valArr[2]) > L Then turnPntBit = "HiLo"; Else If Max(valArr[1],valArr[2]) < H Then turnPntBit = "Hi"; Else If Min(valArr[1],valArr[2]) > L Then turnPntBit = "Lo"; } Else If Condition1 Then turnPntBit = "Hi"; Else If Condition2 Then turnPntBit = "Lo"; If turnPntBit <> "" Then { If turnPntBit == "HiLo" Then { valArr[1] = IFF(turnPntArr[1] == "Hi",H,L); barArr[1] = 0; If turnPntArr[1] == "Hi" Then turnPntBit = "Lo"; Else turnPntBit = "Hi"; } If turnPntBit <> turnPntArr[1] Then { for j = 8 downto 1 { valArr[j+1] = valArr[j]; barArr[j+1] = barArr[j]; turnPntArr[j+1] = turnPntArr[j]; } } If turnPntBit <> turnPntArr[1] or (turnPntBit == turnPntArr[1] and ((turnPntBit == "Hi" and valArr[1] < H) or (turnPntBit == "Lo" and valArr[1] > L))) Then { valArr[1] = IFF(turnPntBit == "Hi",H,L); barArr[1] = 0; turnPntArr[1] = turnPntBit; If turnPntArr[1][1] <> turnPntArr[1][0] and turnPntArr[1][0] == "Hi" Then find(1); } } 즐거운 하루되세요 > 미래테크 님이 쓴 글입니다. > 제목 : 수식 문의 > 아래 종목검색식이 작동이 안되는데 수정 부탁합니다 Input:length(8); Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0); Array:valArr[10](0),barArr[10](0),turnPntArr[10](""); // 봉이 새로 생겼으므로 봉개수 관리하는 변수들의 봉개수 값 1씩 증가 For j = 0 To 9 { barArr[j] = barArr[j] + 1; } // 고점조건 = 현재 봉의 고가가 기간최고가이면서 최고가 갱신되었을 때; // 저점조건 = 현재 봉의 저가가 기간최저가이면서 최저가 갱신되었을 때; // 고점,저점조건 만족시 현재 봉의 고[저]가를 변수에 저장 Condition1 = Highest(H,length) == H and lastHiVal <> H; Condition2 = Lowest(L,length) == L and lastLoVal <> L; If Condition1 Then lastHiVal = H; If Condition2 Then lastLoVal = L; // 전환점구분 null값으로 초기화; turnPntBit = ""; // if 고점조건, 저점조건 동시 만족시 then // if 이전 고점,저점 범위를 모두 벗어났을 때 // 전환점구분 = 고저점; // else if 이전 고점을 갱신했다면 전환점구분 = 고점; // else if 이전 저점을 갱신했다면 전환점구분 = 저점; // else if 고점조건 만족하면 전환점구분 = 고점; // else if 저점조건 만족하면 전환점구분 = 저점; If Condition1 and Condition2 Then { If Max(valArr[1],valArr[2]) < H and Min(valArr[1],valArr[2]) > L Then turnPntBit = "HiLo"; Else If Max(valArr[1],valArr[2]) < H Then turnPntBit = "Hi"; Else If Min(valArr[1],valArr[2]) > L Then turnPntBit = "Lo"; } Else If Condition1 Then turnPntBit = "Hi"; Else If Condition2 Then turnPntBit = "Lo"; // if 전환점구분에 값이 있을 때만 then 아래 실행, 없으면 통과 If turnPntBit <> "" Then { // if 전환점구분이 고저점이면 then // 이전 파동은 연장시키고 아래에서 새로이 파동선을 추가토록 한다. If turnPntBit == "HiLo" Then { valArr[1] = IFF(turnPntArr[1] == "Hi",H,L); barArr[1] = 0; TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]); If turnPntArr[1] == "Hi" Then turnPntBit = "Lo"; Else turnPntBit = "Hi"; } // if 신규 전환점구분이 현재(전환점배열 1번째)와 다르면 then // 배열값들을 이전값으로 Move; If turnPntBit <> turnPntArr[1] Then { for j = 8 downto 1 { valArr[j+1] = valArr[j]; barArr[j+1] = barArr[j]; turnPntArr[j+1] = turnPntArr[j]; } } // if 전환점구분이 바뀌었거나 또는 // (전환점구분은 안바뀌었는데 // (이전 고점보다 높은 고점이 발생했거나 또는 // 이전 저점보다 낮은 저점이 발생했으면)) then If turnPntBit <> turnPntArr[1] or (turnPntBit == turnPntArr[1] and ((turnPntBit == "Hi" and valArr[1] < H) or (turnPntBit == "Lo" and valArr[1] > L))) Then { // 값 배열에는 고점 또는 저점을 대입; // 봉개수 배열에는 0값 대입; // 전환점 배열에 전환점구분값을 대입; valArr[1] = IFF(turnPntBit == "Hi",H,L); barArr[1] = 0; turnPntArr[1] = turnPntBit; // if 이전봉대비 전환점구분이 바뀌었다면 추세선 새로 그리고; // else 전환점구분이 안바뀌었으면 값만 바뀐거므로 추세선 연장; If turnPntArr[1][1] <> turnPntArr[1][0] Then TL1 = TL_New(sDate[barArr[2]],sTime[barArr[2]],valArr[2],sDate[barArr[1]],sTime[barArr[1]],valArr[1]); Else TL_SetEnd(TL1,sDate[barArr[1]],sTime[barArr[1]],valArr[1]); If turnPntArr[1][1] <> turnPntArr[1][0] and turnPntArr[1][0] == "Hi" Then find(1); } } TL_SetSize(TL1,4); TL_SetColor(TL1,GREEN);