예스스탁
예스스탁 답변
2020-07-01 15:40:27
안녕하세요
예스스탁입니다.
inputs : ShowAll(true),P(5),Dv(2),굵기(1);
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),bbup(0),bbdn(0),MidId(0);
BBup = BollBandUp(P,dv);
BBdn = BollBandDown(P,dv);
if CurrentBar == 1 then begin
BoxTop = BBup;
BoxBtm = bbdn;
State1 = true;
BBD = date;
BBT = time;
end;
if CurrentBar >= 1 then
{
if NewBox and BBup > UpBand then begin
BBD = date;
BBT = time;
TL_SetEnd(TopId, BBD, BBT, UpBand);
TL_SetEnd(BtmId, BBD, BBt, DnBand);
TL_SetEnd(MidId, 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;
end;
if NewBox and BBdn < DnBand then begin
BBD = date;
BBT = time;
TL_SetEnd(TopId, BBD, BBT, UpBand);
TL_SetEnd(BtmId, BBD, BBt, DnBand);
TL_SetEnd(MidId, 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;
HiFirst = false;
LoFirst = true;
end;
if HiFirst then begin
if State4 then begin
if BBup > BoxTop then begin
BoxTop = BBup;
State1 = true;
State4 = false;
CurrState = 1;
end
else begin
if BBdn < BoxBtm then begin
State4 = false;
State3 = true;
BoxBtm = BBdn;
CurrState = 3;
end
else begin
State4 = false;
State5 = true;
CurrState = 5;
end;
end;
end;
if State3 then begin
if BBup > BoxTop then begin
BoxTop = BBup;
State1 = true;
State3 = false;
CurrState = 1;
end
else begin
if BBdn < BoxBtm then begin
State3 = true;
BoxBtm = BBdn;
CurrState = 3;
end
else begin
State3 = false;
State4 = true;
CurrState = 4;
end;
end;
end;
if State2 then begin
if BBup > BoxTop then begin
BoxTop = BBup;
State1 = true;
State2 = false;
CurrState = 1;
end
else begin
State2 = false;
State3 = true;
BoxBtm = BBdn;
CurrState = 3;
end;
end;
if State1 then begin
if BBup > BoxTop then begin
BoxTop = BBup;
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 BBdn < BoxBtm then begin
BoxBtm = BBdn;
State1 = true;
State4 = false;
CurrState = 1;
end
else begin
if BBup > BoxTop then begin
State3 = true;
State4 = false;
BoxTop = bbup;
CurrState = 3;
end
else begin
State4 = false;
State5 = true;
CurrState = 5;
end;
end;
end;
if State3 then begin
if BBdn < BoxBtm then begin
BoxBtm = bbdn;
State1 = true;
State3 = false;
CurrState = 1;
end
else begin
if bbup > BoxTop then begin
State3 = true;
BoxTop = bbup;
CurrState = 3;
end
else begin
State3 = false;
State4 = true;
CurrState = 4;
end;
end;
end;
if State2 then begin
if bbdn < BoxBtm then begin
Boxbtm = bbdn;
State1 = true;
State2 = false;
CurrState = 1;
end
else begin
State2 = false;
State3 = true;
BoxTop = bbup;
CurrState = 3;
end;
end;
if State1 then begin
if bbdn < BoxBtm then begin
BoxBtm = bbdn;
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);
MidId = TL_New(BBD, BBT, (BoxTop+BoxBtm)/2, EBD, EBT,(BoxTop+BoxBtm)/2);
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, LGREEN);
TL_SetColor(BtmId, LGREEN);
TL_SetColor(MidId, LGREEN);
TL_SetColor(LSId, LGREEN);
TL_SetSize(TopId, 굵기);
TL_SetSize(BtmId, 굵기);
TL_SetSize(MidId, 굵기);
TL_SetSize(LSId, 굵기);
end
else begin
TL_SetColor(TopId, LGREEN);
TL_SetColor(BtmId, LGREEN);
TL_SetColor(MidId, LGREEN);
TL_SetColor(LSId, LGREEN);
TL_SetSize(TopId, 굵기);
TL_SetSize(BtmId, 굵기);
TL_SetSize(MidId, 굵기);
TL_SetSize(LSId, 굵기);
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 = bbup;
BoxBtm = bbdn;
end;
}
Plot1(ma(C,P), "이동평균1");
즐거운 하루되세요
> 성공예견 님이 쓴 글입니다.
> 제목 : 지표문의
> 1.아래는 밴드 지표인데요 여기에 중간(2등분선) 수평선 하나를 추가 하고 싶어서요
지표 수정 부착 드립니다.
inputs : ShowAll(true),P(5),Dv(2),굵기(1);
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),bbup(0),bbdn(0);
BBup = BollBandUp(P,dv);
BBdn = BollBandDown(P,dv);
if CurrentBar == 1 then begin
BoxTop = BBup;
BoxBtm = bbdn;
State1 = true;
BBD = date;
BBT = time;
end;
if CurrentBar >= 1 then
{
if NewBox and BBup > 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 BBdn < 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, yellow) ;
else TL_SetColor(RSId, magenta);
NewBox = false;
State1 = true;
HiFirst = false;
LoFirst = true;
end;
if HiFirst then begin
if State4 then begin
if BBup > BoxTop then begin
BoxTop = BBup;
State1 = true;
State4 = false;
CurrState = 1;
end
else begin
if BBdn < BoxBtm then begin
State4 = false;
State3 = true;
BoxBtm = BBdn;
CurrState = 3;
end
else begin
State4 = false;
State5 = true;
CurrState = 5;
end;
end;
end;
if State3 then begin
if BBup > BoxTop then begin
BoxTop = BBup;
State1 = true;
State3 = false;
CurrState = 1;
end
else begin
if BBdn < BoxBtm then begin
State3 = true;
BoxBtm = BBdn;
CurrState = 3;
end
else begin
State3 = false;
State4 = true;
CurrState = 4;
end;
end;
end;
if State2 then begin
if BBup > BoxTop then begin
BoxTop = BBup;
State1 = true;
State2 = false;
CurrState = 1;
end
else begin
State2 = false;
State3 = true;
BoxBtm = BBdn;
CurrState = 3;
end;
end;
if State1 then begin
if BBup > BoxTop then begin
BoxTop = BBup;
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 BBdn < BoxBtm then begin
BoxBtm = BBdn;
State1 = true;
State4 = false;
CurrState = 1;
end
else begin
if BBup > BoxTop then begin
State3 = true;
State4 = false;
BoxTop = bbup;
CurrState = 3;
end
else begin
State4 = false;
State5 = true;
CurrState = 5;
end;
end;
end;
if State3 then begin
if BBdn < BoxBtm then begin
BoxBtm = bbdn;
State1 = true;
State3 = false;
CurrState = 1;
end
else begin
if bbup > BoxTop then begin
State3 = true;
BoxTop = bbup;
CurrState = 3;
end
else begin
State3 = false;
State4 = true;
CurrState = 4;
end;
end;
end;
if State2 then begin
if bbdn < BoxBtm then begin
Boxbtm = bbdn;
State1 = true;
State2 = false;
CurrState = 1;
end
else begin
State2 = false;
State3 = true;
BoxTop = bbup;
CurrState = 3;
end;
end;
if State1 then begin
if bbdn < BoxBtm then begin
BoxBtm = bbdn;
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, LGREEN);
TL_SetColor(BtmId, LGREEN);
TL_SetColor(LSId, LGREEN);
TL_SetSize(TopId, 굵기);
TL_SetSize(BtmId, 굵기);
TL_SetSize(LSId, 굵기);
end
else begin
TL_SetColor(TopId, LGREEN);
TL_SetColor(BtmId, LGREEN);
TL_SetColor(LSId, LGREEN);
TL_SetSize(TopId, 굵기);
TL_SetSize(BtmId, 굵기);
TL_SetSize(LSId, 굵기);
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 = bbup;
BoxBtm = bbdn;
end;
}
Plot1(ma(C,P), "이동평균1");
2.그럼 수고 하세요