Auto Trend Lines Indicator

Trendoscope - Company Profile
Trendoscope - Company Profile

At Trendoscope, we specialise in designing and developing pattern recognition algorithms for technical trading. Our proprietary tools and algorithms provide traders and investors with the most accurate and reliable data possible, helping them make better decisions and achieve greater success in the markets.

Link to the Indicator: Auto Trend Lines Indicator

A brief history of how we derived this indicator

I started off with the intention of creating a script to identify Wolfe wave projection. But, soon ran into a problem with loops. Realized drawing a wedge is more difficult than drawing a converging triangle. Hence, took a step back and started working on wedges and triangle identification. Ended up with a messy output that looked like this.

Initial Attempt For scanning Wedges
Initial Attempt For scanning Wedges

Had to take another step back and hence decided to make Trendlines detection script and here we are :)


  • Scan pivots that are in trend. This means, a series of pivot Highs or pivot lows either in ascending order or descending order.
  • Draw a trend line between each of the pivots in the trend series. For example, if there are 5 pivot high uptrend pivots, draw mXn lines between each of these points.
  • Select the trend line which is more accurate or stronger. Accuracy is measured by the number of candles/wicks touching the line and the number of candles that fall outside the line. Stronger trendlines will touch more candles and pivots with less overflow.
  • Remove all lines except the most accurate one for each direction.
At any point in time, you will see up to 4 trend lines in this script.
  • Trendline joining pivot highs in up-trending condition
  • Trendline joining pivot lows in up-trending condition
  • Trendline joining pivot highs in down-trending condition
  • Trendline joining pivot lows in down-trending conditions

The older line will remain until the new one comes through of the same type. Hence, you will still be able to see trending high and low trend lines for down-trending instruments which are created way back!! Also, new trendlines replace old ones only if they are stronger (connect to more pivots with less overflow)

Settings - Auto Trend Lines Indicator