Posts

Showing posts with the label Pine Script debugging

Pine Script v6 label.new() Complete Guide: Add Text Labels for Signals and Debugging

Image
When building indicators or strategies in Pine Script v6, visualizing discrete events — such as buy/sell signals, pivot points, or debug values — directly on the chart is essential for both analysis and development. The label.new() function provides a powerful mechanism to place fully customizable text annotations at any bar and price level, making it the go-to tool for chart-based communication. 1. What Is label.new() ? label.new() creates a label drawing object anchored to a specific bar index and price (or y-axis) position. Unlike plotchar() or plotshape() , labels support arbitrary multi-line text, dynamic tooltip content, and a wide variety of visual styles. Every call to label.new() on a given bar creates one label object. For the complete parameter reference, see the official documentation: label.new() — Pine Script v6 Reference Manual . 2. Object Lifecycle and Limits Label objects in Pine Script v6 are subject to a garbage...