커뮤니티
수식 부탁드립니다
2018-06-06 15:45:06
396
글번호 119524
패턴이 완성된후 그림과같이 피보나치 라인이 나타나게 수식부탁드립니다
Input:length(20),오차범위(0.382);
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),V5(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
저점[1,1] > 저점[2,1] Then
{
If condition1= 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 = " Bearish Gartley ";
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 = "Bearish Bat";
}
Else If 고점[2,1] < 고점[1,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.618 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bearish Crab";
Else If V1 >= 0.786 - 오차범위 and V1 <= 0.786 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.618 - 오차범위 and v3 <= 2.24 + 오차범위 and
V4 >= 1.27 - 오차범위 and V4 <= 1.41 + 오차범위 Then
Result = "Bearish Butterfly";
Else If V1 >= 0.886 - 오차범위 and V1 <= 0.886 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.0 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bearish Deep Crab";
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 = "Bearish ALT BAT";
}
Else If 고점[2,1] < 고점[3,1] and 고점[2,1] < 고점[1,1] and 고점[3,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 = "Bearish Shark";
}
If Result != "" Then
{
TL_SetExtRight(TL[7],false);
TL_SetExtRight(TL[8],false);
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));
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));
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));
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));
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,5);
}
}
}
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 = "Bullish Gartley";
Else If 저점[3,1] < 저점[1,1] and 저점[1,1] < 저점[2,1] and
고점[1,1] < 고점[2,1] Then
{
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 = "Bullish Bat";
}
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.618 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bullish Crab";
Else If V1 >= 0.786 - 오차범위 and V1 <= 0.786 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.618 - 오차범위 and v3 <= 2.24 + 오차범위 and
V4 >= 1.27 - 오차범위 and V4 <= 1.41 + 오차범위 Then
Result = "Bullish Butterfly";
Else If V1 >= 0.886 - 오차범위 and V1 <= 0.886 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.0 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bullish Deep Crab";
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 = "Bullish ALT BAT";
}
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 = "Bullish Shark";
}
If Result != "" Then
{
TL_SetExtRight(TL[7],false);
TL_SetExtRight(TL[8],false);
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));
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));
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));
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));
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,0);
Text_SetStyle(TX[2],2,0);
Text_SetStyle(TX[3],2,0);
Text_SetStyle(TX[4],2,0);
Text_SetStyle(TX[5],2,5);
}
}
}
For j = 1 To 4 {
TL_SetSize(TL[j],1);
}
For j = 5 To 8 {
TL_SetSize(TL[j],1);
TL_SetColor(TL[j],GREEN);
TL_SetExtRight(TL[7],True);
TL_SetExtRight(TL[8],True);
}}
- 1. 캡처_2018_06_06_13_15_00_611.png (0.04 MB)
- 2. 캡처_2018_06_06_15_40_36_934.png (0.05 MB)
답변 1
예스스탁 예스스탁 답변
2018-06-07 14:47:30
안녕하세요
예스스탁입니다.
Input:length(20),오차범위(0.382);
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),V5(0),Result(""),t(0);
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
{
T = 1;
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
저점[1,1] > 저점[2,1] Then
{
If condition1= 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 = " Bearish Gartley ";
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 = "Bearish Bat";
}
Else If 고점[2,1] < 고점[1,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.618 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bearish Crab";
Else If V1 >= 0.786 - 오차범위 and V1 <= 0.786 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.618 - 오차범위 and v3 <= 2.24 + 오차범위 and
V4 >= 1.27 - 오차범위 and V4 <= 1.41 + 오차범위 Then
Result = "Bearish Butterfly";
Else If V1 >= 0.886 - 오차범위 and V1 <= 0.886 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.0 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bearish Deep Crab";
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 = "Bearish ALT BAT";
}
Else If 고점[2,1] < 고점[3,1] and 고점[2,1] < 고점[1,1] and 고점[3,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 = "Bearish Shark";
}
If Result != "" Then
{
TL_SetExtRight(TL[7],false);
TL_SetExtRight(TL[8],false);
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));
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));
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));
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));
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,5);
}
}
}
If 처리구분 == "저점처리" Then
{
T = -1;
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 = "Bullish Gartley";
Else If 저점[3,1] < 저점[1,1] and 저점[1,1] < 저점[2,1] and
고점[1,1] < 고점[2,1] Then
{
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 = "Bullish Bat";
}
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.618 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bullish Crab";
Else If V1 >= 0.786 - 오차범위 and V1 <= 0.786 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.618 - 오차범위 and v3 <= 2.24 + 오차범위 and
V4 >= 1.27 - 오차범위 and V4 <= 1.41 + 오차범위 Then
Result = "Bullish Butterfly";
Else If V1 >= 0.886 - 오차범위 and V1 <= 0.886 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.0 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bullish Deep Crab";
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 = "Bullish ALT BAT";
}
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 = "Bullish Shark";
}
If Result != "" Then
{
TL_SetExtRight(TL[7],false);
TL_SetExtRight(TL[8],false);
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));
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));
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));
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));
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,0);
Text_SetStyle(TX[2],2,0);
Text_SetStyle(TX[3],2,0);
Text_SetStyle(TX[4],2,0);
Text_SetStyle(TX[5],2,5);
}
}
}
For j = 1 To 4 {
TL_SetSize(TL[j],1);
}
For j = 5 To 8 {
TL_SetSize(TL[j],1);
TL_SetColor(TL[j],GREEN);
TL_SetExtRight(TL[7],True);
TL_SetExtRight(TL[8],True);
}}
var : sd(0),st(0),ed(0),et(0),hh(0),ll(0),mm(0);
var : tt1(0),tt2(0),tt3(0),tt4(0),tt5(0),tt6(0),tt7(0),tt8(0),tt9(0),tt10(0);
var : xx1(0),xx2(0),xx3(0),xx4(0),xx5(0),xx6(0),xx7(0),xx8(0),xx9(0),xx10(0);
if T != T[1] then
{
if 고점[1,2] < 저점[1,2] then
{
sd = sdate[index-고점[1,2]];
st = stime[index-고점[1,2]];
ed = sdate[index-저점[1,2]];
et = stime[index-저점[1,2]];
hh = 고점[1,1];
ll = 저점[1,1];
mm = hh-ll;
TL_Delete(tt1);
TL_Delete(tt2);
TL_Delete(tt3);
TL_Delete(tt4);
TL_Delete(tt5);
TL_Delete(tt6);
TL_Delete(tt7);
TL_Delete(tt8);
TL_Delete(tt9);
TL_Delete(tt10);
tt1 = TL_New(sd,st,ll,ed,et,ll);
tt2 = TL_New(sd,st,ll+mm*0.382,ed,et,ll+mm*0.382);
tt3 = TL_New(sd,st,ll+mm*0.500,ed,et,ll+mm*0.500);
tt4 = TL_New(sd,st,ll+mm*0.618,ed,et,ll+mm*0.618);
tt5 = TL_New(sd,st,ll+mm*0.786,ed,et,ll+mm*0.786);
tt6 = TL_New(sd,st,ll+mm*0.886,ed,et,ll+mm*0.886);
tt7 = TL_New(sd,st,hh,ed,et,hh);
tt8 = TL_New(sd,st,ll+mm*1.130,ed,et,ll+mm*1.130);
tt9 = TL_New(sd,st,ll+mm*1.270,ed,et,ll+mm*1.270);
tt10 = TL_New(sd,st,ll+mm*1.618,ed,et,ll+mm*1.618);
TL_SetExtRight(tt1,true);
TL_SetExtRight(tt2,true);
TL_SetExtRight(tt3,true);
TL_SetExtRight(tt4,true);
TL_SetExtRight(tt5,true);
TL_SetExtRight(tt6,true);
TL_SetExtRight(tt7,true);
TL_SetExtRight(tt8,true);
TL_SetExtRight(tt9,true);
TL_SetExtRight(tt10,true);
Text_Delete(xx1);
Text_Delete(xx2);
Text_Delete(xx3);
Text_Delete(xx4);
Text_Delete(xx5);
Text_Delete(xx6);
Text_Delete(xx7);
Text_Delete(xx8);
Text_Delete(xx9);
Text_Delete(xx10);
xx1 = Text_New(ed,et,ll,"0.00% ("+NumToStr(ll,4)+")");
xx2 = Text_New(ed,et,ll+mm*0.382,"38.2% ("+NumToStr(ll+mm*0.382,4)+")");
xx3 = Text_New(ed,et,ll+mm*0.500,"50.0% ("+NumToStr(ll+mm*0.500,4)+")");
xx4 = Text_New(ed,et,ll+mm*0.618,"61.8% ("+NumToStr(ll+mm*0.618,4)+")");
xx5 = Text_New(ed,et,ll+mm*0.786,"78.6% ("+NumToStr(ll+mm*0.786,4)+")");
xx6 = Text_New(ed,et,ll+mm*0.886,"88.6% ("+NumToStr(ll+mm*0.886,4)+")");
xx7 = Text_New(ed,et,hh,"100.0% ("+NumToStr(hh,4)+")");
xx8 = Text_New(ed,et,ll+mm*1.130,"113.0% ("+NumToStr(ll+mm*1.130,4)+")");
xx9 = Text_New(ed,et,ll+mm*1.270,"127.0% ("+NumToStr(ll+mm*1.270,4)+")");
xx10 = Text_New(ed,et,ll+mm*1.618,"161.8% ("+NumToStr(ll+mm*1.618,4)+")");
}
if 고점[1,2] > 저점[1,2] then
{
sd = sdate[index-저점[1,2]];
st = stime[index-저점[1,2]];
ed = sdate[index-고점[1,2]];
et = stime[index-고점[1,2]];
hh = 고점[1,1];
ll = 저점[1,1];
mm = hh-ll;
TL_Delete(tt1);
TL_Delete(tt2);
TL_Delete(tt3);
TL_Delete(tt4);
TL_Delete(tt5);
TL_Delete(tt6);
TL_Delete(tt7);
TL_Delete(tt8);
TL_Delete(tt9);
TL_Delete(tt10);
tt1 = TL_New(sd,st,hh,ed,et,hh);
tt2 = TL_New(sd,st,hh-mm*0.382,ed,et,hh-mm*0.382);
tt3 = TL_New(sd,st,hh-mm*0.500,ed,et,hh-mm*0.500);
tt4 = TL_New(sd,st,hh-mm*0.618,ed,et,hh-mm*0.618);
tt5 = TL_New(sd,st,hh-mm*0.786,ed,et,hh-mm*0.786);
tt6 = TL_New(sd,st,hh-mm*0.886,ed,et,hh-mm*0.886);
tt7 = TL_New(sd,st,ll,ed,et,ll);
tt8 = TL_New(sd,st,hh-mm*1.130,ed,et,hh-mm*1.130);
tt9 = TL_New(sd,st,hh-mm*1.270,ed,et,hh-mm*1.270);
tt10 = TL_New(sd,st,hh-mm*1.618,ed,et,hh-mm*1.618);
TL_SetExtRight(tt1,true);
TL_SetExtRight(tt2,true);
TL_SetExtRight(tt3,true);
TL_SetExtRight(tt4,true);
TL_SetExtRight(tt5,true);
TL_SetExtRight(tt6,true);
TL_SetExtRight(tt7,true);
TL_SetExtRight(tt8,true);
TL_SetExtRight(tt9,true);
TL_SetExtRight(tt10,true);
Text_Delete(xx1);
Text_Delete(xx2);
Text_Delete(xx3);
Text_Delete(xx4);
Text_Delete(xx5);
Text_Delete(xx6);
Text_Delete(xx7);
Text_Delete(xx8);
Text_Delete(xx9);
Text_Delete(xx10);
xx1 = Text_New(ed,et,hh,"0.00% ("+NumToStr(hh,4)+")");
xx2 = Text_New(ed,et,hh-mm*0.382,"38.2% ("+NumToStr(hh-mm*0.382,4)+")");
xx3 = Text_New(ed,et,hh-mm*0.500,"50.0% ("+NumToStr(hh-mm*0.500,4)+")");
xx4 = Text_New(ed,et,hh-mm*0.618,"61.8% ("+NumToStr(hh-mm*0.618,4)+")");
xx5 = Text_New(ed,et,hh-mm*0.786,"78.6% ("+NumToStr(hh-mm*0.786,4)+")");
xx6 = Text_New(ed,et,hh-mm*0.886,"88.6% ("+NumToStr(hh-mm*0.886,4)+")");
xx7 = Text_New(ed,et,ll,"100.0% ("+NumToStr(ll,4)+")");
xx8 = Text_New(ed,et,hh-mm*1.130,"113.0% ("+NumToStr(hh-mm*1.130,4)+")");
xx9 = Text_New(ed,et,hh-mm*1.270,"127.0% ("+NumToStr(hh-mm*1.270,4)+")");
xx10 = Text_New(ed,et,hh-mm*1.618,"161.8% ("+NumToStr(hh-mm*1.618,4)+")");
}
}
즐거운 하루되세요
> 수색대대 님이 쓴 글입니다.
> 제목 : 수식 부탁드립니다
> 패턴이 완성된후 그림과같이 피보나치 라인이 나타나게 수식부탁드립니다
Input:length(20),오차범위(0.382);
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),V5(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
저점[1,1] > 저점[2,1] Then
{
If condition1= 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 = " Bearish Gartley ";
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 = "Bearish Bat";
}
Else If 고점[2,1] < 고점[1,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.618 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bearish Crab";
Else If V1 >= 0.786 - 오차범위 and V1 <= 0.786 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.618 - 오차범위 and v3 <= 2.24 + 오차범위 and
V4 >= 1.27 - 오차범위 and V4 <= 1.41 + 오차범위 Then
Result = "Bearish Butterfly";
Else If V1 >= 0.886 - 오차범위 and V1 <= 0.886 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.0 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bearish Deep Crab";
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 = "Bearish ALT BAT";
}
Else If 고점[2,1] < 고점[3,1] and 고점[2,1] < 고점[1,1] and 고점[3,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 = "Bearish Shark";
}
If Result != "" Then
{
TL_SetExtRight(TL[7],false);
TL_SetExtRight(TL[8],false);
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));
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));
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));
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));
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,5);
}
}
}
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 = "Bullish Gartley";
Else If 저점[3,1] < 저점[1,1] and 저점[1,1] < 저점[2,1] and
고점[1,1] < 고점[2,1] Then
{
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 = "Bullish Bat";
}
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.618 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bullish Crab";
Else If V1 >= 0.786 - 오차범위 and V1 <= 0.786 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 1.618 - 오차범위 and v3 <= 2.24 + 오차범위 and
V4 >= 1.27 - 오차범위 and V4 <= 1.41 + 오차범위 Then
Result = "Bullish Butterfly";
Else If V1 >= 0.886 - 오차범위 and V1 <= 0.886 + 오차범위 and
V2 >= 0.382 - 오차범위 and V2 <= 0.886 + 오차범위 and
V3 >= 2.0 - 오차범위 and V3 <= 3.618 + 오차범위 and
V4 >= 1.618 - 오차범위 and V4 <= 1.618 + 오차범위 Then
Result = "Bullish Deep Crab";
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 = "Bullish ALT BAT";
}
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 = "Bullish Shark";
}
If Result != "" Then
{
TL_SetExtRight(TL[7],false);
TL_SetExtRight(TL[8],false);
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));
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));
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));
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));
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,0);
Text_SetStyle(TX[2],2,0);
Text_SetStyle(TX[3],2,0);
Text_SetStyle(TX[4],2,0);
Text_SetStyle(TX[5],2,5);
}
}
}
For j = 1 To 4 {
TL_SetSize(TL[j],1);
}
For j = 5 To 8 {
TL_SetSize(TL[j],1);
TL_SetColor(TL[j],GREEN);
TL_SetExtRight(TL[7],True);
TL_SetExtRight(TL[8],True);
}}