OPEN-SOURCE SCRIPT

Market Structure Scanner

878
Market Structure Scanner

Market Structure Scanner is a pivot-based chart study designed to visualize market structure using upper and lower structure rails.

The script focuses on how price is forming structure over time. It does not attempt to predict future price movement or provide buy and sell recommendations. Its purpose is to help users study channels, ranges, compression phases, directional pressure, and expansion behavior directly on the chart.

────────────────────
Core Concept
────────────────────

The script uses confirmed swing pivots to build a simplified view of market structure.

Instead of labeling every candle movement, it looks for a sequence of alternating pivot highs and pivot lows. From these pivots, the script builds two reference rails:

• Upper rail from pivot highs
• Lower rail from pivot lows

The relationship between these two rails is then evaluated.

The script checks whether the rails are:

• Rising together
• Falling together
• Moving in a relatively parallel structure
• Compressing toward each other
• Expanding away from each other
• Forming a balance or range area

This allows the chart to be viewed as a structural environment rather than a collection of isolated candles.

────────────────────
What This Script Detects
────────────────────

The scanner can identify several structure conditions, including:

• Trend Channel · Up
• Trend Channel · Down
• Balance Range
• Ascending Pressure
• Descending Pressure
• Symmetric Compression
• Volatility Expansion

These labels are structural descriptions only. They are not trade signals.

────────────────────
How It Works
────────────────────

1. The script detects confirmed pivot highs and pivot lows.
2. It stores recent pivots and keeps only alternating swing points.
3. It uses the latest five pivot points to build upper and lower structure rails.
4. It measures rail slope, flatness, distance change, compression, expansion, and fit error.
5. It applies ATR-based height filtering to avoid weak or insignificant structures.
6. It applies a quality score to reduce noisy or low-quality structures.
7. It avoids drawing duplicate structures that are too close in time and price.
8. When a structure passes the filters, it draws rails, zones, nodes, labels, and a status panel.

────────────────────
Visual Elements
────────────────────

The script can display:

• Upper structure rail
• Lower structure rail
• Structure zone
• Structure nodes
• Optional internal pivot links
• Optional pivot numbers
• Structure label
• Latest structure status panel

The status panel shows the latest detected structure type, structure mode, quality grade, upper rail, lower rail, and structure width.

────────────────────
Inputs And Customization
────────────────────

Main settings include:

Pivot left strength:
Controls how many bars are required on the left side of a pivot.

Pivot right confirmation bars:
Controls how many bars are required after a pivot before it is confirmed.

Minimum pivot deviation:
Filters small pivot changes that may create noisy structures.

Minimum structure quality:
Controls how selective the scanner is.

Minimum structure width:
Requires a structure to cover a minimum number of bars.

Minimum structure height × ATR:
Filters structures that are too small relative to recent volatility.

Maximum rail fit error:
Controls how closely pivots must fit their corresponding structure rails.

Compression and expansion ratios:
Control how strongly the upper and lower rails must contract or expand.

────────────────────
Confirmation And Repainting Notes
────────────────────

This script uses pivot confirmation.

A pivot can only be confirmed after the required number of right-side confirmation bars has completed. Because of this, detected structures may appear after the actual pivot point.

Lower right-confirmation settings can make the scanner respond faster, but they may also increase sensitivity.

Higher right-confirmation settings can make the scanner more stable, but structures may appear later.

The script is intended as a confirmed structure scanner, not a real-time prediction engine.

────────────────────
How To Use
────────────────────

Use this script as a market structure study.

General interpretation examples:

• Trend Channel · Up may show a rising structure with relatively parallel rails.
• Trend Channel · Down may show a falling structure with relatively parallel rails.
• Balance Range may show a flatter market structure.
• Ascending Pressure may show rising lower pressure against a flatter upper rail.
• Descending Pressure may show falling upper pressure against a flatter lower rail.
• Symmetric Compression may show price contracting between two rails.
• Volatility Expansion may show rails moving away from each other.

The script is most useful when combined with independent chart analysis, risk management, and a defined trading plan.

────────────────────
Limitations
────────────────────

This script does not predict future price movement.

It does not provide buy or sell recommendations.

It does not guarantee that a detected structure will continue, break out, or reverse.

Because the script uses confirmed pivots, structures may appear after confirmation.

In low-volatility or noisy sideways markets, structure detection may be less reliable.

────────────────────
Disclaimer
────────────────────

This publication is for educational and informational chart analysis only.

It does not constitute financial advice, investment advice, or a recommendation to buy or sell any financial instrument.

All trading and investment decisions are the responsibility of the user.

━━━━━━━━━━━━━━━━━━━━

Market Structure Scanner

Market Structure Scanner는 확정 피봇을 기반으로 상단/하단 구조 레일을 만들어 시장 구조를 시각화하는 차트 분석 보조지표입니다.

이 스크립트는 가격이 시간에 따라 어떤 구조를 형성하는지 관찰하는 데 초점을 둡니다. 미래 가격 움직임을 예측하거나 매수·매도 추천을 제공하지 않습니다. 목적은 채널, 레인지, 압축, 방향성 압력, 확장 구조를 차트 위에서 쉽게 확인하는 것입니다.

────────────────────
핵심 개념
────────────────────

이 스크립트는 확정된 스윙 피봇을 사용해 시장 구조를 단순화해서 보여줍니다.

각 캔들의 움직임을 모두 해석하기보다, 피봇 고점과 피봇 저점이 번갈아 형성되는 구조를 확인합니다. 이후 피봇을 바탕으로 두 개의 기준 레일을 만듭니다.

• 피봇 고점 기반 상단 레일
• 피봇 저점 기반 하단 레일

그다음 두 레일의 관계를 평가합니다.

