OPEN-SOURCE SCRIPT
تم تحديثه Market Structure Break BOS Classifier

Market Structure Break — BOS Classifier
A clean, no-noise market structure indicator that goes beyond simply marking a BOS. Every break is classified by context so you immediately know whether to act on it or skip it.
🔵 What Makes This Different
Most BOS indicators fire the same label regardless of market context. This one answers the question that actually matters — was that break meaningful, or was it just noise inside a range?
Every Break of Structure is classified into one of three types:
📊 Signal Types
✔ Valid BOS (Green/Red — solid line)
Price closes above the previous swing high (bullish) or below the previous swing low (bearish) while outside a consolidation zone. This is a clean, high-confidence structural break. Fires on the exact candle of the break — no lag.
⚠ Range BOS (Yellow — dashed line)
Same close-cross condition, but price was inside a consolidation zone when it happened. These breaks are more likely to be fakeouts. Treat with caution — wait for a retest or additional confirmation before entry.
〰 iBOS — Internal BOS (Lime/Red — dashed line)
The short-term zigzag trend flips direction but the higher-level market structure has not changed. This is a minor internal move within the prevailing trend. Useful for spotting early reversals, but not a tradeable structure break on its own.
🟠 Consolidation / Range Detection
The indicator automatically detects when price is forming a lower high AND higher low relative to the prior swing — the classic compression signature. When active:
Background is highlighted in orange
A dashed boundary box shows the exact range with top and bottom levels
Any BOS fired during this phase is automatically tagged as a Range BOS
⚙️ How It Works Internally
Zigzag engine builds swing highs (h0, h1) and swing lows (l0, l1)
Valid/Range BOS → fires when close crosses h1 or l1 on the break candle (leading — no confirmation lag)
iBOS → fires when trend variable flips but market variable does not
Consolidation → h0 < h1 AND l0 > l1 simultaneously
🛠 Settings
SettingDescriptionZigZag LengthControls swing sensitivity. Higher = fewer, larger swingsFib FactorMinimum move required to confirm a structural break (0–1)Show Consolidation ZoneToggle the range box and background highlightShow Valid BOSToggle clean outside-range BOS signalsShow Range BOSToggle inside-range BOS signalsShow iBOSToggle internal minor structure flipsText SizeTiny / Small / Normal / Large / Huge
🔔 Alerts Available
✔ Valid BOS Bullish — clean break above swing high outside range
✔ Valid BOS Bearish — clean break below swing low outside range
⚠ Range BOS Bullish — break above swing high from inside consolidation
⚠ Range BOS Bearish — break below swing low from inside consolidation
iBOS Bullish — internal flip inside bearish structure
iBOS Bearish — internal flip inside bullish structure
Consolidation Start — market entered a range zone
📌 Recommended Usage
Use on your HTF bias timeframe (1H, 4H) to identify the market state
A Valid BOS in the direction of your bias = structure is with you
A Range BOS = wait for the retest of the broken level before committing
An iBOS inside a trending market = potential early entry signal in the direction of the trend, not against it
When the Consolidation zone is active, reduce position size or wait for a clean Valid BOS breakout before trading
⚠️ Disclaimer
This indicator is for educational and analytical purposes only. It does not constitute financial advice. Past performance of any signal is not indicative of future results. Always use proper risk management.
Based on original MSB-OB structure by © EmreKb. Extended with consolidation detection, BOS classification, and leading signal logic.
A clean, no-noise market structure indicator that goes beyond simply marking a BOS. Every break is classified by context so you immediately know whether to act on it or skip it.
🔵 What Makes This Different
Most BOS indicators fire the same label regardless of market context. This one answers the question that actually matters — was that break meaningful, or was it just noise inside a range?
Every Break of Structure is classified into one of three types:
📊 Signal Types
✔ Valid BOS (Green/Red — solid line)
Price closes above the previous swing high (bullish) or below the previous swing low (bearish) while outside a consolidation zone. This is a clean, high-confidence structural break. Fires on the exact candle of the break — no lag.
⚠ Range BOS (Yellow — dashed line)
Same close-cross condition, but price was inside a consolidation zone when it happened. These breaks are more likely to be fakeouts. Treat with caution — wait for a retest or additional confirmation before entry.
〰 iBOS — Internal BOS (Lime/Red — dashed line)
The short-term zigzag trend flips direction but the higher-level market structure has not changed. This is a minor internal move within the prevailing trend. Useful for spotting early reversals, but not a tradeable structure break on its own.
🟠 Consolidation / Range Detection
The indicator automatically detects when price is forming a lower high AND higher low relative to the prior swing — the classic compression signature. When active:
Background is highlighted in orange
A dashed boundary box shows the exact range with top and bottom levels
Any BOS fired during this phase is automatically tagged as a Range BOS
⚙️ How It Works Internally
Zigzag engine builds swing highs (h0, h1) and swing lows (l0, l1)
Valid/Range BOS → fires when close crosses h1 or l1 on the break candle (leading — no confirmation lag)
iBOS → fires when trend variable flips but market variable does not
Consolidation → h0 < h1 AND l0 > l1 simultaneously
🛠 Settings
SettingDescriptionZigZag LengthControls swing sensitivity. Higher = fewer, larger swingsFib FactorMinimum move required to confirm a structural break (0–1)Show Consolidation ZoneToggle the range box and background highlightShow Valid BOSToggle clean outside-range BOS signalsShow Range BOSToggle inside-range BOS signalsShow iBOSToggle internal minor structure flipsText SizeTiny / Small / Normal / Large / Huge
🔔 Alerts Available
✔ Valid BOS Bullish — clean break above swing high outside range
✔ Valid BOS Bearish — clean break below swing low outside range
⚠ Range BOS Bullish — break above swing high from inside consolidation
⚠ Range BOS Bearish — break below swing low from inside consolidation
iBOS Bullish — internal flip inside bearish structure
iBOS Bearish — internal flip inside bullish structure
Consolidation Start — market entered a range zone
📌 Recommended Usage
Use on your HTF bias timeframe (1H, 4H) to identify the market state
A Valid BOS in the direction of your bias = structure is with you
A Range BOS = wait for the retest of the broken level before committing
An iBOS inside a trending market = potential early entry signal in the direction of the trend, not against it
When the Consolidation zone is active, reduce position size or wait for a clean Valid BOS breakout before trading
⚠️ Disclaimer
This indicator is for educational and analytical purposes only. It does not constitute financial advice. Past performance of any signal is not indicative of future results. Always use proper risk management.
Based on original MSB-OB structure by © EmreKb. Extended with consolidation detection, BOS classification, and leading signal logic.
ملاحظات الأخبار
# SB BOS + ZigZagSB BOS + ZigZag is a market structure indicator designed to identify significant Breaks of Structure (BOS) while filtering out much of the lower-timeframe noise that often creates false signals.
The indicator combines a ZigZag-based swing detection engine with protected swing logic to confirm genuine structural shifts in price action.
## How BOS Is Calculated
Bullish BOS:
- A new Lower Low (LL) forms.
- The most recent Lower High (LH) becomes the protected structure level.
- A Bullish BOS is confirmed when price closes above that protected LH.
Bearish BOS:
- A new Higher High (HH) forms.
- The most recent Higher Low (HL) becomes the protected structure level.
- A Bearish BOS is confirmed when price closes below that protected HL.
Only candle-close breaks are considered valid structure breaks.
## Features
- ZigZag swing visualization
- Bullish and Bearish BOS detection
- Close-based structure confirmation
- Customizable depth, deviation, and backstep settings
- Pair-specific presets for major Forex pairs
- Visual BOS levels and labels
- Alert conditions for bullish and bearish structure breaks
- Optional active settings panel
## Included Pair Presets
EUR/USD
- Depth: 106
- Deviation: 1.0
- Backstep: 2
GBP/USD
- Depth: 106
- Deviation: 1.5
- Backstep: 2
USD/JPY
- Depth: 120
- Deviation: 1.5
- Backstep: 2
EUR/JPY
- Depth: 120
- Deviation: 1.5
- Backstep: 2
## Intended Use
This indicator is designed primarily as a market structure confirmation tool rather than a standalone entry system. It is most effective when combined with liquidity analysis, higher-timeframe bias, premium/discount concepts, and additional trade confirmation methods.
The focus is on identifying meaningful structural shifts while reducing noise and over-signaling.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.