How auto trend line algorithms work
Manual trendlines vary between traders because each person picks different wicks or bodies to connect. One common implementation locates local swing highs and lows, waits for right-side confirmation, and projects a line between two confirmed points. Other implementations choose older anchors or fit a regression; the label alone does not specify a unique algorithm.
| Component | Algorithmic logic | Purpose in strategy |
|---|---|---|
| Pivot detector | Compares current high/low with N bars to the left and right | Filters minor noise and flags structural swing anchors |
| Slope calculator | (Price2 - Price1) / (BarIndex2 - BarIndex1) | Projects the diagonal boundary into current price action |
| Touch validator | Checks if intermediate bars violated or respected the line | Tests a stated geometric tolerance; it does not measure future reliability |
| Breakout trigger | Detects candle close beyond the projected trendline | Generates objective entry or alert conditions |