We’ve added a new function to Pine Script called line.get_price(). It can be used to determine the price level at which the line is located on a certain bar. This function can also be used to identify the intersection of price and trend lines, as well as to position labels at a precise level along a line. See the new function in use here to position a label on a line:
//@version=4 study("GetPrice", overlay = true) var line1 = line.new(bar_index, high, bar_index, low, extend = extend.right) line.set_xy1(line1, bar_index, high) line.set_xy2(line1, bar_index, high) var label1 = label.new(bar_index, high, text = "Possible intersection point", style = label.style_label_lower_right, size = size.large) label.set_xy(label1,bar_index, line.get_price(line1, bar_index))
For more information about this function, check out our Pine Script reference guide.
We hope you’ve enjoyed this update. Please continue to send us your comments and feedback to help us better understand your needs and recommendations for what you’d like to see in the future.