This ThinkScript for ThinkorSwim will plot automatic trend lines for the prevailing trend based upon calculating second-order pivots. This uses the top-down, bottom-up approach to trend lines. That is to say, it connects lower-highs for down trends and higher-lows for up trends.

This works on any time-frame and will plot the appropriate trend. Breakouts / breakdowns are indicated with an arrow. An audible alert may, optionally, be triggered as well.

Fun with ThinkScript: Automatic Trend Lines Screenshot

The trend lines may be drawn from the candle wicks or the candle bodies.

Fun with ThinkScript: Automatic Trend Lines Screenshot

The trend line may be extended to the left by a user-definable amount.

Fun with ThinkScript: Automatic Trend Lines Screenshot

Combine the auto-trend line and basic market structure with auto-fibonacci scripts (available as a separate purchase) for a powerful combination.

Fun with ThinkScript: Automatic Trend Lines Screenshot

Update

Thank you to the initial users who purchased this script and provided valuable feedback to me. Because trend lines that were established in the past may become significant once again, the ability to keep those trend lines on screen was requested several times, so I have added that feature.

The script will now plot between 1 and 10 trend lines at a time.

Fun with ThinkScript: Automatic Trend Lines Screenshot

Fun with ThinkScript: Automatic Trend Lines Screenshot

I have added the ability to limit the right extension of the trend line (instead of just continuing forever).

Fun with ThinkScript: Automatic Trend Lines Screenshot

Fun with ThinkScript: Automatic Trend Lines Screenshot

Leave a Reply