```
#High_Low_Display_xLines_Extended_to_Right_Edge
input show_number_of_lines = 3;
input mode = {default Chart_Time_Frame, Manual_Time_frame};
input agg = AggregationPeriod.THIRTY_MIN;
input labels = yes;
def Time_Frame = if mode == mode.Chart_Time_Frame then GetAggregationPeriod() else agg;
AddLabel(labels, "Mode: " + mode + " - " + Time_Frame / 60000 + "min" , Color.YELLOW);
def H = if IsNaN(close) then H[1] else if mode == mode.Manual_Time_frame then high(period = Time_Frame) else high;
def L = if IsNaN(close) then L[1] else if mode == mode.Manual_Time_frame then low(period = Time_Frame) else low;
def C = if IsNaN(close) then C[1] else if mode == mode.Manual_Time_frame then close(period = Time_Frame) else close;
def O = if IsNaN(close) then O[1] else if mode == mode.Manual_Time_frame then open(period = Time_Frame) else open;
def NA = Double.NaN;
def last = if !IsNaN(close) and (H[1] + L[1] + C[1] + O[1]) != (H + L + C + O) then last[1] + 1 else last[1];
def cond = HighestAll(last) - last + 1;
plot h1 = if cond > 1 or show_number_of_lines < 1 then NA else HighestAll(if (cond) == 1 then H else NA);
plot h2 = if cond > 2 or show_number_of_lines < 2 then NA else HighestAll(if (cond) == 2 then H else NA);
plot h3 = if cond > 3 or show_number_of_lines < 3 then NA else HighestAll(if (cond) == 3 then H else NA);
plot h4 = if cond > 4 or show_number_of_lines < 4 then NA else HighestAll(if (cond) == 4 then H else NA);
plot h5 = if cond > 5 or show_number_of_lines < 5 then NA else HighestAll(if (cond) == 5 then H else NA);
plot h6 = if cond > 6 or show_number_of_lines < 6 then NA else HighestAll(if (cond) == 6 then H else NA);
plot h7 = if cond > 7 or show_number_of_lines < 7 then NA else HighestAll(if (cond) == 7 then H else NA);
plot h8 = if cond > 8 or show_number_of_lines < 8 then NA else HighestAll(if (cond) == 8 then H else NA);
plot h9 = if cond > 9 or show_number_of_lines < 9 then NA else HighestAll(if (cond) == 9 then H else NA);
plot h10 = if cond > 10 or show_number_of_lines < 10 then NA else HighestAll(if (cond) == 10 then H else NA);
plot L1 = if cond > 1 or show_number_of_lines < 1 then NA else HighestAll(if (cond) == 1 then L else NA);
plot L2 = if cond > 2 or show_number_of_lines < 2 then NA else HighestAll(if (cond) == 2 then L else NA);
plot L3 = if cond > 3 or show_number_of_lines < 3 then NA else HighestAll(if (cond) == 3 then L else NA);
plot L4 = if cond > 4 or show_number_of_lines < 4 then NA else HighestAll(if (cond) == 4 then L else NA);
plot L5 = if cond > 5 or show_number_of_lines < 5 then NA else HighestAll(if (cond) == 5 then L else NA);
plot L6 = if cond > 6 or show_number_of_lines < 6 then NA else HighestAll(if (cond) == 6 then L else NA);
plot L7 = if cond > 7 or show_number_of_lines < 7 then NA else HighestAll(if (cond) == 7 then L else NA);
plot L8 = if cond > 8 or show_number_of_lines < 8 then NA else HighestAll(if (cond) == 8 then L else NA);
plot L9 = if cond > 9 or show_number_of_lines < 9 then NA else HighestAll(if (cond) == 9 then L else NA);
plot L10 = if cond > 10 or show_number_of_lines < 10 then NA else HighestAll(if (cond) == 10 then L else NA);
DefineGlobalColor("H", Color.GREEN);
DefineGlobalColor("L", Color.RED);
h1.SetDefaultColor(GlobalColor("H"));
h2.SetDefaultColor(GlobalColor("H"));
h3.SetDefaultColor(GlobalColor("H"));
h4.SetDefaultColor(GlobalColor("H"));
h5.SetDefaultColor(GlobalColor("H"));
h6.SetDefaultColor(GlobalColor("H"));
h7.SetDefaultColor(GlobalColor("H"));
h8.SetDefaultColor(GlobalColor("H"));
h9.SetDefaultColor(GlobalColor("H"));
h10.SetDefaultColor(GlobalColor("H"));
L1.SetDefaultColor(GlobalColor("L"));
L2.SetDefaultColor(GlobalColor("L"));
L3.SetDefaultColor(GlobalColor("L"));
L4.SetDefaultColor(GlobalColor("L"));
L5.SetDefaultColor(GlobalColor("L"));
L6.SetDefaultColor(GlobalColor("L"));
L7.SetDefaultColor(GlobalColor("L"));
L8.SetDefaultColor(GlobalColor("L"));
L9.SetDefaultColor(GlobalColor("L"));
L10.SetDefaultColor(GlobalColor("L"));
input test = no;
AddChartBubble(test and cond <= show_number_of_lines, H, cond, Color.YELLOW);
AddChartBubble(test and cond <= show_number_of_lines, L, cond, Color.WHITE, no);
#
```