I built an oscillator:
I'd like to put a label just below the head of the title. I can easily modify the y axis but I'm not able to modify the x. How can I set label.new() in order to achieve this goal?
You can get the time of the first visible bar chart with chart.left_visible_bar_time.
From there, you can plot your label using xloc.bar_time
.
You can also use xloc.bar_index
like for applying an offset in bars:
// Track the first visible bar index
var firstBarIndex = 0
if time == chart.left_visible_bar_time
firstBarIndex := bar_index
// Plot a label five bars after
if bar_index == firstBarIndex +5
label.new(bar_index, high, "5th")
Nevertheless, as mentioned in this comment, you may prefer to plot a table with position.top_left
instead.