Automatic Trendline Drawing with Slope and Break Validation
Summary
This Pine library provides methods for drawing an initial line between two user supplied points and extending it as a trendline. The user provides the horizontal distance, endpoint values, and conditions for creating and continuing the line; the library calculates the slope and updates the projected endpoint as new bars arrive. An example uses successive pivot lows to create rising support lines.
An optional strict mode checks intervening prices against the proposed line before accepting it, with a selectable requirement that price remain above or below the line. An offset supports pivot conditions that become known after the relevant endpoint. The document explains the library’s objects, inputs, and methods, but offers no trading performance evidence. Automatic horizontal distance selection is deliberately absent because it can produce inconsistent results, and strict mode loops over historical values, adding some computational work.
Key ideas
- The library calculates line slope and extends a trendline from two supplied points.
- Users define the point spacing, endpoint values, and conditions for drawing and continuing a line.
- Strict mode can reject a line if intervening prices violate the selected above or below condition.
- An offset accommodates signals such as pivots that are confirmed after their plotted location.
- The library does not choose point spacing automatically, and strict checks add historical calculations.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.