
Pine Script now supports dashed and dotted lines in the plot() function. The September 2025 update introduced a linestyle parameter that gives you control over how plotted lines appear on TradingView charts.1 Before this update, every plot drew a solid line. If you wanted to visually distinguish a signal line from a main indicator or mark a reference level differently from a moving average, you had to use workarounds like changing colors, widths, or plot styles entirely. The linestyle parameter solves this directly.
This guide covers the three linestyle constants, which plot styles they work with, and practical examples showing how to use dashed and dotted lines in your indicators.
Pine Script v6 provides three named constants for the linestyle parameter of the plot() function:2
plot.linestyle_solid draws a continuous solid line, which is the default behavior when no linestyle is specified2plot.linestyle_dashed draws a line with evenly spaced dashes, creating visible gaps between each dash segment2plot.linestyle_dotted draws a line made of evenly spaced dots2All three constants have the type const plot_line_style and are passed to the linestyle parameter, which accepts an input plot_line_style argument.2 Here is the simplest possible usage:
//@version=6
indicator("Linestyle Demo", overlay = true)
plot(close, "Solid Close", color.blue, linestyle = plot.linestyle_solid)
plot(high, "Dashed High", color.red, linestyle = plot.linestyle_dashed)
plot(low, "Dotted Low", color.green, linestyle = plot.linestyle_dotted)
This script plots three lines on the chart: a solid blue line on the close, a dashed red line on the high, and a dotted green line on the low. The visual distinction between the three lines is immediately clear without needing different colors alone.
The linestyle parameter only modifies the appearance of plot styles that actually draw a continuous line.2 If the style parameter specifies a non-line plot style, the linestyle argument has no visible effect.
The following plot styles support the linestyle parameter:
plot.style_line (the default) draws a continuous line connecting each bar's value2plot.style_linebr draws a line with breaks at na values instead of connecting through them2plot.style_stepline draws a staircase-style line with vertical transitions between value changes2plot.style_stepline_diamond draws a step line with diamond markers at each value change2plot.style_area draws a line with a filled area beneath it, and the linestyle applies to the top edge line2The following plot styles are not affected by linestyle because they do not render lines:
plot.style_histogram draws vertical barsplot.style_columns draws filled columnsplot.style_circles draws circle markersplot.style_cross draws cross markersA common use case for dashed lines is plotting support and resistance levels that should be visually distinct from the main indicator. Dashed lines communicate that a level is a reference point rather than a primary signal.
//@version=6
indicator("Support/Resistance Levels", overlay = true)
int LOOKBACK = 50
float resistance = ta.highest(high, LOOKBACK)
float support = ta.lowest(low, LOOKBACK)
float midline = math.avg(resistance, support)
plot(resistance, "Resistance", color.red, 2, linestyle = plot.linestyle_dashed)
plot(support, "Support", color.green, 2, linestyle = plot.linestyle_dashed)
plot(midline, "Midline", color.gray, 1, linestyle = plot.linestyle_dotted)
The resistance and support levels appear as dashed red and green lines, making them easy to distinguish from price action. The midline uses a dotted style to indicate it is a derived reference level with less significance than the boundaries.
When plotting an oscillator with a signal line, the dotted style works well for the signal line because it communicates a secondary role relative to the main oscillator plot.
//@version=6
indicator("MACD with Dotted Signal")
[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
plot(macdLine, "MACD", color.blue, 2)
plot(signalLine, "Signal", color.orange, 1, linestyle = plot.linestyle_dotted)
plot(histLine, "Histogram", color.gray, style = plot.style_histogram)
The MACD line draws as a solid blue line. The signal line draws as a dotted orange line, making the crossover points between the two lines easy to identify at a glance. The histogram uses its own style, which is unaffected by the linestyle parameter.
When plotting multiple moving averages on the same chart, linestyles help distinguish between them without relying solely on color. This is especially useful for traders who are colorblind or who use dark chart themes where certain color combinations are hard to differentiate.
//@version=6
indicator("EMA Dashboard", overlay = true)
float ema9 = ta.ema(close, 9)
float ema21 = ta.ema(close, 21)
float ema50 = ta.ema(close, 50)
float ema200 = ta.ema(close, 200)
plot(ema9, "EMA 9", color.lime, 1, linestyle = plot.linestyle_solid)
plot(ema21, "EMA 21", color.yellow, 1, linestyle = plot.linestyle_solid)
plot(ema50, "EMA 50", color.orange, 2, linestyle = plot.linestyle_dashed)
plot(ema200, "EMA 200", color.red, 2, linestyle = plot.linestyle_dotted)
The short-term EMAs (9 and 21) use solid lines to emphasize their role as active signal generators. The medium-term EMA (50) uses a dashed line to indicate a trend-following reference. The long-term EMA (200) uses a dotted line to mark the major trend boundary. A trader scanning the chart can immediately tell which moving average is which based on line style alone.
The linestyle parameter works independently of other plot() parameters.2 You can combine it freely with color, linewidth, style, trackprice, offset, and all other existing parameters.
A few things to keep in mind when combining parameters:
linewidth parameter controls the thickness of the dashed or dotted line in pixels, just as it does for solid lines2linewidth makes dashes and dots thicker and more visible, which can improve readability on busy chartstrackprice parameter draws a separate dotted tracking line across the full chart width and is unrelated to the linestyle parameter3display parameter controls where the plot appears (chart, data window, status line) and does not interact with linestyle3//@version=6
indicator("Combined Parameters", overlay = true)
float sma = ta.sma(close, 20)
// Thick dashed line with area fill
plot(sma, "SMA 20", color.purple, 3, plot.style_area, linestyle = plot.linestyle_dashed)
This example demonstrates that the linestyle parameter applies to the plot.style_area style. The top edge of the area fill draws as a dashed line, while the area beneath fills with color as expected.
Dashed and dotted lines are visual tools, but they often represent levels or signals that drive trading decisions. If your indicator plots a dashed resistance level and generates alerts when price breaks through it, you can connect those alerts to automated execution.
TradersPost connects TradingView alerts directly to broker accounts, executing trades when your Pine Script conditions trigger.4 The linestyle of your plots does not affect alert logic at all. Alerts fire based on the underlying data conditions you define, not the visual appearance of the line. But using distinct linestyles helps you monitor your chart at a glance and confirm that the right levels are triggering the right alerts.
The linestyle parameter added to plot() in the September 2025 update fills a long-standing gap in Pine Script's plotting capabilities.1 With plot.linestyle_solid, plot.linestyle_dashed, and plot.linestyle_dotted, you can now visually separate primary indicators from reference levels, signal lines from main oscillators, and short-term averages from long-term ones. The parameter works with all line-drawing plot styles and combines freely with existing parameters like color, linewidth, and display.2 It is a small addition that makes indicator charts significantly easier to read.
1 TradingView Pine Script Release Notes
2 TradingView Pine Script v6 Language Reference
3 TradingView Pine Script User Manual
4 TradersPost - Automated Trading Platform