OPEN-SOURCE SCRIPT
Mis à jour

Setup Symmetry Levels

1 215
Setup Symmetry Levels

Setup Symmetry Levels is a market structure indicator designed to identify potential reaction levels based on completed bullish and bearish price setups.

The script tracks consecutive price behavior and plots horizontal levels whenever a user-defined setup threshold is reached. These levels can help traders visualize areas where the market has previously shown notable reactions and may provide useful context for future price analysis.

Features:

• User-configurable bullish and bearish setup thresholds

• Automatic support and resistance level plotting

• Forward projection of detected levels

• Optional setup completion markers displayed on the chart

• Symmetry-based projection levels derived from previous reaction points

• Adjustable colors, line styles, line widths, and label visibility

• Compatible with all symbols and timeframes

The symmetry calculation uses historical reaction levels to generate additional projected levels around the most recent completed setup. These projections are intended to provide a structured visual framework for studying price behavior and market structure.

This indicator is provided for analytical and educational purposes only. It does not provide financial advice, trading recommendations, guaranteed outcomes, or predictions of future market performance. Users should combine this tool with their own analysis, risk management practices, and market research.

The indicator can be applied to cryptocurrencies, stocks, forex, indices, commodities, and other liquid markets.
Notes de version
### How It Works — Technical Details

**Setup Counting Method**

The indicator counts consecutive bars using a comparison against the
close price four bars prior:

— A bullish bar is defined as: close > close[4]
— A bearish bar is defined as: close < close[4]
— If neither condition is met, both counters reset to zero

Counting restarts from one whenever the opposite condition fires or
a neutral bar interrupts the sequence. The count begins tracking the
starting price on the first bar of each new sequence (buyStartPrice
or sellStartPrice), which is used to calculate the percentage move
from setup start to completion.

A level is drawn when the count reaches the user-defined trigger
value (default 9, adjustable to 15). At that bar, the closing price
is recorded as the support or resistance level. The label displays
the trigger number, the exact price, and the percentage gain or loss
from the first bar of the sequence to its completion bar.

**Symmetry Level Calculation**

When a new setup level is recorded, the f_drawMirrors() function is
called immediately. All existing mirror lines and labels are deleted
and redrawn from scratch on every new trigger to keep projections
current.

The symmetry formula uses the most recently completed level as a
center point and mirrors all previous stored levels through it:

mirrorLevel = 2.0 × center − oldLevel

This is a standard point reflection formula. If the last setup level
was at 100 and a previous level was at 90, the mirror projects to 110
— equidistant on the opposite side of the center. If a previous level
was at 105, the mirror projects to 95. This creates a structured
grid of projected levels that are geometrically symmetrical around
the most recent reaction point.

The number of mirror levels drawn equals the number of stored
historical levels minus one, capped at maxLines − 1 to prevent
chart clutter.

**Level Memory Management**

Both main levels and mirror levels are stored in Pine Script arrays.
The oldest main level is automatically deleted when the array exceeds
the Maximum S/R Levels setting, using array.shift() to remove the
first (oldest) entry and line.delete() / label.delete() to remove
the corresponding visual objects. This prevents the indicator from
accumulating unlimited lines across a long chart history.

### How It Works — The Counting Logic

The close[4] comparison rule is a bar-counting technique based on
measuring directional persistence: each bar that continues in the
same direction relative to the close four bars earlier increments
the counter. This four-bar offset is deliberately chosen because
it skips the most recent bars and compares against a slightly
older reference point, making the count less sensitive to
short-term noise while still responding to sustained directional
movement. When a user-defined number of consecutive qualifying
bars is reached, the current close is marked as a potentially
significant price level.

### How To Use

1. Setup Trigger (9–15):
— 9 is the default completion count
— Higher values (12–15) require longer uninterrupted sequences
and produce fewer, potentially stronger levels
— Bullish and bearish triggers can be set independently
2. When a number label appears above a bar (bearish) or below a bar
(bullish), a setup has completed and a new S/R level has been drawn
3. Solid lines (green = support, red = resistance) mark the actual
setup completion prices
4. Dashed orange lines (M1, M2...) are symmetry projections —
potential areas where price may react based on the geometric
distance from the most recent setup level
5. The label percentage shows how far price moved from the first
bar of the setup to its completion — useful for gauging setup
momentum strength
6. Maximum S/R Levels controls how many historical levels remain
visible — set lower for a cleaner chart, higher to preserve
more historical context
7. Works on all timeframes — higher timeframes produce fewer but
structurally more significant setup levels

### Originality

This script is an original work combining a close[4] bar-counting
method with a geometric symmetry projection system. The close[4]
comparison technique is a well-documented directional persistence
counting approach used in various forms across technical analysis;
however, the symmetry projection layer is the author's own original
addition. Rather than simply marking where setups complete, the
indicator uses each new completion level as a reflection axis and
mirrors all previously stored levels through it using the formula
mirrorLevel = 2 × center − oldLevel. This creates a dynamically
updating grid of projected levels that adapts every time a new
setup completes, providing a structured price framework that
extends beyond the raw setup signals. This specific combination
and implementation is not derived from any existing published script.


Clause de non-responsabilité

Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.