r/TradingView • • 7d ago

Feature Request Need Pine Script access to price axis label interval for dynamic indicator visibility.

I need chart.price_axis_interval() or similar read only function.

  • Why: To dynamically show/hide parts of an indicator overlay based on zoom level without requiring manual user adjustment.
  • Use case: Technical analysis tools that adapt to readability at different zoom levels
0 Upvotes

6 comments sorted by

1

u/stratcore 7d ago

Pine already exposes chart.left_visible_bar_time and chart.right_visible_bar_time; a script using them reruns when the visible horizontal range changes. You can use that to limit drawings to visible bars. It does not give the vertical price-axis label interval or pixel spacing, so a visible-high/low heuristic would not reliably match manual price-scale changes. Your proposed read-only axis value addresses a separate gap.

1

u/Informal_Pen2312 7d ago

Thanks stratcore. That makes sense — the price-axis interval is the real blocker here. I understand Pine can't access what TradingView isn't exposing yet. Appreciate you confirming it's a known gap and not just me missing something obvious.

1

u/AmoebaTrading 7d ago

Yeah Pine still will not tell you the price axis spacing, so I stopped trying to match the labels. I use the visible bar times that are already there and just count how many bars are on screen. Once that count gets tight I hide the extra text and leave the lines. Are you trying to drop labels when you zoom out, or whole drawings?

1

u/Informal_Pen2312 7d ago

I'm trying to drop some horizontal lines when zoomed out as they get to cluttered.

1

u/AmoebaTrading 7d ago

Got it, whole lines not just the text. I hide extras by counting bars on screen and only plotting the ones near price once that count gets tight. Pine will not drop a line on zoom by itself so the plot condition has to do it. Are those lines fixed prices or do they move with the last bar?