예스스탁
예스스탁 답변
2023-03-23 11:50:39
안녕하세요
예스스탁입니다.
Input:length(20),종가사용여부(0),파동선두께(2),수치표시(1);
Input:가로라인두께(2),고점라인색상(RED),저점라인색상(BLUE);
Var:j(0),jj(0),HH(0),LL(0),최종고가(0),최종저가(0),최종꼭지점(""),처리구분(""),
TL1(0),Text1(0),text2(0),TL2(0),text3(0);
Array:고[10,4](0),저[10,4](0); // 1:가격,2:Index,3:sDate,4:sTime
#==========================================#
HH = IFF(종가사용여부==1,C,H);
LL = IFF(종가사용여부==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
{
최종고가 = 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]);
var1 = 고[2,1]-저[1,1];
TL2 = TL_New(저[1,3],저[1,4],저[1,1],sDate,sTime,저[1,1]);
If 수치표시 == 1 Then
{
Text1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1],2));
Text_SetStyle(Text1, 1, 1);
Text_SetSize(Text1, 26);
Text2 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)+NewLine);
Text_SetStyle(Text2, 1, 1);
Text_SetSize(Text2, 26);
Text_SetColor(text2,RED);
Text3 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,2]-저[1,2],0)+NewLine+NewLine);
Text_SetStyle(Text3, 1, 1);
Text_SetSize(Text3, 26);
Text_SetColor(text3,RED);
}
TL_SetSize(TL1,파동선두께);
TL_SetColor(TL1,BLUe);
TL_SetSize(TL2,가로라인두께);
TL_SetColor(TL2,저점라인색상);
}
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]);
TL_SetEnd(TL2,고[1,3],고[1,4],저[1,1]);
// 시작점은 변동없고 끝점의 위치가 현재 봉으로 연장된 것임
If 수치표시 == 1 Then
{
Text_SetLocation(Text1,고[1,3],고[1,4],고[1,1]);
Text_SetString(Text1,NumToStr(고[1,1],2));
Text_SetLocation(Text2,고[1,3],고[1,4],고[1,1]);
Text_SetString(Text2,NumToStr(고[1,1]-저[1,1],2)+NewLine);
Text_SetLocation(Text3,고[1,3],고[1,4],고[1,1]);
Text_SetString(Text3,NumToStr(고[1,2]-저[1,2],0)+NewLine+NewLine);
}
}
최종꼭지점 = "고점";
}
#==========================================#
If 처리구분 == "저점처리" Then
{
최종저가 = 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]);
var1 = 고[1,1]-저[2,1];
TL2 = TL_New(고[1,3],고[1,4],고[1,1],sDate,sTime,고[1,1]);
If 수치표시 == 1 Then
{
Text1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1],2));
Text_SetStyle(Text1, 1, 0);
Text_SetSize(Text1, 26);
Text2 = Text_New(저[1,3],저[1,4],저[1,1],NewLine+NumToStr(저[1,1]-고[1,1],2));
Text_SetStyle(Text2, 1, 0);
Text_SetSize(Text2, 26);
Text_SetColor(text2,RED);
Text3 = Text_New(저[1,3],저[1,4],저[1,1],NewLine+NewLine+NumToStr(저[1,2]-고[1,2],2));
Text_SetStyle(Text3, 1, 0);
Text_SetSize(Text3, 26);
Text_SetColor(text3,RED);
}
TL_SetSize(TL1,파동선두께);
TL_SetColor(TL1,BLUe);
TL_SetSize(TL2,가로라인두께);
TL_SetColor(TL2,고점라인색상);
}
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]);
TL_SetEnd(TL2,저[1,3],저[1,4],고[1,1]);
If 수치표시 == 1 Then
{
Text_SetLocation(Text1,저[1,3],저[1,4],저[1,1]);
Text_SetString(Text1,NumToStr(저[1,1],2));
Text_SetLocation(Text2,저[1,3],저[1,4],저[1,1]);
Text_SetString(Text2,NewLine+NumToStr(저[1,1]-고[1,1],2));
Text_SetLocation(Text3,저[1,3],저[1,4],저[1,1]);
Text_SetString(Text3,NewLine+NewLine+NumToStr(저[1,2]-고[1,2],2));
}
}
최종꼭지점 = "저점";
}
즐거운 하루되세요
> fill 님이 쓴 글입니다.
> 제목 : 수고하십니다.
> 안녕하십니까?
Text2 위에 Text3에 봉갯수 표시 되도록 추가부탁드립니다.
Input:length(20),종가사용여부(0),파동선두께(2),수치표시(1);
Input:가로라인두께(2),고점라인색상(RED),저점라인색상(BLUE);
Var:j(0),jj(0),HH(0),LL(0),최종고가(0),최종저가(0),최종꼭지점(""),처리구분(""),
TL1(0),Text1(0),text2(0),TL2(0);
Array:고[10,4](0),저[10,4](0); // 1:가격,2:Index,3:sDate,4:sTime
#==========================================#
HH = IFF(종가사용여부==1,C,H);
LL = IFF(종가사용여부==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
{
최종고가 = 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]);
var1 = 고[2,1]-저[1,1];
TL2 = TL_New(저[1,3],저[1,4],저[1,1],sDate,sTime,저[1,1]);
If 수치표시 == 1 Then
{
Text1 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1],2));
Text_SetStyle(Text1, 1, 1);
Text_SetSize(Text1, 26);
Text2 = Text_New(고[1,3],고[1,4],고[1,1],NumToStr(고[1,1]-저[1,1],2)+NewLine);
Text_SetStyle(Text2, 1, 1);
Text_SetSize(Text2, 26);
Text_SetColor(text2,RED);
}
TL_SetSize(TL1,파동선두께);
TL_SetColor(TL1,BLUe);
TL_SetSize(TL2,가로라인두께);
TL_SetColor(TL2,저점라인색상);
}
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]);
TL_SetEnd(TL2,고[1,3],고[1,4],저[1,1]);
// 시작점은 변동없고 끝점의 위치가 현재 봉으로 연장된 것임
If 수치표시 == 1 Then
{
Text_SetLocation(Text1,고[1,3],고[1,4],고[1,1]);
Text_SetString(Text1,NumToStr(고[1,1],2));
Text_SetLocation(Text2,고[1,3],고[1,4],고[1,1]);
Text_SetString(Text2,NumToStr(고[1,1]-저[1,1],2)+NewLine);
}
}
최종꼭지점 = "고점";
}
#==========================================#
If 처리구분 == "저점처리" Then
{
최종저가 = 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]);
var1 = 고[1,1]-저[2,1];
TL2 = TL_New(고[1,3],고[1,4],고[1,1],sDate,sTime,고[1,1]);
If 수치표시 == 1 Then
{
Text1 = Text_New(저[1,3],저[1,4],저[1,1],NumToStr(저[1,1],2));
Text_SetStyle(Text1, 1, 0);
Text_SetSize(Text1, 26);
Text2 = Text_New(저[1,3],저[1,4],저[1,1],NewLine+NumToStr(저[1,1]-고[1,1],2));
Text_SetStyle(Text2, 1, 0);
Text_SetSize(Text2, 26);
Text_SetColor(text2,RED);
}
TL_SetSize(TL1,파동선두께);
TL_SetColor(TL1,BLUe);
TL_SetSize(TL2,가로라인두께);
TL_SetColor(TL2,고점라인색상);
}
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]);
TL_SetEnd(TL2,저[1,3],저[1,4],고[1,1]);
If 수치표시 == 1 Then
{
Text_SetLocation(Text1,저[1,3],저[1,4],저[1,1]);
Text_SetString(Text1,NumToStr(저[1,1],2));
Text_SetLocation(Text2,저[1,3],저[1,4],저[1,1]);
Text_SetString(Text2,NewLine+NumToStr(저[1,1]-고[1,1],2));
}
}
최종꼭지점 = "저점";
}