Skip to main content
AuctionFoundry
Menu

INDICATOR MANUAL

Market structure indicatorMarket Structure + Swing Levels [AFD] · full manual · published to TradingView

Read confirmed swings, volatility-scaled zones, and Break or Shift events without turning them into trade instructions.

56 documented settingsPublished on TradingView · Jul 25, 2026

Start here

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

A swing high or low is accepted only after the selected number of bars exists on both sides of its origin. The script then compares it with the prior swing of the same type and can label it higher, equal, or lower.

Each confirmed swing can create a zone. In ATR mode, the zone uses ATR from the swing’s origin bar. Overlapping zones on the same side merge transitively while preserving the complete price union and the number of represented swings.

Structure events are evaluated on confirmed bars. A Break continues the tracked direction. After direction exists, a Shift clears the opposite-side reference and changes that direction; the first qualifying clearance instead appears as Shift (Initial) and establishes direction without claiming a reversal.

If you arrived from the smart-money vocabulary, Break is the event elsewhere called a break of structure (BOS) and Shift is the one called a change of character (CHoCH). The plain words are used here because they describe what the script measures — a level being cleared on a confirmed bar — without importing the claim that either event reveals institutional intent.

Fresh-install defaults8 documented defaults

Swipe or scroll horizontally to see every column.

Market Structure + Swing Levels fresh-install defaults
AreaDefaultResult
Preset ProfileSwingUses an effective Swing Strength of 7; the stored Custom value of 5 is inactive.
Swing labelsOnShows H/HH/EH/LH and L/HL/EL/LL classifications after confirmation.
StructureEnabled · CloseBreaks and shifts require a confirmed close beyond the tracked reference.
Structure drawingsLabels and lines offThe state engine continues while optional event drawings remain hidden.
ZonesOn · ATR 0.5 · ATR length 14Creates a half-width of 0.5 ATR on each side of the swing origin price.
Broken zonesOn · 20 barsFreezes and recolors a broken zone for 20 chart bars, subject to the FIFO cap.
DashboardOn · nearest-zone rows onShows direction, last event, active-zone counts, and the nearest zone above and below.
Dynamic alertsOn · zone breaks includedAggregates confirmed events into one alert() message per bar when configured in TradingView.

How it works

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

Swing confirmation

The selected strength is used on both sides of a pivot. A strength-7 swing therefore becomes known seven bars after its origin. The label is placed at the origin only after that confirmation exists.

Swing classification

A confirmed high is H, HH, EH, or LH; a confirmed low is L, HL, EL, or LL. Equal-price swings keep separate origin identities for later structure events.

Zone geometry and clustering

ATR, ticks, points, or currency define the half-width around each swing. Same-side overlaps merge into an exact-union cluster; ×N counts represent confirmed swing zones, not repeated tests of one price.

Break and Shift logic

Close requires the bar to finish beyond the reference. Body requires both open and close to clear it. Break follows the current direction. Shift (Initial) assigns the first direction; later Shifts clear the opposite reference and change direction.

Zone lifecycle

Zone Break Basis can follow the structure confirmation rule or use inclusive wick contact at the far edge. Broken zones leave the active set immediately, even when their frozen drawing is retained temporarily.

Drawing and dashboard pass

Optional live lines, shift triggers, frozen event segments, labels, age colors, and dashboard rows display the stored state. Hiding them does not disable the underlying confirmed-bar calculations.

Output and state reference9 documented states

Swipe or scroll horizontally to see every column.

Market Structure + Swing Levels outputs and states
Output or stateWhen it appearsMeaning
SWING CONFIRMEDSelected strength satisfiedA pivot high or low is added at its historical origin.
HH / EH / LHConfirmed highThe high is above, equal to, or below the prior confirmed swing high.
HL / EL / LLConfirmed lowThe low is above, equal to, or below the prior confirmed swing low.
ACTIVE ZONEConfirmed swingA standalone or merged same-side band remains eligible for break checks.
STRUCTURE BREAKContinuation clearancePrice cleared the same-direction swing reference under Close or Body confirmation.
STRUCTURE SHIFTOpposite-reference clearanceThe tracked direction changed after a confirmed clearance.
SHIFT (INITIAL)First qualifying clearanceAssigns the first tracked direction on the chart; it is not a reversal.
BROKEN ZONEFar edge cleared or touchedThe zone is no longer active; its optional frozen drawing expires after the selected memory.
DASHBOARDLatest chart updateReports direction, latest event, zone counts, and optional nearest-zone distances.

