The following defines start and end to use with your code.
If you wanted to use your inputs for starrt and end as is, then you would use the secondsfromtime() and/or secondstilltime() functions in conjunction with them.
Ruby:#input Start = 0930;#define the start of tradingsession, suggest no change #input end = 1600;#define the end of tradingsession, suggest no change input space = 6.25; input startprice = 300; def start = regularTradingStart(getyyyYMMDD()); def end = regularTradingEnd(getyyYYMMDD()); def condition1 = gettime() > Start; def condition2 = Gettime() < end; def hh = if Gettime() crosses above Start then startprice else if condition1 and condition2 then hh[1] else if Gettime() > end then Double.NaN else hh[1]; # the logic is plotting price lines only between 0930 and 1600 plot line0 = if Gettime() < Start then Double.NaN else hh; line0.SetPaintingStrategy(12); plot line1 = line0 + space; plot line2 = line1 + space; plot line3 = line2 + space;
If you wanted to use your inputs for starrt and end as is, then you would use the secondsfromtime() and/or secondstilltime() functions in conjunction with them.
Ruby:input Start = 0930;#define the start of tradingsession, suggest no change input end = 1600;#define the end of tradingsession, suggest no change input space = 6.25; input startprice = 190; def condition1 = secondsFromTime(Start) > 0; def condition2 = secondsFromTime(end)<0; def hh = if secondsFromTime(Start)==0 then startprice else if condition1 and condition2 then hh[1] else if secondsfromTime(end)>0 then Double.NaN else hh[1]; # the logic is plotting price lines only between 0930 and 1600 plot line0 = if secondsfromTime(start)<0 then Double.NaN else hh; line0.SetPaintingStrategy(12); plot line1 = line0 + space; plot line2 = line1 + space; plot line3 = line2 + space;
Last edited by a moderator: