INDICATOR MANUAL
Harmonic pattern indicatorAuto Harmonic Patterns [AFD] · full manual · published to TradingView
Read twelve harmonic formations, their Potential Reversal Zones and frozen Setup checks, then distinguish formation status from the reference levels price later touched.
Start here
What the indicator does, the questions it can help answer, and its fresh-install defaults.
Auto Harmonic Patterns [AFD], shown as AHP [AFD] on the chart, matches confirmed swing-leg ratios to defined harmonic windows. The twelve names are Gartley, Bat, Alt Bat, Butterfly, Crab, Deep Crab, Cypher, Shark, Nen Star, 5-0, ABCD and Three Drives. Bullish describes a W-shaped orientation with D at a low; bearish describes an M-shaped orientation with D at a high. Neither word is an instruction.
A Potential Reversal Zone (PRZ) is the outer range of the pattern’s canonical price projections, not necessarily their overlap. Setup records geometry and optional prior-trend checks at confirmation. Only qualifying Setups carry configured Entry, Target and Stop prices; other displayed formations can retain a PRZ and an explanation of their missing Setup.
The two swing readings use the current chart timeframe. A completed formation is available only after D confirms, then is drawn back to earlier pivots. Optional forming candidates and projected D zones can change or disappear. The historical position of a drawing is not the time it became available.
The script is free and open-source under MPL-2.0. Pattern definitions draw on published harmonic work, including Scott Carney and Darren Oglesbee. Auction Foundry’s implementation combines Setup qualification, shared-D labels and separate formation/level tracking; internal components originate in Classical Auto Chart Patterns and Fibonacci Confluence. No ownership of harmonic methods is claimed.
Fresh-install defaults10 documented defaults
Swipe or scroll horizontally to see every column.
| Area | Default | Result |
|---|---|---|
| Preset | Standard | Triangle fill, Setup markers and the levels table are effectively on; forming patterns and projected D zones are off. Show PRZ and Show levels follow their own switches. |
| Swing strength / Major swing strength | 8 / 24 | Pivots require that many bars on each side. Major adds a larger reading of the same timeframe; below 8 is off, otherwise it must exceed Swing strength. |
| Ratio tolerance / skipped swing | 8% / On | Tolerance is relative to each ratio-window edge. A leg can skip one interior counter-swing of at most 0.382 of that leg. |
| Pattern visibility | Both orientations; ABCD off | The other family switches are on. Family and orientation controls filter drawings; detection and pattern/lifecycle alerts continue. |
| Triangle transparency | 60% | 0 is solid and 100 is invisible. Existing instances retain their saved value. Finished patterns lose their triangle fill. |
| PRZ / levels / prior trend | On / On / required | The Setup trend basis is Swing structure. Show trend context displays the frozen reading independently of the requirement. |
| Targets / Stop | 0.382R, 0.618R, 1.0R / structure | Targets are sorted. Structure Stop starts at D with a 0.5 ATR buffer; R is C-to-D pattern distance, with its ATR cap off. |
| History / age / search | 5 kept / 300 bars / 600 bars | Patterns kept selects finished drawings. Bars to apply bounds age after confirmation; the formation’s own span can end it earlier. Pivot chain bars bounds search separately. |
| Reached-level display | Clear | Reached Targets disappear; T3 or Stop clears the ladder. Aged levels and PRZ are hidden by default, while eligible retained table records remain. |
| Position size / alert format | Off / Brief | Amount per Setup and Account size both default to zero. Projected-D alert is off. A running TradingView alert must be created separately. |
How it works
How the indicator turns chart data into the states and drawings you see.
Confirmed pivots and availability
With Swing strength 8, a D pivot on bar 100 can produce a completed formation only when bar 108 closes and the checks qualify it. The drawing then reaches back to D and earlier pivots. Level-touch recording can begin on bar 109. This is an illustrative timing sequence, not a market test. The Major reading has its own delay; a formation found by both readings is admitted once, by the reading that confirms first.
Ratio windows and drawing filters
Every required leg window must hold within Ratio tolerance. Zero tolerance uses the defined textbook figures. The optional skipped swing must remain strictly inside its enclosing leg and be no more than 0.382 of its size. ABCD uses the equal-leg form; a five-point name admitted on the same C-to-D leg on the same bar suppresses standalone ABCD admission. Family switches, Orientation and Patterns kept affect presentation rather than detection sensitivity.
Shared-D names and family colors
Completed bullish outlines are solid and bearish outlines dotted; Major adds one to the completed line width. Displayed formations sharing a D point share a name label. Its hover lists individual names and ordinals that connect to table columns; these are identifiers, not ranks. Each formation retains its own PRZ and levels. The four family colors separate Retracement, Extension, Extended C and Drives; Three Drives and ABCD share the Drives color. Pattern names offers Off, Marker and Name.
Potential Reversal Zone
The completed PRZ spans the outer prices of its canonical projections. Its hover explains the components. A projection collapsing to one price is widened into a band using Ratio tolerance. The harmonic name does not establish a future reversal, and a non-Setup formation can also have a PRZ. Show PRZ follows its own switch at every preset, including Minimal.
Preset-controlled features
Minimal turns triangle fill, Setup marker, levels table, forming patterns and projected D zones off. Standard enables the first three; Detailed enables all five. Custom follows the individual switches, with projections also requiring Draw while forming. Show levels and Show PRZ remain independent at every preset. A preset does not guarantee an eligible formation exists.
Disabled controls and transparency
Preset-controlled checkboxes are editable only under Custom. Forming patterns drawn requires effective forming; projected zones under Custom require forming too. Fill transparency is editable when triangle fill is effective, ranges from 0% solid to 100% invisible and defaults to 60%. Presets do not reset saved transparency. Finished formations lose triangle fill; PRZ and Target/Stop rectangles use separate shading. Disabled inputs retain their values.
Setup qualification
When D confirms, the ratios must qualify, D must be inside its PRZ and respect the applicable X boundary, and the rounded confirmation close must be off D in the pattern’s orientation without already leaving the exact D-to-C band. With Require trend context on, the family’s prior-trend requirement must also hold. A missing Setup can reflect D outside PRZ, D past X, close on D, an unreadable or opposite prior trend, or a formation already resolved before confirmation. Setup is a frozen qualification state, not a recommendation.
Prior-trend family rules
AHP classifies Gartley, Bat, Cypher, Shark and ABCD as continuation for this check: bullish shapes require a prior uptrend and bearish shapes a prior downtrend. Butterfly, Crab, Deep Crab, Alt Bat, Nen Star, 5-0 and Three Drives use the reverse requirement. These are Setup classification rules, not claims about what price will do next.
Swing structure and moving-average context
Swing structure compares the formation’s origin swings with earlier confirmed swings. Moving average compares D with the selected SMA or EMA of close at D; Both must agree requires both readings. The average length also sets its slope comparison lookback. Trend band and slope thresholds use ATR at D; zero slope skips that test. The reading is frozen at confirmation using the relevant earlier values. Show trend context affects display only; Require trend context controls qualification.
Entry and pattern-distance R
Entry references the confirmation-bar close rounded to the instrument’s tick. R is the absolute C-to-D price distance. A positive R cap × chart ATR can reduce it using confirmation-bar ATR; zero leaves it uncapped, and the table marks a capped calculation. R is not Entry-to-Stop risk: a Target labeled 1.0R is not a claim of a 1:1 reward-to-risk ratio or a return.
Target and Stop geometry
The three configured Target multiples are sorted into T1, T2 and T3 and placed beyond Entry in the formation’s orientation, with tick rounding. Equal multiples or rounding can put Targets together. Structure Stop uses D minus the ATR buffer for bullish shapes or D plus it for bearish shapes, enforces a minimum Entry-distance of 0.1R, and rounds outward to a tick. With structure off, Stop (R) instead measures a configured R distance from Entry. Changing Stop mode does not redefine R or the Targets.
Reference prices and labels
Prices are fixed at admission for the current inputs. Prices on labels controls the Entry price; Target and Stop labels show R figures, while exact prices remain in hovers and the table. The structure Stop’s displayed R distance can differ from Stop (R). For illustration, a C-to-D distance of 4 price units with the cap off places a 1.0R Target 4 units from Entry before tick rounding; Entry-to-Stop distance may be different. These are configured reference prices, not fills.
Formation status and expiry
After admission, Resolution tolerance adds an ATR buffer beyond C and D for later close-based resolution. A wick alone does not settle Status. The confirmation check uses the exact D-to-C band without that later buffer. Age ends a formation at the earlier of Bars to apply after confirmation or one more of its own X-to-D spans after D; it can age immediately if that span has already elapsed. Expiry is checked before later close-based resolution.
Reached is a separate record
Starting on the bar after D confirmation, confirmed bars’ highs and lows record level touches with a half-tick comparison tolerance. Earlier and confirmation-bar wicks are not counted retroactively. Tracking can continue after the formation resolves, ending at Stop, T3 or the same age horizon, whichever occurs first. When one bar touches a Target and Stop, their intrabar order is unknown; no fill or win/loss result is inferred.
Clear, Keep and retained drawings
Once reached: Clear removes each reached Target and clears the ladder at T3 or Stop. Keep retains the ladder and marks reached labels. Finished patterns lose triangle fill. Patterns kept selects retained drawings; Grey aged-out patterns and Hide aged levels and PRZ govern aged presentation. Aged hiding overrides Keep for chart overlays without erasing the eligible retained table record.
Levels table and hovers
At most the newest three eligible displayed formations occupy columns, ordered oldest to newest. The table requires effective Show levels table plus at least one of Show levels or Show trend context. Position and text size are editable when the table is enabled. Pattern/Status/Prior trend can remain when levels are hidden. Non-Setup prices are dashes; prior-trend warnings distinguish a missing required direction, No direction inside a band and Insufficient history. Hovers explain qualification and attribution.
Position size and currency
Show position size adds whole-unit calculations to the At your risk row and Stop hover; Full and JSON messages can include them with levels. Amount uses Amount per Setup. Percent uses Account size × Percent per Setup ÷ 100. Both budget sources start at zero. Budget values must already be in the instrument’s currency; point value is chart metadata, not a broker-specific lot conversion. One-unit reference risk equals displayed Entry-to-Stop distance × point value. Quantity is budget divided by that value, rounded down to whole units.
Sizing example and unavailable results
Illustrative arithmetic: Entry-to-Stop distance 2, point value 5 and budget 105 give one-unit reference risk 10 and quantity 10 before costs. A valid positive budget of 9 gives zero units. An unset/nonpositive budget, unavailable point value, unusable Stop distance or unsupported arithmetic precision/range gives a dash with a reason instead. These values are not an instrument specification or a recommended budget. The calculation does not read a broker account or place orders.
Forming candidates and projected D
Detailed, or Custom with forming enabled, displays unfinished X-A-B-C candidates. Dashed outlines and projected bands describe where enabled five-point ratio definitions still allow D; they can change or disappear and are not completed Setups. Forming patterns drawn selects one to three per reading. The optional projected-zone notification also requires a drawn zone.
Chart and history capacity
Use standard time-based bars or candles. Unsupported synthetic or non-time charts produce a configuration notice and no formations, levels or alerts. The detector uses the current chart’s price data and timeframe, with no higher-timeframe request, volume filter or session-specific model. Each reading selects up to three open drawings, tracks up to 64 unfinished records and retains 24 raw finished records. A resolved Setup may still be unfinished while levels are tracked; capacity-skipped admissions are disclosed in a notice. Search has a 17-pivot chain limit, and formations beyond drawing reach are skipped rather than shifted.
Output and state reference6 documented states
Swipe or scroll horizontally to see every column.
| Output or state | When it appears | Meaning |
|---|---|---|
| Open | Admitted formation remains within its lifecycle | No age expiry or qualifying close outside the later lifecycle band yet. Setup qualification is separate. |
| Closed above C / Closed below C | A qualifying close passed C in the formation’s orientation | The formation has resolved by close. Its level-touch record may continue. |
| Closed below D / Closed above D | A qualifying close passed D on the opposite side | A close-based formation resolution, distinct from a Stop touch. |
| Aged out | The age horizon was reached before a later resolution | The formation expired by time. This is not a Stop touch. |
| Setup | Frozen confirmation-time geometry and applicable prior-trend checks passed | Entry, Target and Stop references can be calculated. The marker describes qualification, not a trade recommendation. |
| Reached | A later confirmed bar’s high or low touched a reference level | Records touches, not fills. A Target and Stop reached on the same bar have unknown intrabar order. |
Settings
These 60 inputs describe a fresh instance of the September 7 release. Saved chart settings can differ. Presets determine effective display switches; the Defaults and Behavior sections explain their overrides and parent dependencies. Inline family color pickers and the table text-size dropdown each have their own row below.
Detection7 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Swing strengthswingInput | Whole number | 8 | Min 1 · Max 50 |
| Bars to applyapplyBarsInput | Whole number | 300 | Min 50 · Max 2000 |
| Ratio tolerance %ratioTolInput | Decimal | 8.0 | Min 0.0 · Max 15.0 · Step 0.5 |
| Allow one skipped swing per legskipInput | Toggle | On | — |
| ATR lengthatrLenInput | Whole number | 14 | Min 2 · Max 100 |
| Major swing strengthmajorSwingInput | Whole number | 24 | Min 0 · Max 100 |
| Pivot chain barschainBarsInput | Whole number | 600 | Min 50 · Max 4000 |
Patterns · Retracement2 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Gartley · Bat · Alt BatretrInput | Toggle | On | — |
| Retracement family colorretrColor | Color | #2962FF | — |
Patterns · Extension2 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Butterfly · Crab · Deep CrabextInput | Toggle | On | — |
| Extension family colorextColor | Color | #F23645 | — |
Patterns · Extended C2 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Cypher · Shark · Nen Star · 5-0extcInput | Toggle | On | — |
| Extended C family colorextcColor | Color | #FF9800 | — |
Patterns · Drives3 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Three DrivesdrivesInput | Toggle | On | — |
| ABCDabcdInput | Toggle | Off | — |
| Three Drives and ABCD colordrivesColor | Color | #26A69A | — |
Patterns1 input
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| OrientationorientInput | Choice / text | Both | Both · Bullish (W) · Bearish (M) |
Lifecycle4 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Patterns keptkeptInput | Whole number | 5 | Min 0 · Max 8 |
| Resolution tolerance × ATRresTolInput | Decimal | 0.0 | Min 0.0 · Max 2.0 · Step 0.05 |
| Grey aged-out patternsgreyAgedInput | Toggle | On | Conditional |
| Hide aged levels and PRZhideAgedInput | Toggle | On | Conditional |
Display8 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| PresetpresetInput | Choice / text | Standard | Minimal · Standard · Detailed · Custom |
| Draw while formingformingInput | Toggle | Off | Conditional |
| Forming patterns drawnformingMaxInput | Whole number | 2 | Min 1 · Max 3 | Conditional |
| Fill trianglesfillInput | Toggle | On | Conditional |
| Fill transparencyfillTranspInput | Whole number | 60 | Min 0 · Max 100 | Conditional |
| Projected D zoneprojInput | Toggle | Off | Conditional |
| Pattern nameslabelModeInput | Choice / text | Name | Off · Marker · Name |
| Line widthlineWidthInput | Whole number | 1 | Min 1 · Max 3 |
Trade levels12 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Show levelsshowLevelsInput | Toggle | On | — |
| Target 1 (R)targetR1Input | Decimal | 0.382 | Min 0.1 · Max 5.0 · Step 0.01 | Conditional |
| Target 2 (R)targetR2Input | Decimal | 0.618 | Min 0.1 · Max 5.0 · Step 0.01 | Conditional |
| Target 3 (R)targetR3Input | Decimal | 1.0 | Min 0.1 · Max 5.0 · Step 0.01 | Conditional |
| Stop at structurestopStructInput | Toggle | On | Conditional |
| Stop (R)stopRInput | Decimal | 0.25 | Min 0.05 · Max 2.0 · Step 0.05 | Conditional |
| R cap × chart ATRrCapInput | Decimal | 0.0 | Min 0.0 · Max 20.0 · Step 0.5 | Conditional |
| Once reachedonCloseInput | Choice / text | Clear | Clear · Keep | Conditional |
| Prices on labelslevelPriceInput | Toggle | On | Conditional |
| Target colourtargetColorInput | Color | #8C66FF | Conditional |
| Stop colourstopColorInput | Color | #D9453D | Conditional |
| Stop buffer × ATRstopBufferInput | Decimal | 0.5 | Min 0.0 · Max 3.0 · Step 0.05 | Conditional |
Setup8 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Require trend contextrequireTrendInput | Toggle | On | — |
| Show PRZprzInput | Toggle | On | — |
| Setup markermarkerInput | Toggle | On | Conditional |
| Trend basistrendBasisInput | Choice / text | Swing structure | Swing structure · Moving average · Both must agree |
| Trend averagetrendMaTypeInput | Choice / text | EMA | SMA · EMA | Conditional |
| Trend average lengthtrendMaLenInput | Whole number | 50 | Min 2 · Max 500 | Conditional |
| Trend band × ATRtrendMaBandInput | Decimal | 0.0 | Min 0.0 · Max 5.0 · Step 0.1 | Conditional |
| Trend slope × ATRtrendMaSlopeInput | Decimal | 0.0 | Min 0.0 · Max 5.0 · Step 0.1 | Conditional |
Position size5 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Show position sizesizingInput | Toggle | Off | — |
| 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 |
Levels table4 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| Show levels tableshowTableInput | Toggle | On | Conditional |
| 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 text sizetableSizeInput | Choice / text | Small | Tiny · Small · Normal · Large | Conditional |
| Show trend contextshowTrendInput | Toggle | On | Conditional |
Alerts2 inputs
Swipe or scroll horizontally to see every column.
| Setting | Control | Default | Choices, limits & availability |
|---|---|---|---|
| FormatalertDetailInput | Choice / text | Brief | Brief · Full · JSON |
| Projected-D alertprojAlertInput | Toggle | Off | — |
Alerts and limitations
What can notify you, what can change the output, and what the indicator cannot establish.
Dynamic alert events
A realtime confirmed-close admission event. Family switches and Orientation do not suppress it.
A realtime formation lifecycle event. Drawing filters do not suppress this event type; later Target and Stop touches do not create notifications.
Opt-in entry into a drawn projected zone on a confirmed bar. Requires effective forming/projection display, so drawing choices matter for this event type.
Limits to keep visible
- Completed drawings appear after pivot confirmation and extend back to past pivots. Optional forming candidates and projected zones can change or disappear; there is no blanket non-repainting claim.
- A pattern match does not establish an edge. PRZ does not predict a reversal, Setup is not a recommendation, and configured levels are not measured outcomes.
- Reached records price touches without fills, position execution, intrabar order, performance statistics or win/loss totals.
- Sizing assumes instrument-currency budgets and excludes FX conversion, fees, spread, slippage, gaps, fills, liquidity, margin, fractional quantities and combined-position exposure. A drawn Stop is not a guaranteed maximum loss; broker unit conventions can differ.
- Loaded history, data revisions, search horizons, drawing selection and bounded tracking affect coverage. Increasing Pivot chain bars or Patterns kept does not create an exhaustive historical catalogue.
- Prior trend is frozen context associated with formation confirmation, not the direction of the market now. Changing inputs recalculates chart history.
- Alert queue and rate limits can delay or omit events. Notification delivery and a complete historical event log are not guaranteed.
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 nothing drawn?
Check the configuration notice, standard time-based chart type, family/orientation filters and confirmed pivots. A valid configuration does not guarantee a matching formation exists. Patterns kept changes finished drawings, not detection sensitivity.
Why did a pattern appear several bars after D?
D must first confirm. With Swing strength 8, the completed formation appears eight bars after D and is then drawn back to its pivots. Its drawing location is not its availability time.
Why does a pattern have no Entry, Targets or Stop?
Read its Setup checks in the hover. A non-Setup formation has no level prices. Show levels, drawing selection and retention can also hide an eligible ladder.
Why is the table missing?
Minimal disables the table. Custom requires Show levels table. An eligible formation and at least one of Show levels or Show trend context are also required.
Why is Major not running?
Major swing strength below 8 turns that reading off. At 8 or above it must exceed Swing strength; an invalid enabled pair produces a configuration notice.
Why is fill invisible or still set to 88?
Check the effective preset, saved Fill transparency and whether the formation has finished. The 60% default applies to a fresh instance; existing instances retain saved values. Finished formations lose triangle fill, and the transparency control does not change PRZ or Target/Stop box shading.
Why are inputs greyed out?
Preset-controlled switches can be edited only under Custom. Other controls require their parent feature to be enabled. Disabled inputs keep their values; the preset determines the effective display meanwhile.
Why did level touches continue after the formation closed?
Status and Reached have separate endings. Reached can continue after close-based formation resolution until Stop, T3 or the shared age horizon. A wick touch does not itself settle formation Status.
Why does position size show a dash or zero?
A dash means an unset/nonpositive budget or another unavailable or unsupported input. A valid positive budget smaller than one unit’s reference risk gives zero whole units. Percent mode still needs a positive Account size; the 1% default alone supplies no budget.
Why did a hidden pattern still alert?
Family and Orientation switches hide drawings without suppressing pattern-admission or lifecycle events. Projected-D alerts differ: they are opt-in and require a drawn projected zone. Recreate a running alert to adopt changed chart settings.