Then we calculate the highest high and lowest low with the highest() and lowest() functions. We first set the indicator properties with the study() function. But on the last bar, if there's real-time data, // extend both lines an additional 3 days in the future if ( barstate.isrealtime) t_xy1(id =lowLine, x = time, y =loLows) t_xy2(id =highLine, x = time, y =hiHighs) Update the lines' location on every bar t_xy1(id =highLine, x = time, y =hiHighs) Var lowLine = line.new(x1 = na, y1 = na, x2 = na, y2 = na,Ĭolor = color.red, width = 3, xloc = xloc.bar_time) LoLows = lowest( low, 10) // Make both trend lines once var highLine = line.new(x1 = na, y1 = na, x2 = na, y2 = na,Ĭolor = een, width = 3, xloc = xloc.bar_time) Then we subtract 14.4 million to relocate the line 4 hours to the study(title = "Capture recent prices with lines", overlay = true) For the line’s new time coordinate we first get its current location with the line.get_x1() and line.get_x2() functions. With the myLine variable we specify which line to change. So we execute the t_x1() and t_x2() functions. Then we move the entire line 4 hours into the past. We put the line reference in the myLine variable for use next. We set those to the bar’s opening time: time and time. But now the line uses time values ( xloc=xloc.bar_time) for its x-axis coordinates. That line is again between the close 20 bars ago and the current bar. This code first makes a trend line with line.new(). Move the line's time coordinates 4 hours // (14,400,000 milliseconds) to the left t_x1(id =myLine, x = line.get_x1(id =myLine) - 14400000) X2 = time, y2 = close, width = 3, xloc = xloc.bar_time) MyLine = line.new(x1 = time, y1 = close , Create a line with time values as x-axis coordinates That makes their default pattern look like (TradingView, n.d.):
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |