parallelChannel

This tool lets you draw two parallel trendlines to mark a channel, plus an optional midline. Traders often use it to visualize when price is “bouncing” between two levels (support & resistance in trend form).

Syntax

parallelChannel(fromPoint, toPoint, parallelDistance, styles?, text?)

Parameters

  • fromPoint: The starting point of the channel (use newPoint(time, price)).

  • toPoint: The second point, which sets the direction (slope) of the channel.

  • parallelDistance: A third point that tells the tool how far away the parallel line should be (the “width” of the channel).

  • Parameters (Styles)

    Property
    Type
    Description

    backgroundColor

    BaseColors / RGBAColor

    Fill background color of the channel.

    extendLeft

    boolean

    Extend the lines indefinitely to the left.

    extendRight

    boolean

    Extend the lines indefinitely to the right.

    fillBackground

    boolean

    Fill the channel background (default transparent if false).

    labelBold

    boolean

    Makes the label text bold.

    labelFontSize

    number

    Font size of the label.

    labelHorzAlign

    string

    Horizontal alignment of the label (left, center, right).

    labelItalic

    boolean

    Makes the label text italic.

    labelTextColor

    BaseColors / RGBAColor

    Color of the label text.

    labelVertAlign

    string

    Vertical alignment of the label (top, middle, bottom).

    labelVisible

    boolean

    Show or hide the label.

    BaseColors / RGBAColor

    Color of the channel’s border lines.

    number

    Style of the border line (0 = solid, 1 = dotted, 2 = dashed, etc.).

    number

    Thickness of the border line.

    BaseColors / RGBAColor

    Color of the optional midline inside the channel.

    midlinestyle

    number

    Style of the midline.

    midlinewidth

    number

    Thickness of the midline.

    showMidline

    boolean

    Show or hide the midline.

    transparency

    number (0–100)

    Transparency level of the background fill.

  • text (optional) A short label for the channel.

Return Value

  • string — Unique drawing id.

Example

This script draws a parallel channel every 40 candles. It uses an old low as the base, a recent high to set the slope, and another recent low to define the distance (width) of the channel.

The result: a purple channel running through recent price action, with a label “Channel.”

Result

Tips

  • Tip: Great for spotting ranges or sloping channels in trends.

  • Tip: Try using swing highs/lows for the anchors to make the channel more meaningful.

Warning

  • Warning: If your third point (parallelDistance) is too close to the base, the channel may look flat or invisible.

  • Warning: Adding too many channels can clutter your chart quickly.

Good Practice

  • Good Practice: Use consistent colors (e.g., purple for channels) so you can instantly recognize them on your chart.

  • Good Practice: Always base your channel on obvious swing highs and lows — this makes it easier to trust the lines.

Last updated