Plotting & Visualization
Functions for rendering data on charts with customizable styling, colors, and visual effects. Create beautiful and informative visualizations for your technical indicators and market analysis.
Overview
Chart Rendering
Plot time series data directly onto charts with multiple style options including lines, splines, points, candles, and bars for comprehensive market visualization.
Visual Customization
Customize colors, line widths, fill areas, and smoothing options to create visually appealing and distinct indicators that stand out on your charts.
Advanced Effects
Apply advanced visual effects like momentum fills, smooth curves, and multi-layer plotting to create sophisticated technical analysis displays.
Functions Reference
plotCandle - render OHLC data as candlestick charts
plotCandle(value: TimeSeries, width?: number = 1, colors?: color[], colorIndex?: number, showPriceDisplay?: boolean = true, label?: string[], desc?: string[]): void
Parameters:
- value (TimeSeries) - OHLC data series to plot as candlesticks (requires 4 values: Open, High, Low, Close)
- width (number) - Candle width (default: 1)
- colors (color[]) - Color array for bullish/bearish candles (theme-dependent)
- colorIndex (number) - Index to select specific color from colors array (optional)
- showPriceDisplay (boolean) - Show current value in price scale (default: true)
- label (string[]) - Labels for each data series. A label must be provided for each plot as required by the script editor.
- desc (string[]) - Descriptions for each data series. Optional but recommended - missing descriptions will generate warnings but will not prevent execution.
Returns:
void (plots candlestick chart)
Visual Example:

Code Example:
plotBar - render data as traditional bar charts
plotBar(value: TimeSeries, width?: number = 1, colors?: color[], colorIndex?: number, showPriceDisplay?: boolean = true, label?: string[], desc?: string[]): void
Parameters:
- value (TimeSeries) - Data series to plot as bars (uses first value if multi-value series)
- width (number) - Bar width (default: 1)
- colors (color[]) - Color array for bullish/bearish bars (theme-dependent)
- colorIndex (number) - Index to select specific color from colors array (optional)
- showPriceDisplay (boolean) - Show current value in price scale (default: true)
- label (string[]) - Labels for each data series. A label must be provided for each plot as required by the script editor.
- desc (string[]) - Descriptions for each data series. Optional but recommended - missing descriptions will generate warnings but will not prevent execution.
Returns:
void (plots bar chart)
Visual Example:

Code Example:
plotLine - render data as enhanced line charts
plotLine(value: TimeSeries, width?: number = 1, colors?: color[], colorIndex?: number, fill?: boolean | 'momentum_fill' | 'default' = false, smooth?: boolean = true, showPriceDisplay?: boolean = false, label?: string[], desc?: string[]): void
Parameters:
- value (TimeSeries) - Data series to plot as lines (uses first value if multi-value series)
- width (number) - Line width (default: 1)
- colors (color[]) - Color array for lines (theme-dependent)
- colorIndex (number) - Index to select specific color from colors array (optional)
- fill (boolean | 'momentum_fill' | 'default') - Fill area under line: false = no fill, true = solid fill, "momentum_fill" = conditional coloring based on positive/negative values with 4-color array [posLineColor, negLineColor, posFillColor, negFillColor], "default" = standard fill. Default: false
- smooth (boolean) - Enable smooth line rendering (default: true)
- showPriceDisplay (boolean) - Show current value in price scale (default: true)
- label (string[]) - Labels for each data series. A label must be provided for each plot as required by the script editor.
- desc (string[]) - Descriptions for each data series. Optional but recommended - missing descriptions will generate warnings but will not prevent execution.
Returns:
void (plots line chart)
Visual Example:

Code Example:
plotShape - render custom shapes and markers on charts
plotShape(value: TimeSeries, shape: string, width?: number = 1, colors?: color[], colorIndex?: number, fill?: boolean | number = false, showPriceDisplay?: boolean = false, label?: string[], desc?: string[]): void
Parameters:
- value (TimeSeries) - Data series for shape positioning (uses first value if multi-value series)
- shape (string) - Shape type to plot. Currently supported: 'circle' (circular marker/point). The shape parameter determines the visual marker style rendered at each data point.
- width (number) - Shape border width (default: 1)
- colors (color[]) - Color array for shapes (theme-dependent)
- colorIndex (number) - Index to select specific color from colors array (optional)
- fill (boolean | number) - Fill option for shapes: false = no fill (outline only), true = solid fill (opaque), number (0.0-1.0) = fill opacity/transparency (0.0 = transparent, 1.0 = opaque, 0.5 = 50% transparent). Default: false
- showPriceDisplay (boolean) - Show current value in price scale (default: false)
- label (string[]) - Labels for each data series. A label must be provided for each plot as required by the script editor.
- desc (string[]) - Descriptions for each data series. Optional but recommended - missing descriptions will generate warnings but will not prevent execution.
Returns:
void (plots shapes on chart)
Visual Example:

Code Example:
plot - universal plotting function for all visualization types
plot(value: TimeSeries, plotType?: 'spline' | 'line' | 'bar' | 'candle' | 'point', width?: number = 1, colors?: color[], colorIndex?: number, fill?: boolean | 'momentum_fill', smooth?: boolean = true, showPriceDisplay?: boolean = true, label?: string[], desc?: string[]): void
Parameters:
- value (TimeSeries) - The data series to visualize (candle type requires 4 OHLC values, others use first value if multi-value series)
- plotType (string) - "spline"/"line" for lines, "bar" for histogram, "candle" for OHLC, "point" for dots
- width (number) - Thickness of lines or size of bars/points (default: 1)
- colors (color[]) - Colors array - format depends on plot type and fill mode (theme-dependent)
- colorIndex (number) - Index to select specific color from colors array (optional)
- fill (boolean | 'momentum_fill') - Fill area: false = no fill, true = solid fill, "momentum_fill" = conditional coloring (requires 4-color array: [posLineColor, negLineColor, posFillColor, negFillColor])
- smooth (boolean) - Smooth line curves for better visual appeal (default: true)
- showPriceDisplay (boolean) - Show current value in price scale (default: true for main plot, false for nested)
- label (string[]) - Labels for each data series. A label must be provided for each plot as required by the script editor.
- desc (string[]) - Descriptions for each data series. Optional but recommended - missing descriptions will generate warnings but will not prevent execution.
Returns:
void (plots data on chart)
Code Example:
hline - render horizontal reference lines on charts
hline(value: number, color?: string = 'gray', width?: number = 1): void
Parameters:
- value (number) - Y-axis value where the horizontal line should be drawn
- color (string) - Line color (default: 'gray')
- width (number) - Line width (default: 1)
Returns:
void (plots horizontal line at specified value)
Visual Example:

Code Example:
Best Practices
Color Selection
Use contrasting colors for different data series. Consider color-blind accessibility when choosing color schemes for your indicators.
Line Width
Use thicker lines (3-4) for primary indicators and thinner lines (1-2) for secondary data. This creates visual hierarchy in your charts.
Smooth Curves
Enable smooth curves for continuous data like moving averages, but use straight lines for discrete signals or step functions.
Candlestick Colors
Use traditional green/red or green/red color schemes for candlesticks. Green typically represents bullish (closing higher) and red represents bearish (closing lower).
Shape Positioning
When using plotShape for signals, position markers slightly above or below price action to avoid overlapping with the main chart data.
Chart Types
Use plotCandle for price action analysis, plotBar for traditional OHLC display, plotLine for indicators, and plotShape for discrete signals and annotations.
Color Index Selection
Use the colorIndex parameter to programmatically select colors from your colors array. This is useful for dynamic color changes based on conditions or user inputs.