// ==========================================
//
inputs:
DateOfLine(1180517),
DistFromSwing_Ticks(3),
StartBarCount_Time(700),
ExtendLines_Right(false),
Line1_Color(darkred),
Line1_StartBarCount(2),
Line1_EndBarCount(8),
Line2_Display(true),
Line2_StartBarCount(8),
Line2_EndBarCount(18),
Line3_Display(true),
Line3_StartBarCount(16),
Line3_EndBarCount(28);
vars:
X(0),
startHiTLValue(0),
startLoTLValue(0),
ii(0),
looCounter(0),
ColorCount(0),
PriDisplayValue(0),
EndCount(0),
loTLPrice(0),
hiTLPrice(0),
TickValue(minmove/pricescale);
arrays:
LineSwitch[3](false),
TLID_Main[3](1),
StartBarCount[3](0),
EndBarCount[3](0),
LineHigh[3](0),
LineLow[3](999999);
once begin
LineSwitch[1] = true;
StartBarCount[1] = calctime(StartBarCount_Time, Line1_StartBarCount * barinterval);
EndBarCount[1] = calctime(StartBarCount_Time, Line1_EndBarCount * barinterval);
LineSwitch[2] = Line2_Display;
StartBarCount[2] = calctime(StartBarCount_Time, Line2_StartBarCount * barinterval);
EndBarCount[2] = calctime(StartBarCount_Time, Line2_EndBarCount * barinterval);
LineSwitch[3] = Line3_Display;
StartBarCount[3] = calctime(StartBarCount_Time, Line3_StartBarCount * barinterval);
EndBarCount[3] = calctime(StartBarCount_Time, Line3_EndBarCount * barinterval);
if Line1_Color = Darkred then ColorCount = 1 else ColorCount = 0;
for X = 1 to 3 begin
if LineSwitch[X] then
begin
if ColorCount > 1 then ColorCount = 0;
PriDisplayValue = pz_iff(ColorCount = 0, getappinfo(aiLowestDispValue), getappinfo(aiHighestDispValue));
if ColorCount = 0 then
startLoTLValue = getappinfo(aiLowestDispValue)
else
startHiTLValue = getappinfo(aiHighestDispValue) ;
TLID_Main[X] = tl_new(currentdate, StartBarCount[X], PriDisplayValue, currentdate, EndBarCount[X], PriDisplayValue);
tl_setcolor(TLID_Main[X], pz_iff(ColorCount = 0, Darkblue, Darkred));
tl_setstyle(TLID_Main[X],(2));
TL_SetSize (TLID_Main[X],(3));
tl_setextright(TLID_Main[X], ExtendLines_Right);
ColorCount += 1;
end ;
end;
end;
if d = DateOfLine then begin
{for X = 1 to 11 begin
if t >= StartBarCount[X  1] then EndCount = X + 1;
end;}
for X = 1 to 3 begin
if LineSwitch[X] then
begin
if t >= StartBarCount[X] and t <= EndBarCount[X] then begin
if h > LineHigh[X] then LineHigh[X] = h;
if l < LineLow[X] then LineLow[X] = l;
end ;
if t < StartBarCount[X] then
begin
loTLPrice = startLoTLValue ;
hiTLPrice = startHiTLValue ;
if X > 2 then
begin
ii = X  2 ;
looCounter = 0 ;
while ii > 0
begin
if LineSwitch[ii] and t >= StartBarCount[ii] then
begin
loTLPrice = LineLow[ii] ;
hiTLPrice = LineHigh[ii] ;
end ;
ii = 2 ;
looCounter += 1 ;
if looCounter > 10 then
break ;
end ;
end ;
end
else
begin
loTLPrice = LineLow[X] ;
hiTLPrice = LineHigh[X] ;
end ;
if tl_getcolor(TLID_Main[X]) = Darkblue then begin
tl_setend(TLID_Main[X], d, EndBarCount[X], loTLPrice  DistFromSwing_Ticks * TickValue);
tl_setbegin(TLID_Main[X], d, StartBarCount[X], loTLPrice  DistFromSwing_Ticks * TickValue);
end
else begin
tl_setend(TLID_Main[X], d, EndBarCount[X], hiTLPrice + DistFromSwing_Ticks * TickValue);
tl_setbegin(TLID_Main[X], d, StartBarCount[X], hiTLPrice + DistFromSwing_Ticks * TickValue);
end;
end ;
end;
end;
