Skip to main content
AuctionFoundry
Menu

INDICATOR MANUAL

Automatic trendline indicatorAuto Trendlines [AFD] · full manual · published to TradingView

Draw and maintain a small set of confirmed-pivot trendlines only after every candidate passes the published four-part validity rule.

30 documented settingsPublished on TradingView · Aug 4, 2026

Start here

What the indicator does, the questions it can help answer, and its fresh-install defaults.

Two confirmed pivot highs define a descending candidate and two confirmed pivot lows define an ascending candidate. A pair must be same-side, progressive, unpierced between its anchors, and still unviolated through the current bar before it can be drawn.

The default three-length mode independently searches 10-, 20-, and 40-bar pivots on each side, for at most six live lines. Each tier refuses an anchor pair already held by another tier on that side, and among all qualifying pairs it selects the line nearest the current close.

Live lines are maintained rather than silently replaced. Touches are descriptive counts inside an ATR-scaled band. A confirmed violation or age limit retires a line and preserves selected history; only violations create alerts.

Fresh-install defaults8 documented defaults

Swipe or scroll horizontally to see every column.

Auto Trendlines fresh-install defaults
AreaDefaultResult
Swing searchStrength 10 · 10 pivotsSearches recent confirmed pivot pairs; every base pivot appears at least 10 bars after its origin.
Three lengths per sideOn · ×2 · ×4Uses pivot strengths 10, 20, and 40—not 5, 10, and 20—with up to three independent lines per side.
Candidate validity0.25 ATR pierce · 0 minimum span · 0 minimum touchesAllows a limited between-anchor pierce but adds no span or pre-draw touch requirement.
LifecycleWick through · 0 violation tolerance · 0.25 ATR touch bandAny trade beyond a live line retires it; touches count only inside the symmetric tolerance band.
Age and history300 bars · 5 retired linesAges out anchors older than 300 bars and keeps up to five retired line objects visible.
Live linesBoth sides · width 3 · extend rightDraws short/medium/long tiers at effective widths 2/3/4, so longer tiers are thicker.
Labels and emphasisTouch color · glow · labels · fill onShows touch counts, a halo, and optional shading between the shortest and longest live line on each side.
Empty and retired statesEmpty note on · gray 45% · width 1 · dottedExplains when no pair qualifies and visibly distinguishes retired history.

How it works

How the indicator turns chart data into the states and drawings you see.

Confirmed same-side pivots

Detection always uses wick-based ta.pivothigh() and ta.pivotlow() with equal left and right strength. Anchor Price can move the drawn point to the pivot bar’s body, but it does not change which pivot was detected.

Four-part validity rule

Both anchors must come from the same side; the second must be lower for descending or higher for ascending; no between-anchor bar may pierce beyond the configured tolerance; and no bar since the second anchor may already have violated the candidate.

Independent tier selection

Short, medium, and long tiers keep separate pivot pools. Each scans every usable pair, excludes a pair held by another tier on the same side, applies minimum span and touch requirements, then selects the qualifying line nearest the current close.

ATR-scaled tolerances

Pierce, violation, and touch tolerances multiply a simple mean of true range over ATR Length. This is not Wilder’s ta.atr(). Touch is a two-sided band: a bar far through the line is not counted merely because it crossed the band on the way.

Confirmed lifecycle

On a confirmed bar, a live line can be violated, aged out, switched off, or increment its touch count. Violation and age both freeze and restyle the line; switching a tier off removes it without adding a misleading retired record.

Maintained drawings

The line’s right endpoint follows the current bar when Extend to the right is on. Longer tiers are thicker, glow is a second line object, labels state tier, touches, and tolerance, and the optional fill only spans two already-drawn lines.

Screener and alert surfaces

Ten Data Window plots report nearest line prices, ATR distances, touch counts, presence, and live counts by side. Two fixed confirmed-bar alerts report a descending or ascending line violation; age retirement does not fire them.

Output and state reference9 documented states

Swipe or scroll horizontally to see every column.

