예스스탁
예스스탁 답변
2023-08-16 10:45:15
안녕하세요
예스스탁입니다.
수식 작성하실때 동일이름 변수가
기존에 사용중인지 확인하시기 바랍니다
Condition1 = 저[1,1]+전환 <= HH and hiBar == 0;
Condition2 = 고[1,1]-전환 >= LL and loBar == 0;
해당식에서 Condition1,Condition2가 이미 다른 용도로 사용중인데
해당 변수와 동일한 이름을 사용하고 있습니다.
Condition3,Condition4로 변경해 드립니다.
Input : 전환(0.4);
Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""), TL(0),TX(0);
Array:고[10,4](0),저[10,4](0);
var : btx1(0),btx2(0),btx3(0),btx11(0),btx12(0),btx13(0),btx14(0),btx21(0),btx22(0),btx23(0),btx24(0);
var : stx1(0),stx2(0),stx3(0),stx11(0),stx12(0),stx13(0),stx14(0),stx21(0),stx22(0),stx23(0),stx24(0);
HH = H;
LL = L;
If Index == 0 Then
{
고[1,1] = HH;
고[1,2] = 0;
고[1,3] = sDate;
고[1,4] = sTime;
저[1,1] = LL;
저[1,2] = 0;
저[1,3] = sDate;
저[1,4] = sTime;
}
If Index > 0 Then
{
hiBar = hiBar + 1;
loBar = loBar + 1;
}
If HH[hiBar] < HH Then hiBar = 0;
If LL[loBar] > LL Then loBar = 0;
Condition1 = 저[1,1]+전환 <= HH and hiBar == 0;
Condition2 = 고[1,1]-전환 >= LL and loBar == 0;
처리구분 = "";
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
{
If 최종꼭지점 == "저점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
고[j,jj] = 고[j-1,jj];
}
}
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
TL = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]);
TL_SetSize(TL,2);
TL_SetColor(TL,Red);
Condition4 = False;
}
If 고[1,1] < HH[hiBar] Then
{
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
TL_SetEnd(TL,고[1,3],고[1,4],고[1,1]);
}
if 고[1,1] > 0 and 저[1,1] > 0 and 고[1,1] >= 저[1,1]+0.95 Then
{
if Condition4 == False Then
{
Condition4 = true;
btx11 = Text_New(고[1,3],고[1,4],저[1,1]+abs(고[1,1]-저[1,1])*1.618,"■");
btx12 = Text_New(고[1,3],고[1,4],저[1,1]+abs(고[1,1]-저[1,1])*0.618,"■");
btx13 = Text_New(고[1,3],고[1,4],저[1,1]+abs(고[1,1]-저[1,1])*2,"■");
btx1 = Text_New(고[1,3],고[1,4],저[1,1]+abs(고[1,1]-저[1,1]),"■");
btx2 = Text_New(고[1,3],고[1,4],고[1,1]-abs(고[1,1]-저[1,1]),"■");
btx21 = Text_New(고[1,3],고[1,4],고[1,1]-abs(고[1,1]-저[1,1])*1.618,"■");
btx22 = Text_New(고[1,3],고[1,4],고[1,1]-abs(고[1,1]-저[1,1])*0.618,"■");
btx23 = Text_New(고[1,3],고[1,4],저[1,1]-abs(고[1,1]-저[1,1])*0.5,"■");
btx24 = Text_New(고[1,3],고[1,4],고[1,1]-abs(고[1,1]-저[1,1])*2,"■");
Text_SetStyle(btx11,2,2);
Text_SetStyle(btx12,2,2);
Text_SetStyle(btx1,2,2);
Text_SetStyle(btx2,2,2);
Text_SetStyle(btx21,2,2);
Text_SetStyle(btx22,2,2);
Text_SetStyle(btx23,2,2);
Text_SetStyle(btx13,2,2);
Text_SetStyle(btx24,2,2);
Text_SetColor(btx11,Lime);
Text_SetColor(btx12,Lime);
Text_SetColor(btx1,Red);
Text_SetColor(btx2,Red);
Text_SetColor(btx21,Lime);
Text_SetColor(btx22,Lime);
Text_SetColor(btx23,Green);
Text_SetColor(btx13,Red);
Text_SetColor(btx24,Red);
}
Else
{
Text_SetLocation(btx11 , 고[1,3],고[1,4],저[1,1]+abs(고[1,1]-저[1,1])*1.618);
Text_SetLocation(btx12 , 고[1,3],고[1,4],저[1,1]+abs(고[1,1]-저[1,1])*0.618);
Text_SetLocation(btx13 , 고[1,3],고[1,4],저[1,1]+abs(고[1,1]-저[1,1])*2);
Text_SetLocation(btx1 , 고[1,3],고[1,4],저[1,1]+abs(고[1,1]-저[1,1]));
Text_SetLocation(btx2 , 고[1,3],고[1,4],고[1,1]-abs(고[1,1]-저[1,1]));
Text_SetLocation(btx21 , 고[1,3],고[1,4],고[1,1]-abs(고[1,1]-저[1,1])*1.618);
Text_SetLocation(btx22 , 고[1,3],고[1,4],고[1,1]-abs(고[1,1]-저[1,1])*0.618);
Text_SetLocation(btx23 , 고[1,3],고[1,4],저[1,1]-abs(고[1,1]-저[1,1])*0.5);
Text_SetLocation(btx24 , 고[1,3],고[1,4],고[1,1]-abs(고[1,1]-저[1,1])*2);
}
}
최종꼭지점 = "고점";
Plot1(고[1,1]);
NoPlot(2);
}
If 처리구분 == "저점처리" Then
{
If 최종꼭지점 == "고점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
저[j,jj] = 저[j-1,jj];
}
}
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
TL = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]);
TL_SetSize(TL,2);
TL_SetColor(TL,Blue);
Condition3 = False;
}
If 저[1,1] > LL[loBar] Then
{
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
TL_SetEnd(TL,저[1,3],저[1,4],저[1,1]);
}
if 고[1,1] > 0 and 저[1,1] > 0 and 저[1,1] <= 고[1,1]-0.95 Then
{
if Condition3 == False Then
{
Condition3 = true;
stx11 = Text_New(저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*1.618,"■");
stx12 = Text_New(저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*0.618,"■");
stx13 = Text_New(저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1])*0.5,"■");
stx14 = Text_New(저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*2,"■");
stx1 = Text_New(저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1]),"■");
stx2 = Text_New(저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1]),"■");
stx21 = Text_New(저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*1.618,"■");
stx22 = Text_New(저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*0.618,"■");
stx24 = Text_New(저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*2,"■");
Text_SetStyle(stx11,2,2);
Text_SetStyle(stx12,2,2);
Text_SetStyle(stx13,2,2);
Text_SetStyle(stx14,2,2);
Text_SetStyle(stx1,2,2);
Text_SetStyle(stx2,2,2);
Text_SetStyle(stx21,2,2);
Text_SetStyle(stx22,2,2);
Text_SetStyle(stx24,2,2);
Text_SetColor(stx11,Lime);
Text_SetColor(stx12,Lime);
Text_SetColor(stx13,Green);
Text_SetColor(stx1,Blue);
Text_SetColor(stx2,Blue);
Text_SetColor(stx21,Lime);
Text_SetColor(stx22,Lime);
Text_SetColor(stx14,Blue);
Text_SetColor(stx24,Blue);
}
Else
{
Text_SetLocation(stx11, 저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*1.618);
Text_SetLocation(stx12, 저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*0.618);
Text_SetLocation(stx13, 저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1])*0.5);
Text_SetLocation(stx14, 저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*2);
Text_SetLocation(stx1, 저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1]));
Text_SetLocation(stx2, 저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1]));
Text_SetLocation(stx21, 저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*1.618);
Text_SetLocation(stx22, 저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*0.618);
Text_SetLocation(stx23, 저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*2);
}
}
최종꼭지점 = "저점";
Plot2(저[1,1]);
NoPlot(1);
}
즐거운 하루되세요
> 고성 님이 쓴 글입니다.
> 제목 : 전환추세 상하대칭
> Input : 전환(0.4);
Var:j(0),jj(0),HH(0),LL(0),hiBar(0),loBar(0),최종꼭지점(""),처리구분(""), TL(0),TX(0);
Array:고[10,4](0),저[10,4](0);
var : btx1(0),btx2(0),btx3(0),btx11(0),btx12(0),btx13(0),btx14(0),btx21(0),btx22(0),btx23(0),btx24(0);
HH = H;
LL = L;
If Index == 0 Then
{
고[1,1] = HH;
고[1,2] = 0;
고[1,3] = sDate;
고[1,4] = sTime;
저[1,1] = LL;
저[1,2] = 0;
저[1,3] = sDate;
저[1,4] = sTime;
}
If Index > 0 Then
{
hiBar = hiBar + 1;
loBar = loBar + 1;
}
If HH[hiBar] < HH Then hiBar = 0;
If LL[loBar] > LL Then loBar = 0;
Condition1 = 저[1,1]+전환 <= HH and hiBar == 0;
Condition2 = 고[1,1]-전환 >= LL and loBar == 0;
처리구분 = "";
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
{
If 최종꼭지점 == "저점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
고[j,jj] = 고[j-1,jj];
}
}
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
TL = TL_New(저[1,3],저[1,4],저[1,1],고[1,3],고[1,4],고[1,1]);
TL_SetSize(TL,2);
TL_SetColor(TL,Red);
Condition2 = False;
}
if 고[1,1] > 0 and 저[1,1] > 0 and Condition2 == False and 고[1,1] >= 저[1,1]+0.95 Then
{
Condition2 = true;
btx11 = Text_New(저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*1.618,"■");
btx12 = Text_New(저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*0.618,"■");
btx13 = Text_New(저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*2,"■");
btx1 = Text_New(저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1]),"■");
btx2 = Text_New(저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1]),"■");
btx21 = Text_New(저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*1.618,"■");
btx22 = Text_New(저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*0.618,"■");
btx23 = Text_New(저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1])*0.5,"■");
btx24 = Text_New(저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*2,"■");
Text_SetStyle(btx11,2,2);
Text_SetStyle(btx12,2,2);
Text_SetStyle(btx1,2,2);
Text_SetStyle(btx2,2,2);
Text_SetStyle(btx21,2,2);
Text_SetStyle(btx22,2,2);
Text_SetStyle(btx23,2,2);
Text_SetStyle(btx13,2,2);
Text_SetStyle(btx24,2,2);
Text_SetColor(btx11,Lime);
Text_SetColor(btx12,Lime);
Text_SetColor(btx1,Red);
Text_SetColor(btx2,Red);
Text_SetColor(btx21,Lime);
Text_SetColor(btx22,Lime);
Text_SetColor(btx23,Green);
Text_SetColor(btx13,Red);
Text_SetColor(btx24,Red);
}
If 고[1,1] < HH[hiBar] Then
{
고[1,1] = HH[hiBar];
고[1,2] = Index - hiBar;
고[1,3] = sDate[hiBar];
고[1,4] = sTime[hiBar];
hiBar = -1;
loBar = -1;
TL_SetEnd(TL,고[1,3],고[1,4],고[1,1]);
if Condition2 == true Then
{
Text_SetLocation(btx11, 저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*1.618);
Text_SetLocation(btx12, 저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*0.618);
Text_SetLocation(btx13, 저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1])*2);
Text_SetLocation(btx1, 저[1,3],저[1,4],저[1,1]+abs(고[1,1]-저[1,1]));
Text_SetLocation(btx2, 저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1]));
Text_SetLocation(btx21, 저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*1.618);
Text_SetLocation(btx22, 저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*0.618);
Text_SetLocation(btx23, 저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1])*0.5);
Text_SetLocation(btx24, 저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*2);
}
}
최종꼭지점 = "고점";
Plot1(고[1,1]);
NoPlot(2);
}
If 처리구분 == "저점처리" Then
{
If 최종꼭지점 == "고점" Then
{
For j = 10 DownTo 2
{
For jj = 1 To 4
{
저[j,jj] = 저[j-1,jj];
}
}
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
TL = TL_New(고[1,3],고[1,4],고[1,1],저[1,3],저[1,4],저[1,1]);
TL_SetSize(TL,2);
TL_SetColor(TL,Blue);
Condition1 = False;
}
if 고[1,1] > 0 and 저[1,1] > 0 and Condition1 == False and 저[1,1] <= 고[1,1]-0.95 Then
{
Condition1 = true;
btx11 = Text_New(저[1,3],저[1,4],고[1,1]+abs(고[1,1]-저[1,1])*1.618,"■");
btx12 = Text_New(저[1,3],저[1,4],고[1,1]+abs(고[1,1]-저[1,1])*0.618,"■");
btx13 = Text_New(저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*0.5,"■");
btx14 = Text_New(저[1,3],저[1,4],고[1,1]+abs(고[1,1]-저[1,1])*2,"■");
btx1 = Text_New(저[1,3],저[1,4],고[1,1]+abs(고[1,1]-저[1,1]),"■");
btx2 = Text_New(저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1]),"■");
btx21 = Text_New(저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1])*1.618,"■");
btx22 = Text_New(저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1])*0.618,"■");
btx24 = Text_New(저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1])*2,"■");
Text_SetStyle(btx11,2,2);
Text_SetStyle(btx12,2,2);
Text_SetStyle(btx13,2,2);
Text_SetStyle(btx14,2,2);
Text_SetStyle(btx1,2,2);
Text_SetStyle(btx2,2,2);
Text_SetStyle(btx21,2,2);
Text_SetStyle(btx22,2,2);
Text_SetStyle(btx24,2,2);
Text_SetColor(btx11,Lime);
Text_SetColor(btx12,Lime);
Text_SetColor(btx13,Green);
Text_SetColor(btx1,Blue);
Text_SetColor(btx2,Blue);
Text_SetColor(btx21,Lime);
Text_SetColor(btx22,Lime);
Text_SetColor(btx14,Blue);
Text_SetColor(btx24,Blue);
}
If 저[1,1] > LL[loBar] Then
{
저[1,1] = LL[loBar];
저[1,2] = Index - loBar;
저[1,3] = sDate[loBar];
저[1,4] = sTime[loBar];
hiBar = -1;
loBar = -1;
if Condition1 == true Then
{
Text_SetLocation(btx11, 저[1,3],저[1,4],고[1,1]+abs(고[1,1]-저[1,1])*1.618);
Text_SetLocation(btx12, 저[1,3],저[1,4],고[1,1]+abs(고[1,1]-저[1,1])*0.618);
Text_SetLocation(btx13, 저[1,3],저[1,4],고[1,1]-abs(고[1,1]-저[1,1])*0.5);
Text_SetLocation(btx14, 저[1,3],저[1,4],고[1,1]+abs(고[1,1]-저[1,1])*2);
Text_SetLocation(btx1, 저[1,3],저[1,4],고[1,1]+abs(고[1,1]-저[1,1]));
Text_SetLocation(btx2, 저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1]));
Text_SetLocation(btx21, 저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1])*1.618);
Text_SetLocation(btx22, 저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1])*0.618);
Text_SetLocation(btx24, 저[1,3],저[1,4],저[1,1]-abs(고[1,1]-저[1,1])*2);
}
TL_SetEnd(TL,저[1,3],저[1,4],저[1,1]);
}
최종꼭지점 = "저점";
Plot2(저[1,1]);
NoPlot(1);
}
추세선이 0.95p 이상 커지면(작으면 무시), 그 크기의 0.618배, 배, 1.618배, 2배 지점을, 추세선 상하단으로부터 위아래에 표시. 수정 부탁드립니다.