예스스탁
예스스탁 답변
2025-02-11 14:19:28
안녕하세요
예스스탁입니다.
박스와 추세선 아이디가 겹치는 문제가 있어
다른 방법으로 처리해 드립니다.
input : Period(130);
Var:j(0),T(0),tx(0),tx1(0),box(0),TTL(0),upt(0),dnt(0);
Var: date11(0),date12(0),time11(0),time12(0),
date21(0),date22(0),time21(0),time22(0),
date31(0),date32(0),time31(0),time32(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
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
{
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];
Text_Delete(dnt);
var1 = loval[0]-loval[1];
dnt = Text_New(date12,time12,value12,NewLine+NumToStr(abs(var1/PriceScale),0)+" "+NewLine);
Text_SetColor(dnt,iff(var1>0,Magenta,Blue));
Text_SetStyle(dnt,1,2);
Text_SetSize(dnt,35);
Text_SetBold(dnt,1);
Condition1 = False;
box = Box_New(date11,time11,Value11,date12,time12,Value12);
if abs(value12[1]-value11[1]) < 0.8 Then
Text_Delete(tx);
tx = Text_New(sDate,stime,value12,NumToStr(value11-value12,2));
Text_SetColor(Tx,Blue);
Text_SetStyle(tx,1,0);
Text_SetSize(tx,25);
Text_SetBold(tx,1);
}
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];
var1 = loval[0]-loval[1];
Text_SetLocation(dnt,date12,time12,value12);
Text_SetString(dnt,NewLine+NumToStr(abs(var1/PriceScale),0)+" ");
Text_SetColor(dnt,iff(var1>0,Magenta,Blue));
Text_SetStyle(dnt,1,2);
Text_SetSize(dnt,35);
Text_SetBold(dnt,1);
Box_SetEnd(box,date12,time12,Value12);
Text_SetString(tx,NumToStr(value11-value12,2));
Text_SetLocation(tx,sDate,sTime,value12);
TTL = TL_new(sDate,sTime,0,sDate,sTime,PriceScale);
}
if value12 > value11-0.5 Then
{
Box_SetColor(box,Cyan);
Box_SetFill(box,true,90);
}
else if value12 <= value11-0.5 and value12 > value11-0.7 Then
{
Box_SetColor(box,Blue);
Box_SetFill(box,true,50);
}
else if value12 <= value11-0.7 and value12 > value11-0.8 Then
{
Box_SetColor(box,Yellow);
Box_SetFill(box,true,150);
}
else if value12 <= value11-0.8 and value12 > value11-1.2 Then
{
Box_SetColor(box,Lime);
Box_SetFill(box,true,80);
}
else if value12 <= value11-1.2 and value12 > value11-1.6 Then
{
Box_SetColor(box,Cyan);
Box_SetFill(box,true,80);
}
else if value12 <= value11-1.6 and value12 > value11-1.9 Then
{
Box_SetColor(box,Blue);
Box_SetFill(box,true,30);
}
else
{
Box_SetColor(box,Yellow);
Box_SetFill(box,true,80);
}
if Condition1 == False and hival[0] < hival[1] and hival[1] < hival[2] and Loval[0] < loval[1] and Loval[1] < loval[2] Then
{
Condition1 = true;
tx1 = Text_New(sDate,sTime,L+0.6,"●");
Text_SetStyle(tx1,2,2);
Text_SetColor(tx1,Red);
Text_SetSize(tx1,40);
Sell();
}
if C <= Loval[1]+PriceScale*2 and C >= loval[1]-PriceScale*3 Then
{
TL_SetBegin(TTL,sDate,sTime,0);
TL_SetEnd(TTL,sDate,sTime,999);
TL_SetColor(TTL,Gold);
TL_SetSize(TTL,3);
}
Else
{
TL_SetBegin(TTL,sDate,sTime,0);
TL_SetEnd(TTL,sDate,sTime,PriceScale);
}
}
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];
Text_Delete(upt);
var1 = hival[0]-hival[1];
upt = Text_New(date12,time12,value12,NumToStr(abs(var1/PriceScale),0)+" "+NewLine);
Text_SetColor(upt,iff(var1>0,Magenta,Blue));
Text_SetStyle(upt,1,2);
Text_SetSize(upt,35);
Text_SetBold(upt,1);
Condition2 = False;
box = Box_New(date11,time11,Value11,date12,time12,Value12);
if abs(value12[1]-value11[1]) < 0.8 Then
Text_Delete(tx);
tx = Text_New(sDate,stime,value12,NumToStr(value12-value11,2));
Text_SetColor(Tx,Red);
Text_SetStyle(tx,1,1);
Text_SetSize(tx,25);
Text_SetBold(tx,1);
TTL = TL_New(sDate,sTime,0,sDate,sTime,330);
}
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];
var1 = hival[0]-hival[1];
Text_SetLocation(upt,date12,time12,value12);
Text_SetString(upt,NumToStr(abs(var1/PriceScale),0)+" "+NewLine);
Text_SetColor(upt,iff(var1>0,Magenta,Blue));
Text_SetStyle(upt,1,2);
Text_SetSize(upt,35);
Text_SetBold(upt,1);
Box_SetEnd(box,date12,time12,Value12);
Text_SetString(tx,NumToStr(value12-value11,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
if Value12 >= value11+1.9 Then
{
Box_SetColor(box,Pink);
Box_SetFill(box,true,70);
}
else if value12 >= value11+1.2 and value12 < value11+1.9 Then
{
Box_SetColor(box,Gray);
Box_SetFill(box,true,60);
}
else if value12 >= value11+0.8 and value12 < value11+1.2 Then
{
Box_SetColor(box,Magenta);
Box_SetFill(box,true,40);
}
else if value12 >= value11+0.5 and value12 < value11+0.8 Then
{
Box_SetColor(box,Orange);
Box_SetFill(box,true,100);
}
Else
{
Box_SetColor(box,Gold);
Box_SetFill(box,true,150);
}
if Condition2 == False and loval[0] > loval[1] and loval[1] > loval[2] and hival[0] > hival[1] and hival[1] > hival[2] Then
{
Condition2 = true;
tx1 = Text_New(sDate,sTime,H-0.6,"●");
Text_SetStyle(tx1,2,2);
Text_SetColor(tx1,Blue);
Text_SetSize(tx1,40);
Sell();
}
if C <= hival[1]+PriceScale*3 and C >= hival[1]-PriceScale*2 Then
{
TL_SetBegin(TTL,sDate,sTime,0);
TL_SetEnd(TTL,sDate,sTime,999);
TL_SetColor(TTL,Gold);
TL_SetSize(TTL,3);
}
Else
{
TL_SetBegin(TTL,sDate,sTime,0);
TL_SetEnd(TTL,sDate,sTime,PriceScale);
}
}
if MarketPosition == 1 and BarsSinceEntry == 1 Then ExitLong();
if MarketPosition == -1 and BarsSinceEntry == 1 Then ExitShort();
즐거운 하루되세요
> 고성 님이 쓴 글입니다.
> 제목 : 추세선 직전고저점 세로선
> input : Period(130);
Var:j(0),T(0),tx(0),tx1(0),box(0),TL(0),TL1(0),TL2(0),upt(0),dnt(0);
Var: date11(0),date12(0),time11(0),time12(0),
date21(0),date22(0),time21(0),time22(0),
date31(0),date32(0),time31(0),time32(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
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
{
TL_Delete(TL2);
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];
Text_Delete(dnt);
var1 = loval[0]-loval[1];
dnt = Text_New(date12,time12,value12,NewLine+NumToStr(abs(var1/PriceScale),0)+" "+NewLine);
Text_SetColor(dnt,iff(var1>0,Magenta,Blue));
Text_SetStyle(dnt,1,2);
Text_SetSize(dnt,35);
Text_SetBold(dnt,1);
Condition1 = False;
box = Box_New(date11,time11,Value11,date12,time12,Value12);
if abs(value12[1]-value11[1]) < 0.8 Then
Text_Delete(tx);
tx = Text_New(sDate,stime,value12,NumToStr(value11-value12,2));
Text_SetColor(Tx,Blue);
Text_SetStyle(tx,1,0);
Text_SetSize(tx,25);
Text_SetBold(tx,1);
}
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];
var1 = loval[0]-loval[1];
Text_SetLocation(dnt,date12,time12,value12);
Text_SetString(dnt,NewLine+NumToStr(abs(var1/PriceScale),0)+" ");
Text_SetColor(dnt,iff(var1>0,Magenta,Blue));
Text_SetStyle(dnt,1,2);
Text_SetSize(dnt,35);
Text_SetBold(dnt,1);
Box_SetEnd(box,date12,time12,Value12);
Text_SetString(tx,NumToStr(value11-value12,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
if value12 > value11-0.5 Then
{
Box_SetColor(box,Cyan);
Box_SetFill(box,true,90);
}
else if value12 <= value11-0.5 and value12 > value11-0.7 Then
{
Box_SetColor(box,Blue);
Box_SetFill(box,true,50);
}
else if value12 <= value11-0.7 and value12 > value11-0.8 Then
{
Box_SetColor(box,Yellow);
Box_SetFill(box,true,150);
}
else if value12 <= value11-0.8 and value12 > value11-1.2 Then
{
Box_SetColor(box,Lime);
Box_SetFill(box,true,80);
}
else if value12 <= value11-1.2 and value12 > value11-1.6 Then
{
Box_SetColor(box,Cyan);
Box_SetFill(box,true,80);
}
else if value12 <= value11-1.6 and value12 > value11-1.9 Then
{
Box_SetColor(box,Blue);
Box_SetFill(box,true,30);
}
else
{
Box_SetColor(box,Yellow);
Box_SetFill(box,true,80);
}
if Condition1 == False and hival[0] < hival[1] and hival[1] < hival[2] and Loval[0] < loval[1] and Loval[1] < loval[2] Then
{
Condition1 = true;
tx1 = Text_New(sDate,sTime,L+0.6,"●");
Text_SetStyle(tx1,2,2);
Text_SetColor(tx1,Red);
Text_SetSize(tx1,40);
Sell();
}
TL_Delete(TL1);
if C <= Loval[1]+PriceScale*2 and C >= loval[1]-PriceScale*3 Then
{
TL1 = TL_New(sDate,sTime,0,sDate,sTime,999);
TL_SetColor(TL1,Gold);
TL_SetSize(TL1,3);
}
}
If T == 1 Then
{
If T[1] != 1 Then
{
TL_Delete(TL1);
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];
Text_Delete(upt);
var1 = hival[0]-hival[1];
upt = Text_New(date12,time12,value12,NumToStr(abs(var1/PriceScale),0)+" "+NewLine);
Text_SetColor(upt,iff(var1>0,Magenta,Blue));
Text_SetStyle(upt,1,2);
Text_SetSize(upt,35);
Text_SetBold(upt,1);
Condition2 = False;
box = Box_New(date11,time11,Value11,date12,time12,Value12);
if abs(value12[1]-value11[1]) < 0.8 Then
Text_Delete(tx);
tx = Text_New(sDate,stime,value12,NumToStr(value12-value11,2));
Text_SetColor(Tx,Red);
Text_SetStyle(tx,1,1);
Text_SetSize(tx,25);
Text_SetBold(tx,1);
}
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];
var1 = hival[0]-hival[1];
Text_SetLocation(upt,date12,time12,value12);
Text_SetString(upt,NumToStr(abs(var1/PriceScale),0)+" "+NewLine);
Text_SetColor(upt,iff(var1>0,Magenta,Blue));
Text_SetStyle(upt,1,2);
Text_SetSize(upt,35);
Text_SetBold(upt,1);
Box_SetEnd(box,date12,time12,Value12);
Text_SetString(tx,NumToStr(value12-value11,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
if Value12 >= value11+1.9 Then
{
Box_SetColor(box,Pink);
Box_SetFill(box,true,70);
}
else if value12 >= value11+1.2 and value12 < value11+1.9 Then
{
Box_SetColor(box,Gray);
Box_SetFill(box,true,60);
}
else if value12 >= value11+0.8 and value12 < value11+1.2 Then
{
Box_SetColor(box,Magenta);
Box_SetFill(box,true,40);
}
else if value12 >= value11+0.5 and value12 < value11+0.8 Then
{
Box_SetColor(box,Orange);
Box_SetFill(box,true,100);
}
Else
{
Box_SetColor(box,Gold);
Box_SetFill(box,true,150);
}
if Condition2 == False and loval[0] > loval[1] and loval[1] > loval[2] and hival[0] > hival[1] and hival[1] > hival[2] Then
{
Condition2 = true;
tx1 = Text_New(sDate,sTime,H-0.6,"●");
Text_SetStyle(tx1,2,2);
Text_SetColor(tx1,Blue);
Text_SetSize(tx1,40);
Sell();
}
TL_Delete(TL2);
if C <= hival[1]+PriceScale*3 and C >= hival[1]-PriceScale*2 Then
{
TL2 = TL_New(sDate,sTime,0,sDate,sTime,999);
TL_SetColor(TL2,Gold);
TL_SetSize(TL2,3);
}
}
if MarketPosition == 1 and BarsSinceEntry == 1 Then ExitLong();
if MarketPosition == -1 and BarsSinceEntry == 1 Then ExitShort();
text 추가는 상관 없는데, 삭제하는 (TL_Delete(TL2);) 세로선을 (하단 쪽) 추가하면 박스와 충돌이 자주 생깁니다.
지표에서는 상관 없는데, 시스템에서는 세로선과 박스가 충돌되어 박스 일부만 표시됩니다.
선물 10틱 차트에서 확인 부탁드립니다.