First i wanna draw a set of lines at with a customizable height, and at fixed time. For example, at 9:30 and 10:30 i wanna draw two vertical lines, but i wanna choose to start at a certain price, let's say i wanna draw these vertical lines at 100 price level, then the height of the lines is maybe $10. This means after $10, the line will stop plotting. I need to draw several of this vertical lines

Then i also wanna plot horizontal lines. similarly, i wanna choose what price to start to draw this line. then the length of price lines needs to be amount of certain bars. Let's say i start to draw horizontal line at $100, and the length is 50 bars. The line will stop plotting after 50 bars. I need to draw several of this horizontal lines

Is there anyway to do this? Greatly appreaciate any help!

UPDATE:

I think i have solved the price line for daily chart, but i am not sure how to do it on intraday, say i wanna set start time to 9:30 and end time to 16:00

input StartDate = 20220104;

input endDate = 20220404;

input space = 100;

input startprice = 1500;

def condition1 = GetYYYYMMDD() > StartDate;

def condition2 = GetYYYYMMDD() < endDate;

def hh = if GetYYYYMMDD() == StartDate then startprice else if condition1 and condition2 then hh[1] else if GetYYYYMMDD() > endDate then Double.NaN else hh[1];

plot line0 = if GetYYYYMMDD() < StartDate then Double.NaN else hh;

line0.SetPaintingStrategy(12);

plot line1 = line0 + space;

plot line2 = line1 + space;

Then i also wanna plot horizontal lines. similarly, i wanna choose what price to start to draw this line. then the length of price lines needs to be amount of certain bars. Let's say i start to draw horizontal line at $100, and the length is 50 bars. The line will stop plotting after 50 bars. I need to draw several of this horizontal lines

Is there anyway to do this? Greatly appreaciate any help!

UPDATE:

I think i have solved the price line for daily chart, but i am not sure how to do it on intraday, say i wanna set start time to 9:30 and end time to 16:00

input StartDate = 20220104;

input endDate = 20220404;

input space = 100;

input startprice = 1500;

def condition1 = GetYYYYMMDD() > StartDate;

def condition2 = GetYYYYMMDD() < endDate;

def hh = if GetYYYYMMDD() == StartDate then startprice else if condition1 and condition2 then hh[1] else if GetYYYYMMDD() > endDate then Double.NaN else hh[1];

plot line0 = if GetYYYYMMDD() < StartDate then Double.NaN else hh;

line0.SetPaintingStrategy(12);

plot line1 = line0 + space;

plot line2 = line1 + space;

Last edited by a moderator: