예스스탁
예스스탁 답변
2023-02-22 11:15:49
안녕하세요
예스스탁입니다.
상승/하락 박스의 아이디를 box1,box2로 각각 처리되었는데
삭제후 동일아이디가 재사용되어서 하락박스가 삭제되었습니다.
동일변수에 저장해서 재사용 안되도록 수정했습니다.
input : Period(120);
Var:j(0),T(0);
Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0),tl9(0),
date21(0),date22(0),time21(0),time22(0),txx(0), vTL(0), vTL9(0),txxx(0),
date31(0),date32(0),time31(0),time32(0),tx(0),tx1(0),tl4(0),tx4(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
var : box(0);
Plot1(value12);
For j = 0 To 19
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if crossup(c,highest(H,Period)[1]) Then
T = 1;
if CrossDown(c,Lowest(L,Period)[1]) Then
T = -1;
If T == -1 Then
{
If T[1] != -1 Then
{
if Condition99 == true Then
Box_Delete(box);
For j = 18 DownTo 0
{
LoVal[j+1] = LoVal[j];
LoBar[j+1] = LoBar[j];
}
LoVal[0] = L;
LoBar[0] = 0;
date11 = date[HiBar[0]];
time11 = stime[HiBar[0]];
Value11 = HiVal[0];
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
date21 = date[HiBar[0]];
time21 = stime[HiBar[0]];
date22 = date[0];
time22 = stime[0];
Condition88 = False;
if Condition88 ==False Then
{
if value12 <= value11-0.85 Then
{
Condition88 = true;
box = Box_New(date12,time12,H,NextBarSdate,NextBarStime,L);
Box_SetColor(box,Lime);
Box_SetFill(box,true,30);
Box_SetExtFill(box,true);
}
}
}
Else
{
If LoVal[0] > L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
date22 = date[0];
time22 = stime[0];
if Condition88 ==False Then
{
if value12 <= value11-0.85 Then
{
Condition88 = true;
box = Box_New(date12,time12,H,NextBarSdate,NextBarStime,L);
Box_SetColor(box,Lime);
Box_SetFill(box,true,30);
Box_SetExtFill(box,true);
}
}
}
if Condition88 == true Then
Box_SetEnd(box,date12,time12,L);
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
For j = 18 DownTo 0
{
HiVal[j+1] = HiVal[j];
HiBar[j+1] = HiBar[j];
}
HiVal[0] = H;
HiBar[0] = 0;
date11 = date[LoBar[0]];
time11 = stime[LoBar[0]];
Value11 = LoVal[0];
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
date31 = date[LoBar[0]];
time31 = stime[LoBar[0]];
date32 = date[0];
time32 = stime[0];
Condition99 = False;
if Condition99 ==False Then
{
if value12 >= value11+0.85 Then
{
Condition99 = true;
box = Box_New(date12,time12,H,NextBarSdate,NextBarStime,L);
Box_SetColor(box,Magenta);
Box_SetFill(box,true,30);
Box_SetExtFill(box,true);
}
}
}
Else
{
If HiVal[0] < H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
date32 = date[0];
time32 = stime[0];
if Condition99 == False Then
{
if value12 >= value11+0.85 Then
{
Condition99 = true;
box = Box_New(date12,time12,H,NextBarSdate,NextBarStime,L);
Box_SetColor(box,Magenta);
Box_SetFill(box,true,30);
Box_SetExtFill(box,true);
}
}
}
if Condition99 == true Then
Box_SetEnd(box,date12,time12,Value12);
}
}
즐거운 하루되세요
> 고성 님이 쓴 글입니다.
> 제목 : 박스 저장
> input : Period(120);
Var:j(0),T(0);
Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0),tl9(0),
date21(0),date22(0),time21(0),time22(0),txx(0), vTL(0), vTL9(0),txxx(0),
date31(0),date32(0),time31(0),time32(0),tx(0),tx1(0),tl4(0),tx4(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
var :box1(0),box2(0);
Plot1(value12);
For j = 0 To 19
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if crossup(c,highest(H,Period)[1]) Then
T = 1;
if CrossDown(c,Lowest(L,Period)[1]) Then
T = -1;
If T == -1 Then
{
If T[1] != -1 Then
{
Box_Delete(box2);
For j = 18 DownTo 0
{
LoVal[j+1] = LoVal[j];
LoBar[j+1] = LoBar[j];
}
LoVal[0] = L;
LoBar[0] = 0;
date11 = date[HiBar[0]];
time11 = stime[HiBar[0]];
Value11 = HiVal[0];
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
date21 = date[HiBar[0]];
time21 = stime[HiBar[0]];
date22 = date[0];
time22 = stime[0];
Condition88 = False;
if Condition88 ==False Then
{
if value12 <= value11-0.85 Then
{
Condition88 = true;
box1 = Box_New(date12,time12,H,NextBarSdate,NextBarStime,L);
Box_SetColor(box1,Lime);
Box_SetFill(box1,true,30);
Box_SetExtFill(box1,true);
}
}
}
Else
{
If LoVal[0] > L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
date22 = date[0];
time22 = stime[0];
if Condition88 ==False Then
{
if value12 <= value11-0.85 Then
{
Condition88 = true;
box1 = Box_New(date12,time12,H,NextBarSdate,NextBarStime,L);
Box_SetColor(box1,Lime);
Box_SetFill(box1,true,30);
Box_SetExtFill(box1,true);
}
}
}
if Condition88 == true Then
Box_SetEnd(box1,date12,time12,L);
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
For j = 18 DownTo 0
{
HiVal[j+1] = HiVal[j];
HiBar[j+1] = HiBar[j];
}
HiVal[0] = H;
HiBar[0] = 0;
date11 = date[LoBar[0]];
time11 = stime[LoBar[0]];
Value11 = LoVal[0];
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
date31 = date[LoBar[0]];
time31 = stime[LoBar[0]];
date32 = date[0];
time32 = stime[0];
Condition99 = False;
if Condition99 ==False Then
{
if value12 >= value11+0.85 Then
{
Condition99 = true;
box2 = Box_New(date12,time12,H,NextBarSdate,NextBarStime,L);
Box_SetColor(box2,Magenta);
Box_SetFill(box2,true,30);
Box_SetExtFill(box2,true);
}
}
}
Else
{
If HiVal[0] < H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
date32 = date[0];
time32 = stime[0];
if Condition99 == False Then
{
if value12 >= value11+0.85 Then
{
Condition99 = true;
box2 = Box_New(date12,time12,H,NextBarSdate,NextBarStime,L);
Box_SetColor(box2,Magenta);
Box_SetFill(box2,true,30);
Box_SetExtFill(box2,true);
}
}
}
if Condition99 == true Then
Box_SetEnd(box2,date12,time12,Value12);
}
}
추세선의 크기가 0.85p에 도달할 때부터 그 추세선이 끝나는 지점까지 박스를 표시했다가,
상승추세선에서 생성된 박스는 음전환시 모두 삭제하고,
하락추세선에서 생성된 박스는 양전환시 모두 저장하는 수식입니다.
박스 표시 크기 양호하고, 상승추세선 박스 음전환시 삭제도 양호합니다.
24줄에 있는 Box_Delete(box2); 를 삭제하고 보면 박스 생성은 완벽합니다.(파일참조)
다만, 하락추세선에서 생성된 박스의 양전환시 저장이 일부만 되고 대부분 안됩니다.
수정 부탁드립니다.