chart visible bar timeWith the latest added features chart.left_visible_bar_time and chart.right_visible_bar_time it is now possible to
place label.new() positions at the equivalent of 'location.top' and 'location.bottom'
The following are examples of functions which enables to find the visible chart highest/lowest bars:
highest_visible_chart() =>
var float highs = na
highs := time == chart.left_visible_bar_time ? high :
time > chart.left_visible_bar_time and high > highs ? high : highs
lowest_visible_chart() =>
var float lows = na
lows := time == chart.left_visible_bar_time ? low :
time > chart.left_visible_bar_time and low < lows ? low : lows
In this example labels are plotted when a sma crosses another sma
Also combined with 3 boxes, scrolling gives insights how the features work
To all who make Tradingview the way it is, lots and lots of thanks!
Cheers!
Location
Example - Future Line DrawingExample primarily focuses on:
• creating a simple function to get a time offset value
• using the offset to set drawing locations in the future
• how to properly set up and manipulate line positions
Extras ( end of script ):
• inclusion of vertical lines for visualising start and end points using the time offsets
• inclusion of label to read out the current time offset forwards/backwards
This script publication is intended for:
• Educational Purposes
Who is it for?
• anyone who wants to learn the basics of drawing using 'time' for purposes of positioning