답변완료
선좀부탁 드립니다.
* 항상 많은 도움에 고맙습니다.
* 아래 수식에서 중심선 좀 부탁 드립니다.
즉 박스가 그려지면서 중심선 나오게 좀 요청드립니다.(박스가 끝나도 남아 있어야 합니다.)
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;
* 매번 고맙습니다. 수고하십시요.
2022-05-19
722
글번호 159020
강조
답변완료
청산 관련 시스템식 요청 드립니다.
현물 매도 청산 식을 작성하려고 합니다.
3%, 4% , 5%, 7%, 10% 분할로 매도식을 작성하려고 합니다.
ExitLong("3%익절",AtLimit,AVGEntryPrice*1.03,"",Floor(MaxContracts*0.20));
ExitLong("4%익절",AtLimit,AVGEntryPrice*1.04,"",Floor(MaxContracts*0.20));
ExitLong("5%익절",AtLimit,AVGEntryPrice*1.05,"",Floor(MaxContracts*0.20));
ExitLong("7%익절",AtLimit,AVGEntryPrice*1.06,"",Floor(MaxContracts*0.20));
ExitLong("10%익절",AtLimit,AVGEntryPrice*1.10);
이런식으로 작성을 했는데
여기서 추가되는 조건은
만약에 3%익절 하고 10분 뒤에.. 3% 익절한금액 (AVGEntryPrice*1.03) 보다 밑에 있으면 현재가 전량 매도
만약에 4%익절 하고 10분 뒤에.. 4% 익절한금액 (AVGEntryPrice*1.04) 보다 밑에 있으면 현재가 전량 매도
만약에 5%익절 하고 10분 뒤에.. 5% 익절한금액 (AVGEntryPrice*1.05) 보다 밑에 있으면 현재가 전량 매도
만약에 7%익절 하고 10분 뒤에.. 7% 익절한금액 (AVGEntryPrice*1.07) 보다 밑에 있으면 현재가 전량 매도
이런식으로 작성하려고 하는데 어떻게 작성해야 할지 궁금합니다.
2022-05-18
586
글번호 158990
시스템