예스스탁
예스스탁 답변
2024-10-31 14:52:06
안녕하세요
예스스탁입니다.
input : Period(150);
Var:j(0),T(0),txx(0);
Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0),
date21(0),date22(0),time21(0),time22(0),
date31(0),date32(0),time31(0),time32(0),tx(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
Plot1(value12);
For j = 0 To 19
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if crossup(H,highest(H,Period)[1]) and (T == 0 or (T==-1 and H >= Loval[0]+0.5)) Then
T = 1;
if CrossDown(L,Lowest(L,Period)[1]) and (T == 0 or (T==1 and L <= Hival[0]-0.5)) 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];
TL_Delete(TL);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,Blue);
date21 = date[HiBar[0]];
time21 = stime[HiBar[0]];
date22 = date[0];
time22 = stime[0];
if abs(value12[1]-value11[1]) < 0.5 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);
Condition1 = False;
}
If LoVal[0] > L Then
{
LoVal[0] = L;
LoBar[0] = 0;
date12 = date[LoBar[0]];
time12 = stime[LoBar[0]];
Value12 = LoVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date22 = date[0];
time22 = stime[0];
Text_SetString(tx,NumToStr(value11-value12,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
if Condition1 == False and Loval[0] < Loval[1] Then
{
Condition1 = true;
TL_New(sDate,sTime,0,sDate,sTime,9999999);
}
}
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];
TL_Delete(TL);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,Red);
date31 = date[LoBar[0]];
time31 = stime[LoBar[0]];
date32 = date[0];
time32 = stime[0];
if abs(value12[1]-value11[1]) < 0.5 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);
Condition2 = False;
}
If HiVal[0] < H Then
{
HiVal[0] = H;
HiBar[0] = 0;
date12 = date[HiBar[0]];
time12 = stime[HiBar[0]];
Value12 = HiVal[0];
TL_SetEnd(TL1, date12,time12,Value12);
date32 = date[0];
time32 = stime[0];
Text_SetString(tx,NumToStr(value12-value11,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
if Condition2 == False and hival[0] > hival[1] Then
{
Condition2 = true;
TL_New(sDate,sTime,0,sDate,sTime,9999999);
}
}
TL_SetSize(TL1,1);
즐거운 하루되세요
> 고성 님이 쓴 글입니다.
> 제목 : 추세 돌파
> input : Period(150);
Var:j(0),T(0),txx(0);
Var: date11(0),date12(0),time11(0),time12(0),TL1(0),TL(0),
date21(0),date22(0),time21(0),time22(0),
date31(0),date32(0),time31(0),time32(0),tx(0);
Array:HiVal[20](0),LoVal[20](0),HiBar[20](0),LoBar[20](0);
Plot1(value12);
For j = 0 To 19
{
HiBar[j] = HiBar[j] + 1;
LoBar[j] = LoBar[j] + 1;
}
if crossup(H,highest(H,Period)[1]) and (T == 0 or (T==-1 and H >= Loval[0]+0.5)) Then
T = 1;
if CrossDown(L,Lowest(L,Period)[1]) and (T == 0 or (T==1 and L <= Hival[0]-0.5)) 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];
TL_Delete(TL);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,Blue);
date21 = date[HiBar[0]];
time21 = stime[HiBar[0]];
date22 = date[0];
time22 = stime[0];
if abs(value12[1]-value11[1]) < 0.5 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];
TL_SetEnd(TL1, date12,time12,Value12);
date22 = date[0];
time22 = stime[0];
Text_SetString(tx,NumToStr(value11-value12,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
}
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];
TL_Delete(TL);
TL = TL_New(sdate,stime,Value12,NextBarSdate,NextBarStime,NextBarOpen);
TL1 = TL_New(date11,time11,Value11,date12,time12,Value12);
TL_SetColor(TL1,Red);
date31 = date[LoBar[0]];
time31 = stime[LoBar[0]];
date32 = date[0];
time32 = stime[0];
if abs(value12[1]-value11[1]) < 0.5 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];
TL_SetEnd(TL1, date12,time12,Value12);
date32 = date[0];
time32 = stime[0];
Text_SetString(tx,NumToStr(value12-value11,2));
Text_SetLocation(tx,sDate,sTime,value12);
}
}
TL_SetSize(TL1,1);
새 추세선이 직전추세고점,직전추세저점 돌파시 세로선. 감사합니다.