스크립트는 레일이 다음 중 어떤 상태인지 확인합니다.

• 함께 상승하는지
• 함께 하락하는지
• 비교적 평행하게 움직이는지
• 서로 압축되고 있는지
• 서로 확장되고 있는지
• 균형 또는 레인지 구간을 형성하는지

이를 통해 차트를 단일 캔들의 모음이 아니라 구조적 환경으로 볼 수 있도록 돕습니다.

────────────────────
감지 구조
────────────────────

이 스캐너는 다음 구조 상태를 감지할 수 있습니다.

• Trend Channel · Up
• Trend Channel · Down
• Balance Range
• Ascending Pressure
• Descending Pressure
• Symmetric Compression
• Volatility Expansion

이 문구들은 구조 설명일 뿐이며, 매매 신호가 아닙니다.

────────────────────
작동 방식
────────────────────

1. 확정된 피봇 고점과 피봇 저점을 감지합니다.
2. 최근 피봇을 저장하고, 번갈아 형성되는 스윙 포인트만 유지합니다.
3. 최근 5개의 피봇을 사용해 상단/하단 구조 레일을 만듭니다.
4. 레일 기울기, 평탄도, 거리 변화, 압축, 확장, 레일 적합도를 측정합니다.
5. ATR 기반 높이 필터를 적용해 너무 약한 구조를 제외합니다.
6. 품질 점수 필터를 적용해 노이즈성 구조를 줄입니다.
7. 시간과 가격이 너무 가까운 중복 구조 표시를 줄입니다.
8. 필터를 통과한 구조에 대해 레일, 영역, 노드, 라벨, 상태 패널을 표시합니다.

────────────────────
표시 요소
────────────────────

이 스크립트는 다음 요소를 표시할 수 있습니다.

• 상단 구조 레일
• 하단 구조 레일
• 구조 영역
• 구조 노드
• 선택 가능한 내부 피봇 연결선
• 선택 가능한 피봇 번호
• 구조 라벨
• 최신 구조 상태 패널

상태 패널은 최신 감지 구조의 유형, 모드, 품질 등급, 상단 레일, 하단 레일, 구조 폭을 보여줍니다.

────────────────────
입력값 및 설정
────────────────────

주요 설정은 다음과 같습니다.

Pivot left strength:
피봇 왼쪽에서 필요한 확인 봉 수를 조정합니다.

Pivot right confirmation bars:
피봇이 확정되기 위해 오른쪽에서 필요한 확인 봉 수를 조정합니다.

Minimum pivot deviation:
너무 작은 피봇 변화를 필터링하여 노이즈성 구조를 줄입니다.

Minimum structure quality:
스캐너가 구조를 얼마나 엄격하게 선별할지 조정합니다.

Minimum structure width:
구조가 최소 몇 개의 봉을 포함해야 하는지 설정합니다.

Minimum structure height × ATR:
최근 변동성 대비 너무 작은 구조를 제외합니다.

Maximum rail fit error:
피봇이 구조 레일에 얼마나 잘 맞아야 하는지 설정합니다.

Compression and expansion ratios:
상단/하단 레일이 얼마나 강하게 압축 또는 확장되어야 하는지 조정합니다.

────────────────────
확인봉 및 리페인트 안내
────────────────────

이 스크립트는 피봇 확인 방식을 사용합니다.

피봇은 오른쪽 확인 봉이 완성된 후에만 확정됩니다. 따라서 감지된 구조는 실제 피봇 지점보다 늦게 표시될 수 있습니다.

오른쪽 확인 봉 설정을 낮추면 더 빠르게 반응하지만 민감도가 높아질 수 있습니다.

오른쪽 확인 봉 설정을 높이면 더 안정적일 수 있지만 구조 표시가 늦어질 수 있습니다.

이 스크립트는 실시간 예측 엔진이 아니라 확정 구조 스캐너입니다.

────────────────────
사용 방법
────────────────────

이 스크립트는 시장 구조 분석 보조도구로 사용할 수 있습니다.

일반적인 해석 예시는 다음과 같습니다.

• Trend Channel · Up은 비교적 평행한 상승 구조를 보여줄 수 있습니다.
• Trend Channel · Down은 비교적 평행한 하락 구조를 보여줄 수 있습니다.
• Balance Range는 평탄한 시장 구조를 보여줄 수 있습니다.
• Ascending Pressure는 평평한 상단 레일에 대해 하단 압력이 높아지는 구조를 보여줄 수 있습니다.
• Descending Pressure는 평평한 하단 레일에 대해 상단 압력이 낮아지는 구조를 보여줄 수 있습니다.
• Symmetric Compression은 두 레일 사이에서 가격이 압축되는 구조를 보여줄 수 있습니다.
• Volatility Expansion은 두 레일이 서로 멀어지는 구조를 보여줄 수 있습니다.

이 스크립트는 독립적인 차트 분석, 리스크 관리, 본인의 매매 계획과 함께 참고해야 합니다.

────────────────────
한계
────────────────────

이 스크립트는 미래 가격 움직임을 예측하지 않습니다.

매수 또는 매도 추천을 제공하지 않습니다.

감지된 구조가 반드시 지속, 돌파, 반전된다는 것을 보장하지 않습니다.

확정 피봇을 사용하기 때문에 구조는 확인 이후 표시될 수 있습니다.

저변동성 또는 노이즈가 많은 횡보장에서는 구조 감지의 유용성이 낮아질 수 있습니다.

────────────────────
중요 고지
────────────────────

본 게시물은 교육 및 정보 제공 목적의 차트 분석 자료입니다.

투자 자문, 매수·매도 추천, 특정 금융상품 거래 권유를 의미하지 않습니다.

모든 투자 판단과 그 결과에 대한 책임은 이용자 본인에게 있습니다.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.