Settings

The 56 rows below match the current public Pine input surface. Conditional controls are dimmed in TradingView until their parent setting makes them applicable.

⚙️ General1 input

Swipe or scroll horizontally to see every column.

⚙️ General settings and defaults
SettingControlDefaultChoices, limits & availability
Preset ProfilepresetChoice / textSwingCustom · Scalper · Intraday · Swing
📐 Swing Detection2 inputs

Swipe or scroll horizontally to see every column.

📐 Swing Detection settings and defaults
SettingControlDefaultChoices, limits & availability
Swing Strengthswing_strengthWhole number5Min 1 · Max 500 | Conditional
Show Swing Classification Labelsshow_swing_labelsToggleOn—
🏛️ Structure Detection2 inputs

Swipe or scroll horizontally to see every column.

🏛️ Structure Detection settings and defaults
SettingControlDefaultChoices, limits & availability
Enable Structurestructure_enableToggleOn—
Structure Confirmstructure_confirmChoice / textCloseClose · Body
🏷️ Structure Labels3 inputs

Swipe or scroll horizontally to see every column.

🏷️ Structure Labels settings and defaults
SettingControlDefaultChoices, limits & availability
Show Break Labelsshow_break_labelsToggleOffConditional
Show Shift Labelsshow_shift_labelsToggleOffConditional
Event Label Sizeevent_label_sizeChoice / textNormalTiny · Small · Normal | Conditional
📏 Structure Lines7 inputs

Swipe or scroll horizontally to see every column.

📏 Structure Lines settings and defaults
SettingControlDefaultChoices, limits & availability
Show Structure Linesshow_structure_linesToggleOffConditional
Live Line Colorlive_line_colorColorGray · 35% transparentConditional
Live Line Widthlive_line_widthWhole number1Min 1 | Conditional
Live Line Stylelive_line_styleChoice / textSolidSolid · Dashed · Dotted | Conditional
Show Shift Trigger Lineshow_shift_triggerToggleOffConditional
Shift Trigger Colorshift_trigger_colorColorOrangeConditional
Shift Trigger Styleshift_trigger_styleChoice / textDashedSolid · Dashed · Dotted | Conditional
🧊 Event-Line History11 inputs

Swipe or scroll horizontally to see every column.

🧊 Event-Line History settings and defaults
SettingControlDefaultChoices, limits & availability
Break Line Colorbreak_line_colorColorYellowConditional
Shift Line Colorshift_line_colorColorPurpleConditional
Color Frozen Lines by Directionfrozen_dir_colorToggleOffConditional
Break Up Colorbreak_up_colorColorBlueConditional
Break Down Colorbreak_dn_colorColorBlueConditional
Shift Up Colorshift_up_colorColorPurpleConditional
Shift Down Colorshift_dn_colorColorPurpleConditional
Frozen Line Widthfrozen_line_widthWhole number1Min 1 | Conditional
Frozen Line Stylefrozen_line_styleChoice / textDottedSolid · Dashed · Dotted | Conditional
Frozen Line Extendfrozen_line_extendChoice / textNoneNone · Left · Right · Both | Conditional
Previous Frozen Lines Keptfrozen_lines_keptWhole number0Min 0 · Max 50 | Conditional
🧱 Zone Calculation7 inputs

Swipe or scroll horizontally to see every column.

🧱 Zone Calculation settings and defaults
SettingControlDefaultChoices, limits & availability
Show Zonesshow_zonesToggleOn—
Zone Width Modezone_width_modeChoice / textATRATR · Ticks · Points · Currency ($) | Conditional
Zone Widthzone_width_valDecimal0.5Min 0.01 | Conditional
ATR Lengthatr_lengthWhole number14Min 1 | Conditional
Zone Break Basiszone_break_basisChoice / textSame as StructureSame as Structure · Touch (High/Low) | Conditional
Show Broken Zonesshow_broken_zonesToggleOnConditional
Broken Zone Memory (bars)broken_zone_keep_barsWhole number20Min 1 · Max 500 | Conditional
🎨 Zone Appearance7 inputs

Swipe or scroll horizontally to see every column.

🎨 Zone Appearance settings and defaults
SettingControlDefaultChoices, limits & availability
Show Cluster Labelsshow_cluster_labelsToggleOnConditional
Swing High/Low Label Positioncluster_label_positionChoice / textSwing OriginRight Edge · Swing Origin | Conditional
Swing High Zone Colorzone_hi_colorColorRed · 85% transparentConditional
Swing Low Zone Colorzone_lo_colorColorGreen · 85% transparentConditional
Swing High Text Colorzone_hi_text_colorColorWhiteConditional
Swing Low Text Colorzone_lo_text_colorColorWhiteConditional
Broken Zone Colorbroken_zone_colorColorGray · 80% transparentConditional
🕰️ Zone Age10 inputs

