안녕하세요
아래 수식을 추세선 함수를 사용하지 않고 일반 plot 함수를 사용해서
지그재그 파동선을 나타낼 수 있는지요
=================
Input:length(60);
Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0);
Array:valArr[20](0),barArr[20](0),turnPntArr[20]("");
For j = 0 To 19 {
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 turnPntArr[1] == "Hi" Then turnPntBit = "Lo";
Else If turnPntArr[1] == "Lo" Then turnPntBit = "Hi";
}
Else If Condition1 Then turnPntBit = "Hi";
Else If Condition2 Then turnPntBit = "Lo";
If turnPntBit == "Hi" or turnPntBit == "Lo" Then {
If turnPntBit <> turnPntArr[1] Then {
for j = 18 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] 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]);
}
}
TL_SetSize(TL1,4);
TL_SetColor(TL1,GREEN);
=====================
답변 1
예스스탁
예스스탁 답변
2020-05-27 11:35:24
안녕하세요
예스스탁입니다.
일반 plot명령어로는 가능하지 않습니다.
해당 수식에 추세선함수가 사용되는 이유는
새로운 고점이나 저점이 발생하면 선을 다시그려야 하는데
일반 plot은 삭제하고 과거에서 다시 그려올수가 없습니다
즐거운 하루되세요
> 동해바다01 님이 쓴 글입니다.
> 제목 : 문의 드립니다.
> 안녕하세요
아래 수식을 추세선 함수를 사용하지 않고 일반 plot 함수를 사용해서
지그재그 파동선을 나타낼 수 있는지요
=================
Input:length(60);
Var:j(0),lastHiVal(0),lastLoVal(0),turnPntBit(""),TL1(0);
Array:valArr[20](0),barArr[20](0),turnPntArr[20]("");
For j = 0 To 19 {
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 turnPntArr[1] == "Hi" Then turnPntBit = "Lo";
Else If turnPntArr[1] == "Lo" Then turnPntBit = "Hi";
}
Else If Condition1 Then turnPntBit = "Hi";
Else If Condition2 Then turnPntBit = "Lo";
If turnPntBit == "Hi" or turnPntBit == "Lo" Then {
If turnPntBit <> turnPntArr[1] Then {
for j = 18 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] 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]);
}
}
TL_SetSize(TL1,4);
TL_SetColor(TL1,GREEN);
=====================