OPEN-SOURCE SCRIPT
Atualizado

Support & Resistance External/Internal & BoS [sgbpulse]

22 208
Market Structure Support & Resistance External/Internal & BoS [sgbpulse]


Overview: Smart & Fast Market Structure Analysis

The Market Structure "Support & Resistance External/Internal & BoS [sgbpulse]" indicator is designed to empower your technical analysis by automatically and precisely identifying significant support and resistance levels. It achieves this by pinpointing high and low Pivot Points, plus key Pre-Market High/Low levels.

Its unique strength lies in its dynamic adaptability to any timeframe and any asset you choose. This tool analyzes the relevant market structure for the current timeframe and asset, providing you with accurate and relevant levels in real-time. The indicator maintains a clean chart and swiftly displays all support, resistance, and Pre-Market levels for any asset, saving valuable analysis time and enabling you to get a clear and quick snapshot of the market.


How the Indicator Works

The indicator identifies and displays three critical types of key levels:
  1. External Pivots: These are more significant pivot points, indicating important reversal points across a broader range of price movement, considering the current timeframe. The indicator draws dark green support lines (for low pivots) and dark red resistance lines (for high pivots) from these points.
  2. Internal Pivots: These are shorter-term pivot points, signifying smaller corrections or reversals within the overall structure of the current timeframe. These lines provide additional areas of interest within the ranges of the External Pivots.
  3. Pre-Market High/Low Levels: The indicator displays the High and Low reached during pre-market hours as distinct lines on the chart. Please note: These levels will only appear when the selected timeframe is lower than one day (e.g., 1-hour, 15-minute) and provided that the "Session extended trading hours" option is enabled in your TradingView chart settings. These levels are crucial for identifying potential opening ranges and critical support/resistance areas upon regular market open, especially for intraday trading.



Break of Structure (BoS) Identification

A key feature of this indicator is its ability to identify Break of Structure (BoS). When a support or resistance line is breached, the indicator changes the line's color to gray and displays a "Break of Structure" label, indicating a potential trend change or continuation:
  • External BoS: When an external support/resistance line is broken, a "BoS" label in red will appear. This is a strong signal for a potential shift in the primary market structure or a strong trend continuation.
  • Internal BoS: When an internal support/resistance line is broken, an "iBoS" label in green will appear. This indicates a break within the existing market structure, which can be used to confirm direction or identify shorter-term entry/exit opportunities.


Full Indicator Customization

The indicator provides maximum flexibility to suit any trading style and timeframe:
  • Number of Lines Displayed: You can choose how many support and resistance lines you want to see on your chart. The default is 15 lines, but you can increase or decrease this number according to your needs and desired level of detail.
  • External Pivot Settings: Define the number of bars before and after a pivot point required for External Pivot identification.
  • Internal Pivot Settings: Define the number of bars before and after a pivot point required for Internal Pivot identification.
  • Color Customization: Full control over colors! You can change the colors of the support and resistance lines, the colors of the Pre-Market levels, and also the colors of the BoS and iBoS labels to create a visual appearance that perfectly matches your personal preferences.


This flexibility allows you to adapt the indicator to your trading style and any timeframe you operate in, without needing to manually change settings each time.


Recommended Uses

  • Clean Chart & Quick Analysis: The indicator displays important levels clearly, enabling quick identification of areas of interest without visual clutter on the chart. This significantly saves analysis time and allows you to make faster decisions.
  • Critical Levels for Any Timeframe & Asset: Get precise and adaptive support and resistance, plus essential Pre-Market levels (in relevant timeframes), for any timeframe and on any asset you choose.
  • Trend Direction Identification: Clear support and resistance lines help understand market structure.
  • Breakout Confirmation: The BoS label provides visual confirmation of key level breaches, helping to confirm potential trend changes.
  • Locating Entry & Exit Points: Use these levels as potential areas of interest for trades, after confirming a breakout or reversal.
  • Finding Stop-Loss & Take-Profit Points: Strategically place protective stops and profit targets around these support and resistance levels.



Important Note

Like any technical indicator, Market Structure "Support & Resistance External/Internal & BoS [sgbpulse]" is a supplementary tool. It's highly recommended to use it in conjunction with additional analysis methods (such as price action analysis, other indicators, and fundamental analysis) for informed trading decisions. Financial markets are dynamic, and trading always carries inherent risk.
Notas de Lançamento
What's New: Version 2.0