Swipe or scroll horizontally to see every column.

🕰️ Zone Age settings and defaults
SettingControlDefaultChoices, limits & availability
Show Zone Ageshow_zone_ageToggleOffConditional
Age Unitage_unitChoice / textDaysBars · Hours · Days | Conditional
Age Label Sizeage_label_sizeChoice / textNormalTiny · Small · Normal | Conditional
Color Zones by Ageage_color_modeChoice / textOffOff · Auto (Gradient) · Preset · Dark · Contrast · Warm · Mono · Cool · Pastel · Subdued | Conditional
Extra Color Opacityage_opacityWhole number0Min -40 · Max 40 | Conditional
Gradient Range (bars)age_gradient_barsWhole number200Min 1 | Conditional
Gradient End Colorage_gradient_endColorGray · 70% transparentConditional
Fresh→Mid (bars)age_band1_barsWhole number20Min 1 | Conditional
Mid→Old (bars)age_band2_barsWhole number100Min 1 | Conditional
Age Label Colorage_label_colorColorWhiteConditional
📊 Dashboard4 inputs

Swipe or scroll horizontally to see every column.

📊 Dashboard settings and defaults
SettingControlDefaultChoices, limits & availability
Show Dashboardshow_dashboardToggleOn—
Dashboard Positiondash_positionChoice / textTop RightTop Right · Bottom Right · Bottom Left · Top Left | Conditional
Text Sizedash_text_sizeChoice / textSmallTiny · Small · Normal | Conditional
Show Nearest Zone Distanceshow_nearest_zoneToggleOnConditional
🔔 Alerts2 inputs

Swipe or scroll horizontally to see every column.

🔔 Alerts settings and defaults
SettingControlDefaultChoices, limits & availability
Dynamic Alert Textdyn_alertsToggleOn—
Include Zone Breaks in Dynamic Alertzone_break_alertsToggleOnConditional

Alerts and limitations

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

4 fixed alert conditions

MSSL 1 · Structure Break Up

Confirmed continuation above the tracked swing high.

MSSL 2 · Structure Break Down

Confirmed continuation below the tracked swing low.

MSSL 3 · Structure Shift Up

Confirmed clearance of the high held while direction was down.

MSSL 4 · Structure Shift Down

Confirmed clearance of the low held while direction was up.

Limits to keep visible

  • A swing is deliberately delayed by the selected right-side strength; the newest apparent turn is not yet confirmed.
  • Zone width is user-selected geometry. ATR, ticks, points, or currency distance does not establish that a zone will hold or matter later.
  • Currency mode depends on the symbol’s point-value data. When it is unavailable, the indicator cannot create that zone.
  • Hours and Days age labels are approximations derived from chart bars and do not correct for session gaps.
  • The indicator caps active zones at 40 per side, retained broken zones at 20, swing labels at 50, and event labels at 60; older objects leave in FIFO order.
  • Alerts describe indicator events only. They do not size a position, define risk, or confirm delivery in the user’s TradingView setup.

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 did a swing label show up after the turn?

The script waits for the swing to be confirmed before drawing it. A strength-7 swing appears seven bars after the turning bar. Check the active preset or Custom Swing Strength if you want to understand the delay; lowering it finds turns sooner but also accepts smaller swings.

Why did price wick through a structure level without a Break?

A wick alone does not meet the current confirmation rule. With Close selected, wait for a candle to close beyond the level. With Body selected, both the open and close must be beyond it. Check Structure Confirm and make sure the candle has closed.

Why did ×N rise even though price did not retest that price?

×N is not a retest counter. It tells you how many confirmed swing zones overlap inside the merged band. A new nearby swing can raise the count without price returning to the exact same level.

Why do Break and Shift states keep updating after I hide the drawings?

Hiding lines or labels only cleans up the chart; it does not stop the structure calculation. Check Enable Structure if you want to control whether Break and Shift states are calculated at all.

Why is the zone missing when I choose Currency width?

TradingView may not provide a usable point value for that symbol, so the script cannot convert the selected cash amount into chart distance. Try ATR, Ticks, or Points. If those work, the missing point-value data—not the swing—is the issue.

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.