Auto Trendlines outputs and states
Output or stateWhen it appearsMeaning
DESCENDING LINEValid pair of confirmed pivot highsNearest qualifying falling line for one enabled swing tier.
ASCENDING LINEValid pair of confirmed pivot lowsNearest qualifying rising line for one enabled swing tier.
SHORT / MID / LONGThree-length mode onIndependent 10/20/40 default pivot searches, drawn progressively thicker.
TOUCH COUNTBar lands inside the selected two-sided bandHistorical count shown with its ATR tolerance; not a strength rating.
RETIRED LINEConfirmed violation or anchor ageFrozen historical drawing using the broken-line style.
NO VALID LINENo live qualifying pair on an enabled sideOn-chart explanation instead of a forced invalid drawing.
SHADED GAPShortest and longest line both live on a sideFill between two line objects; not a level, zone, or signal.
DISTANCE / PRESENCEData Window or ScreenerNearest line price, ATR distance, touches, presence flag, and live count per side.
VIOLATION ALERTConfirmed bar retires one or more lines by priceSide-specific historical event; age retirement is excluded.

Settings

The 30 rows below match the published Pine input surface across Detection, Lifecycle, and Display. Conditional multiplier and label controls remain dimmed until their parent feature is enabled.

📐 Detection11 inputs

Swipe or scroll horizontally to see every column.

📐 Detection settings and defaults
SettingControlDefaultChoices, limits & availability
Swing StrengthswingInputWhole number10Min 1 · Max 50
Pivots SearchedpoolInputWhole number10Min 2 · Max 12
Pierce Tolerance (× ATR)pierceInputDecimal0.25Min 0.0 · Max 3.0 · Step 0.05
ATR LengthatrLenInputWhole number14Min 1 · Max 200
Bars to ApplyhorizonInputWhole number300Min 0 · Max 5000
Minimum Anchor SpanspanInputWhole number0Min 0 · Max 200
Anchor PriceanchorInputChoice / textWickWick · Body
Minimum TouchesminTouchInputWhole number0Min 0 · Max 10
Three lengths per sidetiersInputToggleOn—
Medium length multiplemidMultInputWhole number2Min 2 · Max 10 | Conditional
Long length multiplelongMultInputWhole number4Min 2 · Max 20 | Conditional
📊 Lifecycle4 inputs

Swipe or scroll horizontally to see every column.

📊 Lifecycle settings and defaults
SettingControlDefaultChoices, limits & availability
Violated BybasisInputChoice / textWick throughWick through · Close through
Violation Tolerance (× ATR)violateInputDecimal0.0Min 0.0 · Max 3.0 · Step 0.05
Touch Tolerance (× ATR)touchInputDecimal0.25Min 0.0 · Max 3.0 · Step 0.05
Retired Lines KeptretireInputWhole number5Min 0 · Max 10
🎨 Display15 inputs

Swipe or scroll horizontally to see every column.

🎨 Display settings and defaults
SettingControlDefaultChoices, limits & availability
Descending linesshowFallingInputToggleOn—
Ascending linesshowRisingInputToggleOn—
DescendingfallingColorInputColor#FF1744 · 0% transparentConditional
AscendingrisingColorInputColor#00E676 · 0% transparentConditional
Line widthwidthInputWhole number3Min 1 · Max 5
Extend to the rightextendInputToggleOn—
Colour by touch countrampInputToggleOn—
GlowglowInputToggleOn—
Show touch countshowLabelInputToggleOn—
Label positionlabelPosInputChoice / textRight of lineRight of line · Below, centered | Conditional
Shade between the lengthsfillInputToggleOn—
Note when no valid lineshowEmptyNoteInputToggleOn—
Broken linebrokenColorInputColorGray · 45% transparent—
WidthbrokenWidthInputWhole number1Min 1 · Max 5
StylebrokenStyleInputChoice / textDottedSolid · Dashed · Dotted

Alerts and limitations

What can notify you, what can change the output, and what the indicator cannot establish.

2 fixed alert conditions

Descending line violated

A confirmed bar violated and retired at least one live descending line.

Ascending line violated

A confirmed bar violated and retired at least one live ascending line.

