예스스탁
예스스탁 답변
2019-11-14 14:28:57
안녕하세요
예스스탁입니다.
이전에 게시판의 질문으로 올라온 수식에 있어 해당 식을 올려드립니다.
아래수식 참고하시기 바랍니다.
Input:length(12),오차범위(0.1);
Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),
처리구분(""),XA(0),AB(0),BC(0),CD(0),V1(0),V2(0),V3(0),V4(0),Result("");
Array:고점[10,2](0),저점[10,2](0),TL[9](0),TX[6](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;
XA = sqrt((고점[3,1]-저점[2,1])^2+(저점[2,2]-고점[3,2])^2);
AB = sqrt((고점[2,1]-저점[2,1])^2+(고점[2,2]-저점[2,2])^2);
BC = sqrt((고점[2,1]-저점[1,1])^2+(저점[1,2]-고점[2,2])^2);
CD = sqrt((고점[1,1]-저점[1,1])^2+(고점[1,2]-저점[1,2])^2);
V1 = AB/XA;
V2 = BC/AB;
V3 = CD/BC;
V4 = CD/XA;
Result = "";
If 고점[2,1] < 고점[1,1] and 고점[1,1] < 고점[3,1] and
저점[2,1] < 저점[1,1] Then
{
If V1 >= 0.618 - 오차범위 and V1 <= 0.618 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.13 - 오차범위 and V3 <= 1.618 + 오차범위 and
V4 >= 0.786 - 오차범위 and V4 <= 0.786 + 오차범위 Then
Result = "Gartley Bearish";
Else If V1 >= 0.382 - 오차범위 and V1 <= 0.5 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.618 - 오차범위 and v3 <= 2.618 + 오차범위 and
V4 >= 0.886 - 오차범위 and V4 <= 0.886 + 오차범위 Then
Result = "Bat Bearish";
}
Else If 고점[2,1] < 고점[3,1] and 고점[3,1] < 고점[1,1] and
저점[2,1] < 저점[1,1] Then
{
If V1 >= 0.382 - 오차범위 and V1 <= 0.618 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.240 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Crab Bearish";
Else If V1 >= 0.786 - 오차범위 and V1 <= 0.786 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.618 - 오차범위 and v3 <= 2.618 + 오차범위 and
V4 >= 1.27 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Butterfly Bearish";
Else If V1 >= 0.886 - 오차범위 and V1 <= 0.886 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.240 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Deep Crab Bearish";
Else If V1 >= 0.382 - 오차범위 and V1 <= 0.382 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.0 - 오차범위 and V3 <= 3.168 + 오차범위 and
V4 >= 1.13 - 오차범위 and V4 <= 1.13 + 오차범위 Then
Result = "ALT BAT Bearish";
}
Else If 고점[2,1] < 고점[3,1] and 고점[2,1] < 고점[1,1] and
저점[1,1] < 저점[2,1] Then
{
If V2 >= 1.13 - 오차범위 and V2 <= 1.618 + 오차범위 and
V3 >= 1.618 - 오차범위 and V3 <= 2.24 + 오차범위 and
V4 >= 0.886 - 오차범위 and V4 <= 1.13 + 오차범위 Then
Result = "Shark Bearish";
}
If Result != "" Then
{
sBar = Index - 고점[3,2];
eBar = Index - 저점[2,2];
If TL_GetBeginDate(TL[1]) == sDate[sBar] and TL_GetBeginTime(TL[1]) == sTime[sBar] Then
{
For j = 1 To 8
{
TL_Delete(TL[j]);
If j < 6 Then Text_Delete(TX[j]);
}
}
TL[1] = TL_New(sDate[sBar],sTime[sBar],고점[3,1],sDate[eBar],sTime[eBar],저점[2,1]);
sBar = Index - 저점[2,2];
eBar = Index - 고점[2,2];
TL[2] = TL_New(sDate[sBar],sTime[sBar],저점[2,1],sDate[eBar],sTime[eBar],고점[2,1]);
sBar = Index - 고점[2,2];
eBar = Index - 저점[1,2];
TL[3] = TL_New(sDate[sBar],sTime[sBar],고점[2,1],sDate[eBar],sTime[eBar],저점[1,1]);
sBar = Index - 저점[1,2];
eBar = Index - 고점[1,2];
TL[4] = TL_New(sDate[sBar],sTime[sBar],저점[1,1],sDate[eBar],sTime[eBar],고점[1,1]);
sBar = Index - 고점[3,2];
eBar = Index - 고점[2,2];
TL[5] = TL_New(sDate[sBar],sTime[sBar],고점[3,1],sDate[eBar],sTime[eBar],고점[2,1]);
sBar = Index - 고점[2,2];
eBar = Index - 고점[1,2];
TL[6] = TL_New(sDate[sBar],sTime[sBar],고점[2,1],sDate[eBar],sTime[eBar],고점[1,1]);
sBar = Index - 고점[3,2];
eBar = Index - 고점[1,2];
TL[7] = TL_New(sDate[sBar],sTime[sBar],고점[3,1],sDate[eBar],sTime[eBar],고점[1,1]);
sBar = Index - 저점[2,2];
eBar = Index - 저점[1,2];
TL[8] = TL_New(sDate[sBar],sTime[sBar],저점[2,1],sDate[eBar],sTime[eBar],저점[1,1]);
sBar = Index - round((고점[3,2] + 고점[2,2])/2,0);
TX[1] = Text_New(sDate[sBar],sTime[sBar],(고점[3,1]+고점[2,1])/2,NumToStr(V1,4)+" XA");
sBar = Index - round((저점[2,2] + 저점[1,2])/2,0);
TX[2] = Text_New(sDate[sBar],sTime[sBar],(저점[2,1]+저점[1,1])/2,NumToStr(V2,4)+" AB");
sBar = Index - round((고점[2,2] + 고점[1,2])/2,0);
TX[3] = Text_New(sDate[sBar],sTime[sBar],(고점[2,1]+고점[1,1])/2,NumToStr(V3,4)+" BC");
sBar = Index - round((고점[3,2] + 고점[1,2])/2,0);
TX[4] = Text_New(sDate[sBar],sTime[sBar],(고점[3,1]+고점[1,1])/2,NumToStr(V4,4)+" XA");
sBar = Index - round((고점[3,2] + 고점[1,2])/2,0);
TX[5] = Text_New(sDate[sBar],sTime[sBar],(고점[3,1]+고점[2,1])/2,Result);
For j = 1 To 8
{
TL_SetColor(TL[j],BLUE);
}
Text_SetStyle(TX[1],2,0);
Text_SetStyle(TX[2],2,0);
Text_SetStyle(TX[3],2,0);
Text_SetStyle(TX[4],2,0);
Text_SetStyle(TX[5],2,2);
}
}
}
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;
XA = sqrt((고점[2,1]-저점[3,1])^2+(고점[2,2]-저점[3,2])^2);
AB = sqrt((고점[2,1]-저점[2,1])^2+(저점[2,2]-고점[2,2])^2);
BC = sqrt((고점[1,1]-저점[2,1])^2+(고점[1,2]-저점[2,2])^2);
CD = sqrt((고점[1,1]-저점[1,1])^2+(저점[1,2]-고점[1,2])^2);
V1 = AB/XA;
V2 = BC/AB;
V3 = CD/BC;
V4 = CD/XA;
Result = "";
If 저점[3,1] < 저점[1,1] and 저점[1,1] < 저점[2,1] and
고점[1,1] < 고점[2,1] Then
{
If V1 >= 0.618 - 오차범위 and V1 <= 0.618 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.13 - 오차범위 and V3 <= 1.618 + 오차범위 and
V4 >= 0.786 - 오차범위 and V4 <= 0.786 + 오차범위 Then
Result = "Gartley Bullish";
Else If V1 >= 0.382 - 오차범위 and V1 <= 0.5 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.618 - 오차범위 and v3 <= 2.618 + 오차범위 and
V4 >= 0.886 - 오차범위 and V4 <= 0.886 + 오차범위 Then
Result = "Bat Bullish";
}
Else If 저점[1,1] < 저점[3,1] and 저점[3,1] < 저점[2,1] and
고점[1,1] < 고점[2,1] Then
{
If V1 >= 0.382 - 오차범위 and V1 <= 0.618 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.240 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Crab Bullish";
Else If V1 >= 0.786 - 오차범위 and V1 <= 0.786 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.618 - 오차범위 and v3 <= 2.618 + 오차범위 and
V4 >= 1.27 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Butterfly Bullish";
Else If V1 >= 0.886 - 오차범위 and V1 <= 0.886 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.240 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Deep Crab Bullish";
Else If V1 >= 0.382 - 오차범위 and V1 <= 0.382 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.0 - 오차범위 and V3 <= 3.168 + 오차범위 and
V4 >= 1.13 - 오차범위 and V4 <= 1.13 + 오차범위 Then
Result = "ALT BAT Bullish";
}
Else If 저점[1,1] < 저점[2,1] and 저점[3,1] < 저점[2,1] and
고점[2,1] < 고점[1,1] Then
{
If V2 >= 1.13 - 오차범위 and V2 <= 1.618 + 오차범위 and
V3 >= 1.618 - 오차범위 and V3 <= 2.24 + 오차범위 and
V4 >= 0.886 - 오차범위 and V4 <= 1.13 + 오차범위 Then
Result = "Shark Bullish";
}
If Result != "" Then
{
sBar = Index - 저점[3,2];
eBar = Index - 고점[2,2];
If TL_GetBeginDate(TL[1]) == sDate[sBar] and TL_GetBeginTime(TL[1]) == sTime[sBar] Then
{
For j = 1 To 8 {
TL_Delete(TL[j]);
If j < 6 Then Text_Delete(TX[j]);
}
}
TL[1] = TL_New(sDate[sBar],sTime[sBar],저점[3,1],sDate[eBar],sTime[eBar],고점[2,1]);
sBar = Index - 고점[2,2];
eBar = Index - 저점[2,2];
TL[2] = TL_New(sDate[sBar],sTime[sBar],고점[2,1],sDate[eBar],sTime[eBar],저점[2,1]);
sBar = Index - 저점[2,2];
eBar = Index - 고점[1,2];
TL[3] = TL_New(sDate[sBar],sTime[sBar],저점[2,1],sDate[eBar],sTime[eBar],고점[1,1]);
sBar = Index - 고점[1,2];
eBar = Index - 저점[1,2];
TL[4] = TL_New(sDate[sBar],sTime[sBar],고점[1,1],sDate[eBar],sTime[eBar],저점[1,1]);
sBar = Index - 저점[3,2];
eBar = Index - 저점[2,2];
TL[5] = TL_New(sDate[sBar],sTime[sBar],저점[3,1],sDate[eBar],sTime[eBar],저점[2,1]);
sBar = Index - 저점[2,2];
eBar = Index - 저점[1,2];
TL[6] = TL_New(sDate[sBar],sTime[sBar],저점[2,1],sDate[eBar],sTime[eBar],저점[1,1]);
sBar = Index - 저점[3,2];
eBar = Index - 저점[1,2];
TL[7] = TL_New(sDate[sBar],sTime[sBar],저점[3,1],sDate[eBar],sTime[eBar],저점[1,1]);
sBar = Index - 고점[2,2];
eBar = Index - 고점[1,2];
TL[8] = TL_New(sDate[sBar],sTime[sBar],고점[2,1],sDate[eBar],sTime[eBar],고점[1,1]);
sBar = Index - round((저점[3,2] + 저점[2,2])/2,0);
TX[1] = Text_New(sDate[sBar],sTime[sBar],(저점[3,1]+저점[2,1])/2,NumToStr(V1,4)+" XA");
sBar = Index - round((고점[2,2] + 고점[1,2])/2,0);
TX[2] = Text_New(sDate[sBar],sTime[sBar],(고점[2,1]+고점[1,1])/2,NumToStr(V2,4)+" AB");
sBar = Index - round((저점[2,2] + 저점[1,2])/2,0);
TX[3] = Text_New(sDate[sBar],sTime[sBar],(저점[2,1]+저점[1,1])/2,NumToStr(V3,4)+" BC");
sBar = Index - round((저점[3,2] + 저점[1,2])/2,0);
TX[4] = Text_New(sDate[sBar],sTime[sBar],(저점[3,1]+저점[1,1])/2,NumToStr(V4,4)+" XA");
sBar = Index - round((저점[3,2] + 저점[1,2])/2,0);
TX[5] = Text_New(sDate[sBar],sTime[sBar],(저점[3,1]+저점[2,1])/2,Result);
For j = 1 To 8
{
TL_SetColor(TL[j],RED);
}
Text_SetStyle(TX[1],2,1);
Text_SetStyle(TX[2],2,1);
Text_SetStyle(TX[3],2,1);
Text_SetStyle(TX[4],2,1);
Text_SetStyle(TX[5],2,2);
}
}
}
For j = 1 To 4 {
TL_SetSize(TL[j],3);
}
For j = 5 To 8 {
TL_SetSize(TL[j],0);
TL_SetColor(TL[j],BLACK);
}
즐거운 하루되세요
> 파생돌이 님이 쓴 글입니다.
> 제목 : 부탁드립니다
> 수고하십니다
Gartely의 하모닉패턴(Bullish Gartley,Bearish Gartley) 수식 부탁드립니다