Key Features & Upgrades
  • Early Pivot Detection: A specialized mechanism that identifies potential highs/lows based on the left-side parameters alone, instantly displaying a subtle dashed line at Offset 0 to completely eliminate latency (Lag). Upon official validation, the dashed line is seamlessly replaced in real-time by a standard structural line.
  • Pre-Market Interval Warping Prevention: A complete rewrite of the Pre-Market handling mechanism. Data is fetched atomically at a rigid 1-minute resolution via session.extended. Price levels remain identical to the exact cent across all timeframes (from 1m up to 1h and higher), eliminating bar-aggregation distortion.
  • Previous Day Levels & Pre-Market Adjustment: Introduction of full-width static horizontal levels rendered in semi-transparent, glowing Neon hues (Previous Day High / Low / Close). Includes an exclusive Pre-Market Adjustment feature (powered by daily lookahead_on) that locks the previous day's levels precisely and prevents them from drifting during the morning session.
  • TradingView Platform Integration: The five static key levels are injected directly into the chart status line and data window (display.data_window + display.status_line). Features native support for price-crossing alerts (Alerts) and full accessibility for simultaneous screening within the platform's Screener.
  • Stateless Drawing Engine Optimization: Transition to a Stateless Renderer architecture. Instead of continuously deleting and redrawing visual elements (Delete & Redraw), the engine modifies line coordinates directly in memory. Redundant filtering has been removed, providing a lightweight charting experience with zero CPU overhead.
  • Smart Layer Transparency (Confluence Zones): Structural lines feature built-in opacity balancing. When multiple key levels converge at the exact same price, the lines visually stack into a darker, more prominent level, enabling immediate recognition of high-potency liquidity pools.

Expanded Structural Resolution & Ranges
  • The maximum number of concurrent on-screen lines has been boosted to a limit of 70 lines simultaneously.
  • Pivot strength parameters have been significantly expanded to accommodate deep macro analysis: up to 70 for external structure (External) and up to 10 for internal structure (Internal).

Memory & Performance Infrastructure
  • Advanced resource management built for Pine Script v6, combining User-Defined Types (UDT) and Map data structures. Leveraging direct, focused Methods and calculation functions allows immediate access to the drawings memory buffer, eliminating execution overhead. Every object is mapped and freed down to the individual Byte level—guaranteeing zero memory leaks and absolute stability (Production-Ready) during extended runtime sessions.

Looking Ahead: The Next Milestone (Sneak Peek to v3.0)

While Version 2.0 represents the pinnacle of structural stability and architectural performance, the sgbpulse development pipeline is already looking forward. The next milestone (Version 3.0) will leverage the rock-solid foundation built here and inject the most advanced tools from the Smart Money Concepts (SMC) universe:
  • Dual-Layer CHoCH Engine (Major & Internal): Automated identification of Change of Character and crucial trend reversals, featuring a multi-year historical archive that preserves the complete geometric DNA of origin pivot points (the exact symmetrical blueprint corresponding to BoS and iBoS) without cluttering the chart.
  • Structure-Based Automated Fibonacci Engine: Dynamic plotting of Fibonacci Retracement levels (from 0% to 100%) directly onto the market's validated Trading Ranges formed by historical CHoCH events, allowing precise, real-time tracking of Premium and Discount zones.

Today's infrastructure is tomorrow's edge. Stay tuned.
Notas de Lançamento
What's New in Version 2.1

A Note to the Community: I’ve been closely following your feedback, and after receiving some excellent suggestions, I’m excited to roll out v2.1 ahead of schedule! It’s incredibly rewarding to build this alongside you, especially since these updates align perfectly with our long-term milestones. Thank you for helping shape this framework.
Here is what’s new:
1. Major 52-Week High/Low Levels & Alert Pockets
- Yearly Extremes: The framework now automatically tracks and plots the major 52-Week High and 52-Week Low institutional boundaries based on daily regular trading hours (RTH) data.
- 5% Target Pockets: Introducing smart alert conditions (isNear52wHighPocket / isNear52wLowPocket) that trigger the moment price enters a 5% buffer zone from yearly extremes—the exact "pockets" where major institutional breakouts or macro reversals occur.

2. Fluid Label Engine (Zero Real-Time Lag)
Seamless Synchronization: Labels and horizontal liquidity lines are now locked in a synchronized, real-time matrix. As the market moves, the price labels "march" flawlessly into the right margin without a millisecond of visual stuttering or lag. Perfect for hyper-active trading on lower timeframes like the 1m chart.

3. Centralized Labels & Visibility Controls
Clean Up Your Chart: Under the redesigned "Labels & Visibility" settings group, you now have granular control over what stays on your screen:
- Market Structure (BoS): Toggle the dynamic SMC structural break labels.
- Static Level Names: A brand-new toggle to show or hide the text identifiers (PD High/Low, Pre-Market, 52W) next to your horizontal lines, keeping your right margin perfectly optimized to your liking.

4. Expanded Structure Memory (Default Pivot Increase)
More Data, Better Context: To give you a broader historical view of key structural zones, the default value for Max Pivots has been officially increased from 15 to 20. This allows the script to maintain more recent pivot clusters on your chart out-of-the-box.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.