flatBottom

This tool draws a channel with a horizontal bottom line and a sloped top line. Traders often use it when price is trending but seems to be respecting a flat support or resistance level at the bottom.

Syntax

flatBottom(fromPoint, toPoint, bottomLinePoint, styles?, text?)

Parameters

  • fromPoint: (use newPoint(time, price)) The first anchor point that starts the sloped line.

  • toPoint: (use newPoint(time, price)) The second anchor point that sets the slope/direction of the top line.

  • bottomLinePoint: Defines where the flat bottom line will be drawn (this sets the width/height of the channel).

  • styles (optional) Style settings:

    • backgroundColor (RGBAColor | BaseColors). Fill color between lines.

    • fillBackground (boolean). Turn background fill on/off.

    • transparency (number). 0 = solid, higher = more transparent.

    • linecolor (RGBAColor | BaseColors). Color of main lines.

    • linestyle (number). Line pattern (from the charting library).

    • linewidth (number). Line thickness.

    • extendLeft (boolean). Extend the channel left.

    • extendRight (boolean). Extend the channel right.

    • labelVisible (boolean). Show the text label.

    • labelBold, labelItalic, labelFontSize (…). Label font styling.

    • labelTextColor (RGBAColor | BaseColors). Label color.

    • labelHorzAlign, labelVertAlign (string). Label alignment.

    • showBarsRange, showPriceRange, showDateTimeRange, showPrices (boolean). Show stats on the drawing.

    • textcolor (RGBAColor | BaseColors). Legacy text color alias.

    • leftEnd, rightEnd (number). Line cap styles (charting library semantics).

  • text (optional) A short label for the channel (only shows if labelVisible = true).

Return Value

  • string — A unique drawing id.


Example

Here’s a script that plots a flat-bottom channel every 36 candles. We use the low price as the flat base and the highs for slope/distance.

This will create a teal channel with a flat base on the lows and a sloping top line from the chosen highs.

Result


Tips

  • Great for spotting price action where support is holding steady but highs are trending.

  • Works well for triangle-like consolidation patterns.

Warning

Good Practice

Last updated