Pine Script

How to Plot Dashed Lines in Pine Script v6

How to use Pine Script plot linestyles to create dashed and dotted lines in TradingView charts, added in the September 2025 update.

Tom Hartman

Marketing

Reviewed by Mike Christensen

Fact-checked by Mike Christensen

6 Min Read
BluSky — The Future of Trading. Prop firm futures trading. Sign up at BluSky.pro.

Bottom Line

  • The September 2025 update added a linestyle parameter to the plot() function with three options: solid dashed and dotted
  • Use plot.linestyle_solid plot.linestyle_dashed or plot.linestyle_dotted as the linestyle argument
  • Linestyles only apply to plot styles that draw lines such as plot.style_line and plot.style_stepline
  • Dashed and dotted lines are useful for distinguishing support/resistance levels signal lines and reference levels from main indicators

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.

The Three Linestyle Constants

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 specified2
  • plot.linestyle_dashed draws a line with evenly spaced dashes, creating visible gaps between each dash segment2
  • plot.linestyle_dotted draws a line made of evenly spaced dots2

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

Compatible Plot Styles

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 value2
  • plot.style_linebr draws a line with breaks at na values instead of connecting through them2
  • plot.style_stepline draws a staircase-style line with vertical transitions between value changes2
  • plot.style_stepline_diamond draws a step line with diamond markers at each value change2
  • plot.style_area draws a line with a filled area beneath it, and the linestyle applies to the top edge line2

The following plot styles are not affected by linestyle because they do not render lines:

  • plot.style_histogram draws vertical bars
  • plot.style_columns draws filled columns
  • plot.style_circles draws circle markers
  • plot.style_cross draws cross markers

Dashed Support and Resistance

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

Dotted Signal Line Overlay

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.

Multi-Style EMA Dashboard

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.

Combining with Other Parameters

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:

  • The linewidth parameter controls the thickness of the dashed or dotted line in pixels, just as it does for solid lines2
  • Increasing linewidth makes dashes and dots thicker and more visible, which can improve readability on busy charts
  • The trackprice parameter draws a separate dotted tracking line across the full chart width and is unrelated to the linestyle parameter3
  • The display 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.

Using Linestyles with Automation

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.

Conclusion

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.

References

1 TradingView Pine Script Release Notes
2 TradingView Pine Script v6 Language Reference
3 TradingView Pine Script User Manual
4 TradersPost - Automated Trading Platform

All In Pine Script
  • Pine Script Mar 9, 2026

    Export Constants from Pine Script Libraries (v6)

    How to export constant variables from Pine Script libraries to share reusable values like ratios, thresholds, and configuration across multiple scripts.

  • Pine Script Mar 9, 2026

    How to Automate Pine Script Strategies

    How to automate your Pine Script v6 strategies with TradersPost webhooks, from alert setup to live broker execution with supported brokers.

  • Pine Script Mar 9, 2026

    What Changed in the Pine Script Editor in 2025

    Pine Script developer experience improvements from 2025: unlimited scopes, 10x longer strings, the new Pine Editor layout, and flexible line wrapping.

  • Pine Script Mar 9, 2026

    Pine Script Multi-Symbol Screener Tutorial

    How to build a multi-symbol dashboard in Pine Script v6 using dynamic requests to compare prices, RSI, and volume across multiple tickers.

Start trading at scale today. Sign up for free.

Free 7-day trial

Set-up in 3 minutes

Paper account for testing

TradersPost operates as a non-custodial automated trading platform, enabling users to connect alerts from their preferred trading platforms to their selected brokerage or exchange accounts. It abstains from the transmission, custody, or management of customer funds, covering both traditional and cryptocurrency assets. Typically, registration requirements set by regulatory entities such as the SEC, FINRA, or FinCEN apply to entities that hold or transmit customer funds. To ensure ongoing compliance, TradersPost regularly engages with regulatory authorities to confirm its adherence to all relevant local and federal laws.

TradersPost does not provide alerts, signals, research, analysis, or trading advice of any kind. It is designed to assist traders and investors in making their own trading decisions based on their alerts. The platform does not offer recommendations regarding securities to buy or sell, nor does it provide trading or investing advice. The platform and its features, capabilities, and tools are provided 'as-is' without any warranty.

Risk Disclosure: The use of automated trading systems involves inherent risks, including the potential for significant financial loss. These systems operate based on predetermined algorithms that may not fully adapt to changing market conditions, possibly making them unsuitable for some investors. Individuals are advised to thoroughly assess their financial situation and risk tolerance before using this platform.

Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.

© 2026 TradersPost, Inc. All rights reserved.