Posts

Showing posts from May, 2026

Pine Script v6 Input Functions: Building User-Friendly Settings Menus with input.int, input.float, and input.color

Image
When building indicators in Pine Script v6, hardcoding values like period lengths or colors directly into your logic forces users to edit source code every time they want to adjust a parameter. The input.* family of functions solves this by exposing configurable controls in TradingView's built-in Settings panel, allowing any user to tune an indicator without touching a single line of code. 1. Why Input Functions Matter Every value returned by an input.* function carries the input type qualifier — the second-narrowest qualifier in Pine Script's hierarchy ( const → input → simple → series ). This means input values are resolved once when the script loads, not recalculated on every bar. That makes them ideal for configuration parameters such as lookback periods, thresholds, and display colors. graph LR A["Script Loads"] --> B["input.*() functions execute"] B --> C["Settings Panel UI rendered...

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...

Pine Script v6 line.new: Draw Dynamic Trendlines and Support/Resistance Levels

Image
In Pine Script v6, the line.new function allows you to programmatically draw line objects directly on the chart, connecting two specific coordinate points — making it ideal for rendering dynamic trendlines, support levels, and resistance levels that update bar-by-bar. 1. What Is line.new ? line.new creates a line drawing object on the chart by specifying two endpoints via their x-coordinates (bar index or time) and y-coordinates (price). Unlike plot() , which draws a continuous series, line.new draws a discrete segment between two explicit points. This makes it the correct tool for connecting pivot highs/lows, marking key price levels, or visualizing slope-based trendlines. Reference: Official v6 Reference: line.new 2. Core Parameters (Individually Verified) The following parameters are verified from the official v6 Reference Manual. For the complete signature, always consult the official docs. Parameter ...

Pine Script v6 plot() Function: Complete Guide to Lines, Histograms, and Circles

Image
The plot() function is the most fundamental visualization tool in Pine Script v6, enabling developers to render numeric series data directly onto a TradingView chart as lines, histograms, circles, and more. Understanding its styling parameters — including color , linewidth , and style — is essential for building readable, professional-grade indicators. This article provides a rigorous, fact-checked walkthrough of the plot() function based strictly on the official Pine Script v6 Reference Manual. 1. What Does plot() Do? The plot() function renders a series of numeric values as a visual element on the chart pane. It returns a plot object, which can later be used with the fill() function to shade areas between two plots. Every call to plot() creates one persistent visual layer on the chart. Reference: https://www.tradingview.com/pine-script-reference/v6/#fun_plot 2. Core Parameters (Individually Verified) Rather than re...