답변완료
파동의 저점과 고점 봉의 위치 재문의
안녕하십니까 ?
앞의 질문에 대한 재질문을 하고자 합니다.
파동의 최고점 최저점 봉의 위치를 타점으로 하는 데이터를 얻고자 하는 것인데
아래 로직에서 최저점 혹은 최고점은 실시간으로는 동적 메모리를 이용해서 고점과 저점의 변화에 따라서 지속적으로 갱신하는 것으로 보입니다.
하여간 아래 로직으로는 파동의 저점과 고점의 봉의 위치를 잡지 못하는것 같습니다.
(그림파일 첨부 참조)
따라서 결정되는 봉의 color값도 함께 동적메모리를 이용해서 갱신해야 하지 않는지요 ?(개인적인 생각이지만...)
yeslanguage 메모리 사용법을 몰라서 잘 안되는데 꼭 부탁드립니다.
안녕하세요
예스스탁입니다.
Input:P(0),length(10);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),
Text1(0),처리구분(""),T(0),TL3(0),TL4(0),TL5(0),color(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;
TL_Delete(TL2);
TL_Delete(TL3);
TL_Delete(TL4);
TL_Delete(TL5);
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL2 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL3 = TL_New(sDate[sBar],sTime[sBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.382,sDate[eBar],sTime[eBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.382);
TL4 = TL_New(sDate[sBar],sTime[sBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.500,sDate[eBar],sTime[eBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.500);
TL5 = TL_New(sDate[sBar],sTime[sBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.618,sDate[eBar],sTime[eBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.618);
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(고점[1,1],P));
Var1 = 고점[1,1];
Text_SetStyle(Text1, 2, 1);
Text_SetColor(Text1,Blue);
color = -1;
} # End of If 고점[1,2] < 저점[1,2] or 고점[1,1] < H
} # End of If 처리구분 == "고점처리"...
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;
TL_Delete(TL2);
TL_Delete(TL3);
TL_Delete(TL4);
TL_Delete(TL5);
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
} # End of If TL_GetBeginDate(TL1) ==
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL2 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL3 = TL_New(sDate[sBar],sTime[sBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.382,sDate[eBar],sTime[eBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.382);
TL4 = TL_New(sDate[sBar],sTime[sBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.500,sDate[eBar],sTime[eBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.500);
TL5 = TL_New(sDate[sBar],sTime[sBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.618,sDate[eBar],sTime[eBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.618);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(저점[1,1],P));
Var2 = 저점[1,1];
Text_SetStyle(Text1, 2, 8);
Text_SetColor(Text1,Red);
color = 1;
} # End of If 저점[1,2] < 고점[1,2] or 저점[1,1] > L
} # End of If 처리구분 == "저점처리"
TL_SetSize(TL1,0);
TL_SetColor(TL1,GRAY);
Plot1(color);
즐거운 하루되세요
> 구천룡 님이 쓴 글입니다.
> 제목 : 파동의 저점과 고점 위치
> 안녕하십니까.
아래 프로그램으로 장중 파동의 고점과 저점의 봉의 데이터 값, 즉 첨부된 그름 파일에서 붉은 색 값인 경우 +1로 출력하고 푸른색의 값인 경우 -1로 리턴하는 함수를 작성하고자 합니다. 도움 좀 부탁드립니다.
사용 목적은 파동의 고점과 저점 봉의 데이터 출력하고자 합니다.
(죄송스럽게도 제가 로직 이해가 부족해서 인지 정확히 숫자 찍히는 고점과 저점 지점을 잡을 수가 없네요)
Input:P(0),length(10);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),TL2(0),
Text1(0),처리구분(""),T(0),TL3(0),TL4(0),TL5(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;
TL_Delete(TL2);
TL_Delete(TL3);
TL_Delete(TL4);
TL_Delete(TL5);
If TL_GetBeginDate(TL1) == sDate[sBar] and
TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
}
TL1 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL2 = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL3 = TL_New(sDate[sBar],sTime[sBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.382,sDate[eBar],sTime[eBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.382);
TL4 = TL_New(sDate[sBar],sTime[sBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.500,sDate[eBar],sTime[eBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.500);
TL5 = TL_New(sDate[sBar],sTime[sBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.618,sDate[eBar],sTime[eBar],저점[1,1]+(고점[1,1]-저점[1,1])*0.618);
Text1 = Text_New(sDate[eBar],sTime[eBar],고점[1,1],NumToStr(고점[1,1],P));
Var1 = 고점[1,1];
Text_SetStyle(Text1, 2, 1);
Text_SetColor(Text1,Blue);
} # End of If 고점[1,2] < 저점[1,2] or 고점[1,1] < H
} # End of If 처리구분 == "고점처리"...
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;
TL_Delete(TL2);
TL_Delete(TL3);
TL_Delete(TL4);
TL_Delete(TL5);
If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then
{
TL_Delete(TL1);
Text_Delete(Text1);
} # End of If TL_GetBeginDate(TL1) ==
TL1 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
TL2 = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
TL3 = TL_New(sDate[sBar],sTime[sBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.382,sDate[eBar],sTime[eBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.382);
TL4 = TL_New(sDate[sBar],sTime[sBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.500,sDate[eBar],sTime[eBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.500);
TL5 = TL_New(sDate[sBar],sTime[sBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.618,sDate[eBar],sTime[eBar],고점[1,1]-(고점[1,1]-저점[1,1])*0.618);
Text1 = Text_New(sDate[eBar],sTime[eBar],저점[1,1],NumToStr(저점[1,1],P));
Var2 = 저점[1,1];
Text_SetStyle(Text1, 2, 8);
Text_SetColor(Text1,Red);
} # End of If 저점[1,2] < 고점[1,2] or 저점[1,1] > L
} # End of If 처리구분 == "저점처리"
TL_SetSize(TL1,0);
TL_SetColor(TL1,GRAY);
2022-10-19
1119
글번호 163117
지표