Global variables in Pine Script are declared in the script's top-level scope. Scope determines where a name can be used; declaration mode determines when its value is initialized. A global variable does not automatically preserve its value across bars. Use var when a counter, running total, or state needs that persistence.
The label.new function in Pine Script puts text annotations directly on your TradingView chart — prices, signals, calculations, whatever you need displayed at a specific bar and price level.
math.abs() returns the magnitude of a numeric value: -5 becomes 5, and 5 stays 5. It removes direction; it does not normalize units, identify a divergence, or turn missing data into a valid observation.
The offset parameter changes where a plot appears on the chart. It does not change the calculated series, delay an order, or make future prices available. Historical indexing is a separate operation.
A trailing exit can follow favorable price movement after an activation level is reached. In Pine Script, activation and trailing distance are separate parameters. Neither a simulated trailing order nor an activation above entry guarantees a profitable live fill.
TradingView compiles Pine source before running it as an indicator, strategy or library. A successful v6 compilation confirms that the source passes compiler checks; it does not prove correct trading logic, non-repainting behavior or profitable execution.
request.security() is a Pine Script function that fetches data from any symbol or timeframe, not just the one on your current chart. You can pull OHLCV values, custom calculations, or entire indicator outputs from another context and display them in your active script.
Ever found yourself on a 1-minute chart needing the daily trend? Or trading SPY but wanting to watch what the VIX is doing at the same time? That's what this function supports.
The requested context has its own bars and confirmation timing. An expression that compiles can still use an invalid timeframe or produce changing values on realtime bars.
na represents an unavailable value; na(value) checks for it. Missing numeric data usually propagates through arithmetic rather than crashing a script. A guard should express what the calculation needs, not replace every missing observation with an invented zero.
ta.barssince(condition) returns zero when the condition is true, then counts chart bars until it is true again. Before the first occurrence, it returns na. The count measures time since that event, not the age or strength of a trend.
LuxAlgo’s library is a catalog of indicators and trading concepts. To use a specific tool, check its own page, supported platform, access terms and calculation rules. The earlier description of a fixed 200-tool collection with identical features is no longer a reliable guide.