Hello, How can I get the line to extend left all the way back up to the end of the chart left on this code. I tried and keep getting a moving average type line going through the bars.                                                    
	
	
	
	
	
		
	
		
			
		
		
	
				
			
		Code:
	
	def na = Double.NaN;
def bn = BarNumber();
input bars_back = 0;
def x = (!IsNaN(close[-bars_back]) and IsNaN(close[-(1 + bars_back)]));
input price = open;
# --- Main line (dynamic) ---
def line =
if bn == 1 then na
else if x then price
else if IsNaN(close) then line[1]
else line[1];
plot z = line;
z.SetDefaultColor(Color.CYAN);
z.SetLineWeight(2);
# --- Capture the most recent valid line value ---
def activeLine = if !IsNaN(line) then line else activeLine[1];
# --- Horizontal extension (perfectly flat) ---
plot extendLeft = if bn >= 1 then activeLine else na;
extendLeft.SetDefaultColor(Color.LIGHT_GRAY);
extendLeft.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
extendLeft.SetStyle(Curve.SHORT_DASH);
extendLeft.SetLineWeight(1);
extendLeft.HideBubble();
extendLeft.HideTitle();
# --- Optional vertical trigger marker ---
input test_vert = no;
AddVerticalLine(test_vert and x, "-");
			
				Last edited by a moderator: 
			
		
	
								
								
									
	
		
			
		
		
	
	
	
		
			
		
		
	
								
							
							 
				 
						 
 
		 
 
		