INDICATOR MANUAL
Chart pattern indicatorClassical Auto Chart Patterns [AFD] · full manual · published to TradingView
Read fifteen classical formations found from confirmed pivots, the state each one has reached, and the Entry, Target and Stop geometry your own settings draw once a formation completes.
Start here
What the indicator does, the questions it can help answer, and its fresh-install defaults.
Eleven of the fifteen names are built from two boundaries — rising and falling channels, rising and falling wedges, ascending, descending and symmetrical triangles, rectangles, flags and pennants. Each boundary joins two same-side confirmed pivots and has to pass a three-part test before it is drawn at all: both anchors on the same side, no bar between them piercing the line, and no bar since the second anchor violating it. What separates one two-boundary name from another is mainly the two slopes and whether the boundaries converge, diverge or run parallel.
The remaining four are anchored differently. Double top, double bottom, head and shoulders and its inverse use two or three matched extrema and a single neckline rather than two boundaries, and a top pattern can complete only downward through its neckline — a close through the other side finishes nothing.
The label carries two separate ideas and keeps them apart on purpose. The conventional reading — Bullish, Bearish or Two-Sided, with Continuation, Reversal or Bilateral — is attributed to the classical literature and describes the shape’s name. Closed Above or Closed Below is this script’s own observation of the confirmed close that completed the formation. On a bullish-named shape that broke down the two disagree, and the completed label keeps the one a bar actually produced while the textbook reading moves to the hover text.
A formation is Forming, Completed or Expired, and each state has its own line style. Forming display ships off, so a fresh chart opens showing formations that already ended rather than shapes still developing. Expired formations stay available so the chart is not only the ones that completed.
Fresh-install defaults15 documented defaults
Swipe or scroll horizontally to see every column.
| Area | Default | Result |
|---|---|---|
| Preset | Balanced | Carries five geometry values together — pivots searched, search window, and the boundary, flat and parallel tolerances. None of the five is separately editable, and selecting Balanced changes nothing. |
| Swing strength | 8 | Bars required either side of a pivot to confirm it, and therefore the delay before a boundary anchored on it can be drawn. Stays editable under every Preset. |
| ATR | 14 | The volatility unit used to normalize slopes and tolerances. The R cap does not read this input. |
| Formation families | All eight on | Channels, Flags, Pennants, Triangles, Rectangles, Wedges, Tops & Bottoms and Head & Shoulders are all built. A family switched off is never built, so it never completes and never alerts. |
| Draw formations while they are forming | Off | A fresh chart shows completed and expired formations only. A hidden forming formation still forms, still completes or expires, and still alerts. |
| Completed / Expired formations kept | 1 / 0 | Recency windows for finished formations, not contests between families. |
| Show entry and exit levels | On | Draws Entry, Target and Stop against every completion and fills the levels table. |
| Gate levels on % Complete | Off · band 80–100 | Off, every completion is given levels. The band is greyed out and governs nothing until the switch is on; % Complete is elapsed bars, so it selects on age and nothing else. |
| Target 1 / 2 / 3 (R) | 0.25 · 0.5 · 1.0 | Your own multiples of R, drawn beyond Entry in the direction of the completing close. Nothing requires Target 2 to sit beyond Target 1. |
| Stop at structure | On · Stop (R) 0.3 inactive | Puts the Stop on the formation’s own opposite boundary read at the completing bar, floored at 0.5R. The label prints the distance it landed at, in R. |
| R cap (× daily ATR) | 1.0 | Caps R at one average true range of the last seven daily bars. A formation shorter than the cap keeps its own height; 0 turns the cap off. |
| Show position size | Off | No money figure appears until you state what one setup may risk. |
| Show levels table | On · Small | Lists every retained completed formation as a column, oldest first, from the same frozen fields the labels read. |
| Formation names · Hover notes | Name + reading · On | A forming label states the name and the attributed reading; a completed label states the name and which boundary it closed beyond, with the reading on the hover. |
| Alert detail | Brief | The formation, symbol, timeframe and what happened. Full and JSON add the frozen level prices; none of the three carries an action, signal or order field. |
How it works
How the indicator turns chart data into the states and drawings you see.
Confirmed pivots and the delay that follows
Pivots are confirmed, never provisional, so a boundary cannot exist until Swing strength bars after the pivot anchoring it. Formations therefore appear late by design — a shape drawn on an unconfirmed pivot is one that can be withdrawn, and a drawing that vanishes is worse than one that arrives late.
Boundary validity
A candidate line joining two same-side confirmed pivots is admitted only when no bar between the anchors pierces it and no bar since the second anchor has violated it. A pair the classifier cannot name is discarded rather than drawn under a generic label.
Where a formation starts and stops
Each boundary begins at its own first anchor, but the shaded formation covers only the stretch both boundaries share, so its left edge is the later of the two. A forming shape is projected forward and stops where it stops being that shape — at the apex where two boundaries converge, or where a parallel-sided one would leave the width band that named it.
Three states, three line styles
Forming is solid, family-colored, and follows price at the right edge. Completed is dotted and stops at the bar its completing close finished beyond a boundary or neckline. Expired is dimmer and dashed and stays on the chart. The styles are fixed in the source and are not settings.
Four ways to expire, one of which renames instead
A formation runs past its own apex, drifts outside the width band that named it, outlives its own span, or — for a flag or pennant only — stops being brief. That last case usually renames rather than ends it: the shape reverts to the channel or triangle its geometry already is and goes on, expiring only if that family is switched off or the underlying shape has itself run out.
Admission switches against display filters
The eight family switches are tested at admission, so a family switched off is never built and never alerts. Conventional reading and Conventional category are tested at drawing, so a formation they hide still forms, still completes and still alerts. Both apply at once and the narrowest wins, which is why an enabled family can still draw nothing.
% Complete is age, not quality
Bars since the formation’s left edge over bars to whichever bound will end it, so it reaches 100% on the bar the shape runs out and never a bar short of it, whether or not price broke a boundary. A formation at 90% is an old one, not a better one. It climbs every bar with one exception — a flag or pennant renamed to the longer-lived shape underneath it re-bases against that longer life and falls once.
Levels are configured geometry
Entry is the confirmed close that completed the formation, R is the formation’s own height under the cap, the targets are your own multiples of R, and the Stop is either that same R or the shape’s own opposite boundary. They measure nothing about outcomes, and that sentence travels with every level label whether or not Hover notes is on.
The projection arrow follows the attribution
The arrow always points the attributed conventional direction, forming and completed alike, never the direction the completing close took. Because it is the graphic form of that attribution it draws only where the attribution is readable — a completed formation therefore needs a non-Off label and Hover notes on together. A two-sided name draws no arrow at any stage.
One higher-timeframe request, and only for the cap
Below a daily chart, the R cap reads the average true range of the last seven completed daily bars, requested with the offset-by-one-bar form together with lookahead — the pairing TradingView documents as the non-repainting one. At daily and above the requested figure is discarded and the cap reads the chart’s own last seven bars instead. No other calculation reads a timeframe other than the chart’s own.
Output and state reference8 documented states
Swipe or scroll horizontally to see every column.
| Output or state | When it appears | Meaning |
|---|---|---|
| Forming | Both boundaries confirmed, or all anchor pivots for a neckline pattern | The shape is named and drawn solid, following price at the right edge. Hidden by default; hiding it changes nothing about detection. |
| Completed · Closed Above | Confirmed close beyond the upper boundary or above the neckline | The formation is drawn dotted to that bar. Entry, R and the level prices freeze there. |
| Completed · Closed Below | Confirmed close beyond the lower boundary or below the neckline | The same record in the other direction. On a bullish-named shape this and the conventional reading disagree on purpose. |
| Expired | Apex passed, width band left, span outlived, or a flag or pennant that stopped being brief | Drawn dim and dashed and kept on the chart, so the record is not only the formations that completed. |
| Conventionally Bullish / Bearish / Two-Sided | The formation’s name | Attributed to the classical literature and describing the name, not a forecast for this chart. |
| Continuation / Reversal / Bilateral | The formation’s name | The same attribution on the second axis. Both are drawing filters, so hiding one does not stop a formation being found. |
| Level reached | A confirmed bar after completion whose high or low touches a frozen level price | The level records the clock time it was reached. An unmarked level means only that no confirmed bar has reached it yet, never that it failed. |
| Levels withheld | Gate levels on % Complete is on and the completion falls outside the band | No Entry, target, Stop, zone, arrow or size, a dash down every level row, and an alert carrying no prices. The formation is still found, drawn, named and alerted. |
Settings
The 58-input reference follows the seven settings groups: Detection, Formations · Continuation & Bilateral, Formations · Reversal, Formations shown, Trade levels, Display and Alerts. Inputs shown greyed in the panel — the % Complete band while its gate is off, Stop (R) while Stop at structure is on — are listed with the values they hold while inactive.
Detection3 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| PresetpresetInput | Choice / text | Balanced | Strict · Balanced · Permissive |
| Swing strengthswingInput | Whole number | 8 | Min 1 · Max 50 |
| ATRatrLenInput | Whole number | 14 | Min 1 · Max 200 |
Formations · Continuation & Bilateral10 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Channel colorchanColorInput | Color | #31BFA5 | — |
| ChannelsshowChannelsInput | Toggle | On | — |
| Flag colorflagColorInput | Color | #E86FA8 | — |
| FlagsshowFlagsInput | Toggle | On | — |
| Pennant colorpennColorInput | Color | #C2C24E | — |
| PennantsshowPennantsInput | Toggle | On | — |
| Triangle colortriColorInput | Color | #4C9BF2 | — |
| TrianglesshowTrianglesInput | Toggle | On | — |
| Rectangle colorrectColorInput | Color | #B07CF0 | — |
| RectanglesshowRectanglesInput | Toggle | On | — |
Formations · Reversal6 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Wedge colorwedgeColorInput | Color | #E8A33D | — |
| WedgesshowWedgesInput | Toggle | On | — |
| Tops and bottoms colortopsColorInput | Color | #DE8A5A | — |
| Tops & BottomsshowTopsInput | Toggle | On | — |
| Head and shoulders colorhsColorInput | Color | #64B5CD | — |
| Head & ShouldersshowHSInput | Toggle | On | — |
Formations shown5 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Conventional readingbiasInput | Choice / text | All | All · Bullish · Bearish · Two-sided |
| Conventional categorycategoryInput | Choice / text | All | All · Continuation · Bilateral · Reversal |
| Draw formations while they are formingshowFormingInput | Toggle | Off | — |
| Completed formations keptkeptInput | Whole number | 1 | Min 0 · Max 10 |
| Expired formations keptexpiredKeptInput | Whole number | 0 | Min 0 · Max 10 |
Display8 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Formations drawndrawnInput | Whole number | 2 | Min 1 · Max 9 | Conditional |
| bydrawnByInput | Choice / text | Nearest | Nearest · Newest · Tallest · Longest | Conditional |
| Expired formationsexpiredColorInput | Color | #8A8F98 | Conditional |
| Shade the area between the boundariesfillInput | Toggle | On | — |
| Formation nameslabelModeInput | Choice / text | Name + reading | Off · Marker · Name · Name + reading |
| Label placementlabelPlaceInput | Choice / text | Right column | On the shape · Right column |
| Hover noteshoverNotesInput | Toggle | On | — |
| Projection arrows and legsprojArrowInput | Toggle | On | — |
Trade levels25 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Show entry and exit levelsshowLevelsInput | Toggle | On | — |
| Gate levels on % CompletepctGateOnInput | Toggle | Off | Conditional |
| betweenlevelGateInput | Whole number | 80 | Min 0 · Max 100 · Step 5 | Conditional |
| andlevelCapInput | Whole number | 100 | Min 0 · Max 100 · Step 5 | Conditional |
| Target levelstargetTiersInput | Whole number | 3 | Min 1 · Max 3 | Conditional |
| Target 1 (R)targetRInput | Decimal | 0.25 | Min 0.05 · Max 10.0 · Step 0.05 | Conditional |
| Target 2 (R)targetR2Input | Decimal | 0.5 | Min 0.05 · Max 20.0 · Step 0.05 | Conditional |
| Target 3 (R)targetR3Input | Decimal | 1.0 | Min 0.05 · Max 30.0 · Step 0.05 | Conditional |
| Stop at structurestopStructInput | Toggle | On | Conditional |
| Stop (R)stopRInput | Decimal | 0.3 | Min 0.1 · Max 10.0 · Step 0.1 | Conditional |
| R cap (× daily ATR)rCapMultInput | Decimal | 1.0 | Min 0.0 · Max 10.0 · Step 0.25 | Conditional |
| Show prices on level labelslevelPriceInput | Toggle | On | Conditional |
| Once a level is reachedonCloseInput | Choice / text | Clear | Keep · Clear | Conditional |
| Levels drawn forlevelsForInput | Choice / text | Newest only | Newest only · All | Conditional |
| If a level is not reachedunreachedInput | Choice / text | Remove it | Remove it · Fade it | Conditional |
| Target zonetargetColorInput | Color | #8C66FF | Conditional |
| Stop zonestopColorInput | Color | #D9453D | Conditional |
| Show position sizesizingInput | Toggle | Off | Conditional |
| Risk budgetriskBasisInput | Choice / text | Amount | Amount · Percent | Conditional |
| Amount per setupriskAmtInput | Decimal | 0.0 | Min 0.0 · Step 50.0 | Conditional |
| Account sizeaccountInput | Decimal | 0.0 | Min 0.0 · Step 1000.0 | Conditional |
| Percent per setupriskPctInput | Decimal | 1.0 | Min 0.0 · Max 100.0 · Step 0.05 | Conditional |
| Show levels tableshowTableInput | Toggle | On | Conditional |
| Table position and sizetablePosInput | Choice / text | Top right | Top left · Top center · Top right · Mid left · Mid center · Mid right · Bottom left · Bottom center · Bottom right | Conditional |
| Levels table position and sizetableSizeInput | Choice / text | Small | Tiny · Small · Normal · Large | Conditional |
Alerts1 input
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Alert detailalertDetailInput | Choice / text | Brief | Brief · Full · JSON |
Alerts and limitations
What can notify you, what can change the output, and what the indicator cannot establish.
2 fixed alert conditions
Both boundaries confirmed for a two-boundary shape, or all anchor pivots confirmed for a neckline pattern. Carries no prices, because none exist yet.
A confirmed close finished beyond a boundary or the neckline. Under Full or JSON detail it carries the frozen Entry, Stop and enabled Target prices.
Limits to keep visible
- Formations are found from confirmed pivots only, so one appears some bars after the pivot that anchors it. TradingView classes pivot-based scripts as potentially misleading for exactly this, and this one is in that category.
- It draws into the past and does not revise a drawing in place. The left end of a boundary means confirmed later, not known then — a finished chart shows lines reaching onto bars where the script had not drawn them yet.
- Nothing is scored, graded or ranked. The By dropdown beside Formations drawn allocates display slots among forming shapes from current geometry and puts no position or figure on a drawing.
- The levels are configured geometry, not measured outcomes. Nothing in the script measures a level as likely to be reached, and an unmarked level is not a failure.
- The keep counts are recency windows rather than per-family quotas. Flags and pennants must pass a duration test and a pole test on top of their geometry, so they end far less often and rarely occupy the most recent slots — switch the other families off or raise the counts to see them.
- Cup and handle, harmonic patterns and higher-timeframe context are out of scope for this build. Nothing reads a timeframe other than the chart’s own except the daily range that caps R.
- A replay measuring drawn-object revision was run against an earlier build and the shipping build has not been re-run, so the non-repainting design is disclosed rather than claimed as a proven replay result.
- Position size is off by default, converts no currency, rounds down to whole units, and never adds two sizes together. It is arithmetic on figures you supplied and the instrument’s own point value.
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 the chart empty when every family is switched on?
The two drawing filters apply on top of the family switches and the narrowest one wins. Conventional reading set to Bullish with Conventional category set to Bilateral share no name at all, and Rectangles on with the category set to Continuation draws no rectangle because the only name that switch builds is filed as bilateral. The formations are still found underneath, and still alerting.
Why do I see no formations still developing?
Draw formations while they are forming ships off, so a fresh chart opens showing formations that already completed or expired. Turn it on to watch shapes develop, and expect one to disappear again if it expires before completing.
Why have I never seen a flag or a pennant?
Completed and Expired formations kept are recency windows rather than contests, and flags and pennants must pass a duration test and a pole test on top of their geometry, so they end far less often and the most recent handful of completions is almost never one of them. Switch the other families off, or raise the two keep counts, and they appear.
Why did a completed formation’s arrow disappear?
A completed label states the name and which boundary it closed beyond, not the conventional reading, so the hover is the only place that attribution is left. The arrow is the graphic form of that attribution, so a completed formation needs a non-Off Formation names setting and Hover notes on together; turning off either withdraws the arrow and its leg. A two-sided name draws no arrow at any stage.
Why do formations of different heights show the same distance to Target?
The R cap is binding. R is capped at your multiple of the average true range of the last seven daily bars, and because the cap is a daily quantity while a formation’s height is a chart-timeframe one, the lower the chart timeframe the more often the cap rather than the shape sets R. Raise the multiple, or set it to 0, to give the shape’s own height back.
Why did a completion get no Entry, Target or Stop?
Gate levels on % Complete is on and that completion fell outside the band. Its row shows a dash down every level line and its alert carries no prices, which is an absence rather than a marker. The formation is still found, drawn, named and alerted. Setting the band to 0 and 100, or switching the gate off, withholds nothing.
Why is a table column still there after its levels vanished?
A column outlives its levels but not its formation. Clearing a reached level or narrowing Levels drawn for deletes the level drawing and keeps the row; hiding that formation’s kind, or the platform’s own limit on how far back a drawing can reach, takes the row with it.
Why does the label say Bullish when price closed down through the shape?
Those are two different statements and the script keeps them apart. The conventional reading describes the shape’s name and is attributed to the literature; Closed Above or Closed Below is the script’s own observation of the bar that completed the formation. When they disagree the completed label keeps the one a bar actually produced.