예스스탁
예스스탁 답변
2022-05-19 10:46:41
안녕하세요
예스스탁입니다.
inputs : ShowAll(true);
var : BoxTop(0), BoxBtm(0), Ctr(0), BBD(0), BBT(0), EBD(0), EBT(0), UpBand(0), DnBand(0), CurrState(1),
TextId(-1), TopId(-1), TopIdP(-1), BtmId(-1), BtmIdP(-1), LSId(-1), LSIdP(-1), RSId(-1), RSIdP(-1),
HiFirst(true), LoFirst(false), State1(false), State2(false), State3(false), State4(false), State5(false),
DrawBox(false), ValidBox(false), HadBreak(false), NewBox(false);
var : MSid(0);
if index == 1 then
{
BoxTop = high;
BoxBtm = low;
State1 = true;
BBD = date;
BBT = time;
}
if NewBox and high > UpBand then
{
BBD = date;
BBT = time;
TL_SetEnd(TopId, BBD, BBT, UpBand);
TL_SetEnd(BtmId, BBD, BBt, DnBand);
TL_SetEnd(MSId, BBD, BBt, (UpBand+DnBand)/2);
RSIdP = RSId ;
RSId = TL_New(BBD, BBT, DnBand, BBD, BBT, UpBand);
if ShowAll == false and RSIdP <> -1 then TL_Delete( RSIdP ) ;
if HiFirst then
TL_SetColor(RSId, yellow);
else
TL_SetColor(RSId, magenta);
NewBox = false;
State1 = true;
LoFirst = false;
HiFirst = true;
}
if NewBox and low < DnBand then
{
BBD = date;
BBT = time;
TL_Setend(TopId, BBD, BBT, UpBand);
TL_SetEnd(BtmId, BBD, BBt, DnBand);
TL_SetEnd(MSId, BBD, BBt, (UpBand+DnBand)/2);
RSIdP = RSId;
RSId = TL_New(BBD, BBT, DnBand, BBD, BBT, UpBand);
if ShowAll == false and RSIdP <> -1 then TL_Delete(RSIdP);
if HiFirst then
TL_SetColor(RSId, Black) ;
else
TL_SetColor(RSId, magenta);
NewBox = false;
State1 = true;
HiFirst = false;
LoFirst = true;
}
if HiFirst then
{
if State4 then
{
if high > BoxTop then
{
BoxTop = high;
State1 = true;
State4 = false;
CurrState = 1;
}
else
{
if low < BoxBtm then {
State4 = false;
State3 = true;
BoxBtm = low;
CurrState = 3;
}
else
{
State4 = false;
State5 = true;
CurrState = 5;
}
}
}
if State3 then
{
if high > BoxTop then
{
BoxTop = high;
State1 = true;
State3 = false;
CurrState = 1;
}
else
{
if low < BoxBtm then
{
State3 = true;
BoxBtm = low;
CurrState = 3;
}
else
{
State3 = false;
State4 = true;
CurrState = 4;
}
}
}
if State2 then
{
if high > BoxTop then
{
BoxTop = high;
State1 = true;
State2 = false;
CurrState = 1;
}
else
{
State2 = false;
State3 = true;
BoxBtm = low;
CurrState = 3;
}
}
if State1 then
{
if high > BoxTop then
{
BoxTop = high;
State1 = true;
CurrState = 1;
}
else
{
State1 = false;
State2 = true;
CurrState = 2;
}
}
}
else
{ #{ Using LoFirst }
if State4 then
{
if low < BoxBtm then
{
BoxBtm = low;
State1 = true;
State4 = false;
CurrState = 1;
}
else
{
if high > BoxTop then
{
State3 = true;
State4 = false;
BoxTop = high;
CurrState = 3;
}
else
{
State4 = false;
State5 = true;
CurrState = 5;
}
}
}
if State3 then
{
if low < BoxBtm then
{
BoxBtm = low;
State1 = true;
State3 = false;
CurrState = 1;
}
else
{
if high > BoxTop then
{
State3 = true;
BoxTop = high;
CurrState = 3;
}
else
{
State3 = false;
State4 = true;
CurrState = 4;
}
}
}
if State2 then
{
if low < BoxBtm then
{
Boxbtm = low;
State1 = true;
State2 = false;
CurrState = 1;
}
else
{
State2 = false;
State3 = true;
BoxTop = high;
CurrState = 3;
}
}
if State1 then
{
if low < BoxBtm then
{
BoxBtm = low;
State1 = true;
CurrState = 1;
}
else
{
State1 = false;
State2 = true;
CurrState = 2;
}
}
} #{ } IF HIFIRST OR LOFIRST }
if State5 then
{
DrawBox = true;
EBD = date;
EBT = time;
}
if DrawBox then
{
TopIdP = TopId;
BtmIdP = BtmId;
LSIdP = LSId;
TopId = TL_New(BBD, BBT, BoxTop, EBD, EBT, BoxTop);
BtmId = TL_New(BBD, BBT, BoxBtm, EBD, EBT, BoxBtm);
LSId = TL_New(BBD, BBT, BoxBtm, BBD, BBT, BoxTop);
MSid = TL_New(BBD, BBT, (BoxTop+BoxBtm)/2, BBD, BBT, (BoxTop+BoxBtm)/2);
if ShowAll == false then
{
if TopIdP <> -1 then
TL_Delete(TopIdP);
if BtmIdP <> -1 then
TL_Delete(BtmIdP);
if LSIdP <> -1 then
TL_Delete(LSidP);
}
if HiFirst then
{
TL_SetColor(TopId, Black);
TL_SetColor(BtmId, Black);
TL_SetColor(LSId, Black);
TL_SetColor(MSId, lgreen);
}
else
{
TL_SetColor(TopId, magenta);
TL_SetColor(BtmId, magenta);
TL_SetColor(LSId, magenta);
TL_SetColor(MSId, lgreen);
}
TL_SetSize(MSId,2);
State1 = false;
State2 = false;
State3 = false;
State4 = false;
State5 = false;
DrawBox = false;
ValidBox = true;
}
if ValidBox then
{
UpBand = BoxTop;
DnBand = BoxBtm;
ValidBox = false;
NewBox = true;
BoxTop = high;
BoxBtm = low;
}
즐거운 하루되세요
> 요타 님이 쓴 글입니다.
> 제목 : 선좀부탁 드립니다.
> * 항상 많은 도움에 고맙습니다.
* 아래 수식에서 중심선 좀 부탁 드립니다.
즉 박스가 그려지면서 중심선 나오게 좀 요청드립니다.(박스가 끝나도 남아 있어야 합니다.)
1. 박스의 중심선 : TL_SetColor(RSId, lgreen) ;
2. 모든선 선두께 2 지정: TL_SetSize(RSId,2);
→ (연습 중인데 어디에 어떻게 삽입 해야 하는지 잘 모르겟네요...)
* 아래 수식
inputs : ShowAll(true);
var : BoxTop(0), BoxBtm(0), Ctr(0), BBD(0), BBT(0), EBD(0), EBT(0), UpBand(0), DnBand(0), CurrState(1),
TextId(-1), TopId(-1), TopIdP(-1), BtmId(-1), BtmIdP(-1), LSId(-1), LSIdP(-1), RSId(-1), RSIdP(-1),
HiFirst(true), LoFirst(false), State1(false), State2(false), State3(false), State4(false), State5(false),
DrawBox(false), ValidBox(false), HadBreak(false), NewBox(false);
if index == 1 then begin
BoxTop = high;
BoxBtm = low;
State1 = true;
BBD = date;
BBT = time;
end;
if NewBox and high > UpBand then begin
BBD = date;
BBT = time;
TL_SetEnd(TopId, BBD, BBT, UpBand);
TL_SetEnd(BtmId, BBD, BBt, DnBand);
RSIdP = RSId ;
RSId = TL_New(BBD, BBT, DnBand, BBD, BBT, UpBand);
if ShowAll == false and RSIdP <> -1 then TL_Delete( RSIdP ) ;
if HiFirst then
TL_SetColor(RSId, yellow);
else
TL_SetColor(RSId, magenta);
NewBox = false;
State1 = true;
LoFirst = false;
HiFirst = true;
end;
if NewBox and low < DnBand then begin
BBD = date;
BBT = time;
TL_SetEnd(TopId, BBD, BBT, UpBand);
TL_SetEnd(BtmId, BBD, BBt, DnBand);
RSIdP = RSId;
RSId = TL_New(BBD, BBT, DnBand, BBD, BBT, UpBand);
if ShowAll == false and RSIdP <> -1 then TL_Delete(RSIdP);
if HiFirst then
TL_SetColor(RSId, Black) ;
else
TL_SetColor(RSId, magenta);
NewBox = false;
State1 = true;
HiFirst = false;
LoFirst = true;
end;
if HiFirst then begin
if State4 then begin
if high > BoxTop then begin
BoxTop = high;
State1 = true;
State4 = false;
CurrState = 1;
end
else begin
if low < BoxBtm then begin
State4 = false;
State3 = true;
BoxBtm = low;
CurrState = 3;
end
else begin
State4 = false;
State5 = true;
CurrState = 5;
end;
end;
end;
if State3 then begin
if high > BoxTop then begin
BoxTop = high;
State1 = true;
State3 = false;
CurrState = 1;
end
else begin
if low < BoxBtm then begin
State3 = true;
BoxBtm = low;
CurrState = 3;
end
else begin
State3 = false;
State4 = true;
CurrState = 4;
end;
end;
end;
if State2 then begin
if high > BoxTop then begin
BoxTop = high;
State1 = true;
State2 = false;
CurrState = 1;
end
else begin
State2 = false;
State3 = true;
BoxBtm = low;
CurrState = 3;
end;
end;
if State1 then begin
if high > BoxTop then begin
BoxTop = high;
State1 = true;
CurrState = 1;
end
else begin
State1 = false;
State2 = true;
CurrState = 2;
end;
end;
end
else begin #{ Using LoFirst }
if State4 then begin
if low < BoxBtm then begin
BoxBtm = low;
State1 = true;
State4 = false;
CurrState = 1;
end
else begin
if high > BoxTop then begin
State3 = true;
State4 = false;
BoxTop = high;
CurrState = 3;
end
else begin
State4 = false;
State5 = true;
CurrState = 5;
end;
end;
end;
if State3 then begin
if low < BoxBtm then begin
BoxBtm = low;
State1 = true;
State3 = false;
CurrState = 1;
end
else begin
if high > BoxTop then begin
State3 = true;
BoxTop = high;
CurrState = 3;
end
else begin
State3 = false;
State4 = true;
CurrState = 4;
end;
end;
end;
if State2 then begin
if low < BoxBtm then begin
Boxbtm = low;
State1 = true;
State2 = false;
CurrState = 1;
end
else begin
State2 = false;
State3 = true;
BoxTop = high;
CurrState = 3;
end;
end;
if State1 then begin
if low < BoxBtm then begin
BoxBtm = low;
State1 = true;
CurrState = 1;
end
else begin
State1 = false;
State2 = true;
CurrState = 2;
end;
end;
end; #{ END IF HIFIRST OR LOFIRST }
if State5 then begin
DrawBox = true;
EBD = date;
EBT = time;
end;
if DrawBox then begin
TopIdP = TopId;
BtmIdP = BtmId;
LSIdP = LSId;
TopId = TL_New(BBD, BBT, BoxTop, EBD, EBT, BoxTop);
BtmId = TL_New(BBD, BBT, BoxBtm, EBD, EBT, BoxBtm);
LSId = TL_New(BBD, BBT, BoxBtm, BBD, BBT, BoxTop);
if ShowAll == false then begin
if TopIdP <> -1 then TL_Delete(TopIdP);
if BtmIdP <> -1 then TL_Delete(BtmIdP);
if LSIdP <> -1 then TL_Delete(LSidP);
end;
if HiFirst then begin
TL_SetColor(TopId, Black);
TL_SetColor(BtmId, Black);
TL_SetColor(LSId, Black);
end
else begin
TL_SetColor(TopId, magenta);
TL_SetColor(BtmId, magenta);
TL_SetColor(LSId, magenta);
end;
State1 = false;
State2 = false;
State3 = false;
State4 = false;
State5 = false;
DrawBox = false;
ValidBox = true;
end;
if ValidBox then begin
UpBand = BoxTop;
DnBand = BoxBtm;
ValidBox = false;
NewBox = true;
BoxTop = high;
BoxBtm = low;
end;
* 매번 고맙습니다. 수고하십시요.