Limits to keep visible

  • Confirmed pivots are delayed by their right-side strength. At the default three lengths, candidate anchors confirm 10, 20, or 40 bars after origin.
  • Whether the published script repaints has not been established by the repository’s replay checklist, so this manual makes no blanket repaint claim.
  • Log-scale rendering and maximum-load drawing performance were not established by the published-build evidence record.
  • Bars to Apply bounds pivot pools and ages live lines. A lower value can leave longer tiers with too few confirmed pivots to draw.
  • Minimum Touches delays the same qualifying line until more history exists; it is not a quality, strength, or probability filter.
  • Pierce, touch, and violation tolerances use a simple mean of true range, not Wilder’s ATR, and therefore can differ from other ATR-scaled tools.
  • A drawn line reaches no more than 9,500 bars into the past even when its logical anchor is older, avoiding the platform’s past-coordinate limit.
  • The script reads only the active chart’s OHLC series and makes no request.*() calls. Different symbols, timeframes, sessions, and loaded history can produce different pivots and lines.
  • Lines, counts, shades, and alerts describe past chart geometry. They do not predict a reaction, breakout, target, entry, or outcome.

Troubleshooting

Start with what you see on the chart. Each answer explains the likely cause and the first setting, timeframe, or data condition to check.

Why is no trendline showing on one side?

Either that side is turned off or no recent pair of confirmed highs or lows passed all four line checks. Turn on Note when no valid line to confirm that the script is deliberately refusing the available pairs, then review the side switch and candidate filters.

Why did a trendline appear long after its anchor?

The line cannot use a pivot until enough bars form to confirm it. With the default three lengths, short, medium, and long anchors confirm after 10, 20, and 40 bars. Lower strengths appear sooner but also accept smaller turns.

Why are the default swing lengths 10, 20, and 40?

They are three confirmation speeds built from a base Swing Strength of 10 and multipliers of 2 and 4. Short, Mid, and Long describe the pivot horizon—not the line’s quality or chance of holding.

Why is the longer-term trendline thicker?

Thickness identifies the tier at a glance. With base width 3, Short draws at 2, Mid at 3, and Long at 4. A thicker line is a longer pivot horizon, not a stronger setup.

Why is the touch count higher than the touches I saw after the line appeared?

The script also counts valid touches between the second anchor and the later bar that confirmed the line. Those touches happened before the drawing became visible, so the first label can start above zero.

Why did a trendline retire without an alert?

The line may have reached the Bars to Apply age limit rather than being broken by price. Age retirement keeps the historical drawing but does not fire a violation alert. Increase Bars to Apply if you want eligible lines kept longer.

Why did Minimum Touches make a line appear later and farther away?

The script waits until the candidate has the required number of touches before adopting it. By then, price and the projected line may be farther apart. Lower Minimum Touches if you want earlier adoption; the setting is not a strength score.

Why doesn’t the alert message show my tolerance value?

TradingView requires this fixed alert message to be written before your input values are known, so it cannot insert the number. Check the saved alert’s Violated By and Violation Tolerance settings when reviewing the event.

Risk disclosure

Auction Foundry LLC provides educational charting tools and general market commentary only. This is not investment, financial, legal or tax advice, and nothing here is a recommendation, offer or solicitation to buy or sell any instrument. Auction Foundry is not registered with the SEC as an investment adviser, nor with the CFTC as a commodity trading advisor, and is not an NFA member.

Trading involves risk, including loss of principal. Losses can exceed a modeled stop and, for leveraged or margin products, can exceed the amount initially deposited or invested. Indicators can be wrong, delayed or unsuitable for your circumstances, and past or hypothetical results do not predict future results. Free access does not change any of this. Consider your objectives and consult a licensed professional before acting. Using these tools does not create an advisory or brokerage relationship.

Auction Foundry LLC is an independent publisher and is not affiliated with, endorsed by, or sponsored by TradingView, Inc. “TradingView” is a trademark of TradingView, Inc., used here only to identify the platform our scripts are published on. Scripts are published to TradingView as a community author on the same terms as any other author.

Read the full Risk Disclosure for the dated, versioned document this summarizes.