OPEN-SOURCE SCRIPT
מעודכן Swing Gradient TPOs [BOSWaves]

Swing Gradient TPOs [BOSWaves] - Swing-Anchored Time Price Opportunity Profiles with Gradient Chronology and Single Print Detection
Overview
Swing Gradient TPOs [BOSWaves] is a swing-anchored market profile system that constructs Time Price Opportunity profiles within each detected swing range, where letter assignment, gradient coloring, POC identification, and single print detection are driven by chronological time period progression across the swing rather than fixed session boundaries or arbitrary time windows.

Instead of applying TPO profiles to calendar sessions or user-defined time blocks, this system anchors each profile to the confirmed swing structure of the instrument itself, building a complete letter-by-letter participation map for every swing from high to low and low to high. Each time period within the swing receives a sequential alphabetical letter, and those letters are colored using a configurable gradient that visually encodes the chronological progression of price activity from swing origin to completion.
This creates a profile framework that reflects how participation distributed across price within each structural swing rather than within arbitrary time containers. The gradient coloring reveals whether price visited certain levels early or late in the swing's development, the POC identifies the price level with the greatest time-based participation, the value area captures the range containing the configured percentage of total activity, and single print zones mark levels touched by only a single time period and project them forward as potential reaction areas until price revisits them.
Price structure and participation distribution are therefore evaluated together, with each swing producing a self-contained profile that answers both where price spent time and when within the swing that activity occurred.
Conceptual Framework
Swing Gradient TPOs is founded on the principle that TPO-based market profile analysis becomes structurally meaningful when profiles are anchored to confirmed swing boundaries rather than to session times that carry no relationship to the instrument's actual directional behavior.
Traditional market profile approaches build TPO distributions within daily or weekly sessions, which imposes a time container on the data that is independent of how price is actually behaving structurally. This framework replaces session-based profile construction with swing-event-driven profile building, where each profile begins at a confirmed swing extreme and ends at the next confirmed swing extreme in the opposing direction, ensuring the participation map covers exactly one complete directional structural move.
Three core principles guide the design:
This shifts market profile analysis from session-container-based participation tracking into swing-anchored structural profile construction with gradient-encoded temporal intelligence and forward-projecting single print monitoring.
Theoretical Foundation
The indicator combines swing high and low detection through highest and lowest lookback comparison, alphabetical letter assignment by configurable TPO timeframe period, three-color gradient interpolation for chronological letter coloring, POC identification through maximum TPO count per price bin, value area expansion from POC outward, single print detection and forward projection, and retest signal generation when price sweeps and reclaims a single print zone.
Swing detection tracks whether the most recent extreme high or low is the highest or lowest reading in the lookback window, registering a swing point when price rotates away from a prior extreme. TPO letter assignment maps each bar within the swing to a time period based on the ratio between the chart timeframe and the configured TPO timeframe, with sequential alphabet letters A through Z then a through z assigned chronologically across the swing's duration. Gradient coloring maps each letter's alphabetical index to a position along a three-stop gradient, producing a color sequence that progresses from swing start to swing end. Price bins are calculated from the swing range divided into segments sized relative to recent ATR, with each bin's letter count determining POC and value area membership.
Four internal systems operate in tandem:
This design allows each swing to produce a complete participation profile with temporal depth encoded visually, while structurally significant single print zones remain active as forward reference areas with signal generation capability.
How It Works
Swing Gradient TPOs evaluates price through a sequence of structure-aware and profile-building processes:
Together, these elements form a continuously updating swing profile system where each completed swing produces a gradient-encoded participation map, single print zones project forward as active structural references, and retest signals identify price reclaims of structurally thin areas.
Interpretation
Swing Gradient TPOs should be interpreted as a swing-anchored participation distribution system with temporal depth encoding and forward-projecting structural reference zones:
POC location, value area boundaries, gradient temporal distribution, and single print zone positioning collectively provide more structural and participatory intelligence than any element in isolation.
Signal Logic & Visual Cues
Swing Gradient TPOs presents two retest signal types derived from single print zone interaction:
Both signal types require the zone to have been swept before reclaim or rejection can register, and a configurable cooldown enforces minimum bar separation between consecutive signals to prevent clustering during active zone interaction.
Alert generation covers completed swing high and swing low events as well as bullish and bearish single print reclaim signals for systematic structural and zone-based monitoring workflows.
Strategy Integration
Swing Gradient TPOs fits within market profile-informed and structure-based participation analysis approaches:
Technical Implementation Details
Optimal Application Parameters
Timeframe Guidance:
Suggested Baseline Configuration:
These suggested parameters should be used as a baseline; their effectiveness depends on the instrument's swing frequency, typical swing range, and preferred profile granularity, so fine-tuning is expected for optimal performance.
Parameter Calibration Notes
Use the following adjustments to refine behavior without altering the core logic:
Adjustments should be incremental and evaluated across multiple session types rather than isolated market conditions.
Performance Characteristics
High Effectiveness:
Reduced Effectiveness:
Integration Guidelines
Disclaimer
Swing Gradient TPOs [BOSWaves] is a professional-grade swing-anchored market profile and structural participation analysis tool. It uses TPO letter accumulation with gradient chronology encoding and single print zone projection but does not predict future price movements. Results depend on market conditions, instrument participation characteristics, parameter selection, and disciplined execution. BOSWaves recommends deploying this indicator within a broader analytical framework that incorporates momentum context, order flow analysis, and comprehensive risk management.
Overview
Swing Gradient TPOs [BOSWaves] is a swing-anchored market profile system that constructs Time Price Opportunity profiles within each detected swing range, where letter assignment, gradient coloring, POC identification, and single print detection are driven by chronological time period progression across the swing rather than fixed session boundaries or arbitrary time windows.
Instead of applying TPO profiles to calendar sessions or user-defined time blocks, this system anchors each profile to the confirmed swing structure of the instrument itself, building a complete letter-by-letter participation map for every swing from high to low and low to high. Each time period within the swing receives a sequential alphabetical letter, and those letters are colored using a configurable gradient that visually encodes the chronological progression of price activity from swing origin to completion.
This creates a profile framework that reflects how participation distributed across price within each structural swing rather than within arbitrary time containers. The gradient coloring reveals whether price visited certain levels early or late in the swing's development, the POC identifies the price level with the greatest time-based participation, the value area captures the range containing the configured percentage of total activity, and single print zones mark levels touched by only a single time period and project them forward as potential reaction areas until price revisits them.
Price structure and participation distribution are therefore evaluated together, with each swing producing a self-contained profile that answers both where price spent time and when within the swing that activity occurred.
Conceptual Framework
Swing Gradient TPOs is founded on the principle that TPO-based market profile analysis becomes structurally meaningful when profiles are anchored to confirmed swing boundaries rather than to session times that carry no relationship to the instrument's actual directional behavior.
Traditional market profile approaches build TPO distributions within daily or weekly sessions, which imposes a time container on the data that is independent of how price is actually behaving structurally. This framework replaces session-based profile construction with swing-event-driven profile building, where each profile begins at a confirmed swing extreme and ends at the next confirmed swing extreme in the opposing direction, ensuring the participation map covers exactly one complete directional structural move.
Three core principles guide the design:
- TPO profiles should be anchored to swing structure rather than calendar time, ensuring each profile captures participation within a single directional move rather than across an arbitrary time boundary that may span multiple structural events.
- Gradient coloring should encode chronological letter progression visually, revealing whether price visited particular levels early or late in the swing rather than treating all activity within the swing as temporally equivalent.
- Single print zones represent structurally significant levels visited by only one time period and should be projected forward as active reference areas until price returns to test them, at which point reclaim or rejection behavior provides actionable signal context.
This shifts market profile analysis from session-container-based participation tracking into swing-anchored structural profile construction with gradient-encoded temporal intelligence and forward-projecting single print monitoring.
Theoretical Foundation
The indicator combines swing high and low detection through highest and lowest lookback comparison, alphabetical letter assignment by configurable TPO timeframe period, three-color gradient interpolation for chronological letter coloring, POC identification through maximum TPO count per price bin, value area expansion from POC outward, single print detection and forward projection, and retest signal generation when price sweeps and reclaims a single print zone.
Swing detection tracks whether the most recent extreme high or low is the highest or lowest reading in the lookback window, registering a swing point when price rotates away from a prior extreme. TPO letter assignment maps each bar within the swing to a time period based on the ratio between the chart timeframe and the configured TPO timeframe, with sequential alphabet letters A through Z then a through z assigned chronologically across the swing's duration. Gradient coloring maps each letter's alphabetical index to a position along a three-stop gradient, producing a color sequence that progresses from swing start to swing end. Price bins are calculated from the swing range divided into segments sized relative to recent ATR, with each bin's letter count determining POC and value area membership.
Four internal systems operate in tandem:
- Swing Detection Engine: Tracks highest and lowest readings over the configurable lookback window, registering confirmed swing highs and lows when price rotates away from prior extremes and triggering profile construction on each swing direction change.
- TPO Profile Builder: Assigns sequential alphabetical letters to time periods within each swing, maps each bar's high and low range to the appropriate price bins, accumulates letter strings and counts per bin, and derives POC and value area from the resulting distribution.
- Gradient Chronology Engine: Maps each letter's sequential index to a position along a configurable three-stop gradient, producing coloring that encodes when within the swing each price level was visited rather than applying uniform directional color across the entire profile.
- Single Print Detection and Signal System: Identifies price bins touched by exactly one time period letter, projects those zones forward as extended boxes until price revisits them, monitors for sweep-and-reclaim behavior with configurable cooldown, and generates directional retest signals when qualifying conditions are met.
This design allows each swing to produce a complete participation profile with temporal depth encoded visually, while structurally significant single print zones remain active as forward reference areas with signal generation capability.
How It Works
Swing Gradient TPOs evaluates price through a sequence of structure-aware and profile-building processes:
- Swing Direction Tracking: On each bar, price is compared against the highest high and lowest low over the configured lookback. When the current high matches the lookback high, the swing is classified as transitioning to a downswing. When the current low matches the lookback low, it is classified as transitioning to an upswing.
- Swing Point Registration: When price rotates away from a prior extreme, the swing point price and bar index are recorded for both highs and lows independently, maintaining the most recent confirmed swing high and low as profile anchors.
- Profile Build Trigger: When swing direction changes, a profile build is triggered using the recorded swing high and low as boundaries, constructing the complete TPO distribution for the completed swing.
- Price Bin Calculation: The swing range is divided into bins sized relative to a smoothed ATR-derived tick amount, capped at 80 bins to maintain visual clarity and computational efficiency.
- Letter Assignment and Accumulation: Each bar within the swing is mapped to a time period letter based on the ratio of the configured TPO timeframe to the chart timeframe. For each bar, its high and low determine which price bins it touches, and the period letter is appended to each qualifying bin's letter string if not already present.
- POC Identification: The bin with the greatest accumulated letter count is identified as the Point of Control, representing the price level with the most time-based participation across the swing.
- Value Area Expansion: Starting from the POC bin, the value area expands outward by adding the adjacent bin with the greater letter count, continuing until the accumulated count reaches the configured value area percentage of total swing activity.
- Gradient Color Mapping: Each letter's alphabetical index is divided by the maximum period index to produce a normalized position along the three-stop gradient, assigning colors that progress from the gradient start color early in the swing to the gradient end color late in the swing.
- Single Print Identification and Projection: Bins with exactly one letter in their string are classified as single prints and, when the extension setting is enabled, receive forward-projecting zone boxes that extend rightward on each bar until price enters the zone.
- Single Print Sweep and Reclaim Detection: When price enters a single print zone the zone is marked as swept. If price then exits the zone in the opposing direction and closes beyond the zone boundary with sufficient cooldown observed, a directional retest signal is generated.
- Real-Time Profile Rendering: On the last bar, the developing swing from the most recent confirmed extreme to current price is rendered as a live TPO profile that updates with each new bar, providing a continuously refreshing participation map for the current incomplete swing.
Together, these elements form a continuously updating swing profile system where each completed swing produces a gradient-encoded participation map, single print zones project forward as active structural references, and retest signals identify price reclaims of structurally thin areas.
Interpretation
Swing Gradient TPOs should be interpreted as a swing-anchored participation distribution system with temporal depth encoding and forward-projecting structural reference zones:
- TPO Letter Boxes: Each lettered box represents a single time period's visit to that price level within the swing. The letter itself identifies which time period made the visit, and the gradient color reveals where in the swing's chronological sequence that period falls.
- Gradient Coloring: The gradient progression from swing start to swing end colors early-swing activity in the gradient start color and late-swing activity in the gradient end color, visually encoding whether price visited each level early or late in the structural move.
- Point of Control (POC): The horizontal line through the price level with the most accumulated TPO letters represents the level where price spent the greatest amount of time within the swing, acting as a gravitational reference for the swing's dominant auction zone.
- Value Area: The vertical line at the swing origin spanning the value area high and low with dotted horizontal boundary projections marks the price range containing the configured percentage of total swing TPO activity, identifying the zone of concentrated acceptance during the swing.
- Single Print Zones (Highlighted): Price bins touched by exactly one time period letter are visually distinguished within the profile, indicating levels that price passed through quickly without sustained participation, representing structurally thin areas vulnerable to future reaction.
- Single Print Extensions (Projected): When extension is enabled, single print zones project forward as shaded boxes beyond the swing boundary, maintaining active visual reference until price revisits the zone and the extension is consumed.
- Retest Signals: Arrow signals generated when price sweeps through an extended single print zone and then reclaims it by closing beyond the zone boundary, identifying potential continuation opportunities at structurally thin levels that have now been tested and defended.
- Real-Time Profile: The developing profile on the current incomplete swing updates continuously with each new bar, providing a live participation map anchored to the most recent confirmed swing extreme using the same gradient, POC, and value area logic as completed historical swings.
POC location, value area boundaries, gradient temporal distribution, and single print zone positioning collectively provide more structural and participatory intelligence than any element in isolation.
Signal Logic & Visual Cues
Swing Gradient TPOs presents two retest signal types derived from single print zone interaction:
- Bullish Single Print Reclaim: Generated when price sweeps into a bullish single print zone from an upswing and subsequently closes above the zone's upper boundary, indicating the structurally thin area has been swept and reclaimed with bullish resolution.
- Bearish Single Print Rejection: Generated when price sweeps into a bearish single print zone from a downswing and subsequently closes below the zone's lower boundary, indicating the structurally thin area has been swept and rejected with bearish resolution.
Both signal types require the zone to have been swept before reclaim or rejection can register, and a configurable cooldown enforces minimum bar separation between consecutive signals to prevent clustering during active zone interaction.
Alert generation covers completed swing high and swing low events as well as bullish and bearish single print reclaim signals for systematic structural and zone-based monitoring workflows.
Strategy Integration
Swing Gradient TPOs fits within market profile-informed and structure-based participation analysis approaches:
- POC Reaction Trading: Monitor price behavior when it returns to a prior swing's POC level. The POC represents the most accepted price within the swing and frequently acts as a reference for future support, resistance, or reversion behavior.
- Value Area Boundary Framing: Use value area high and low projections as structural boundary references, with price outside the value area representing potential imbalance and price returning to the value area suggesting reversion toward prior acceptance.
- Single Print Zone Trading: Use extended single print zones as anticipatory structural references, monitoring price behavior on approach for the sweep-and-reclaim or sweep-and-reject patterns that trigger retest signals.
- Gradient Temporal Analysis: Use gradient distribution within each swing to assess whether participation at key levels occurred early or late in the move. Heavily late-swing activity at a level suggests climactic behavior, while early-swing concentration may indicate initial acceptance or rejection zones.
- Real-Time Profile Monitoring: Use the developing live profile to assess current swing participation distribution in real time, identifying emerging POC levels and single prints within the active structural move before it completes.
- Multi-Swing Profile Comparison: Compare POC locations, value area widths, and single print density across successive swings to assess whether participation is concentrating or dispersing as the broader trend develops.
Technical Implementation Details
- Swing Detection: Highest and lowest lookback comparison with direction tracking and confirmed extreme registration on price rotation
- TPO Construction: Alphabetical letter assignment by timeframe-ratio-derived period with per-bin letter string accumulation and count tracking
- Profile Analytics: Maximum count POC identification, outward value area expansion to configurable percentage threshold, and single print bin classification
- Gradient Engine: Three-stop gradient interpolation with letter index normalized to maximum period for chronological color mapping
- Single Print System: Array-managed forward-projecting zone boxes with sweep state tracking, reclaim direction testing, and cooldown-gated signal generation
- Real-Time Rendering: Last-bar-triggered live profile construction rebuilding on every bar update with independent box and line arrays cleared and redrawn each render cycle
- Visualization: Per-letter TPO boxes with gradient, POC, and value area coloring, POC dual-line overlay, value area vertical and horizontal boundary lines, single print zone extensions, and retest signal arrows
- Performance Profile: Optimized with calc_bars_count and max_bars_back configuration and array size caps for object management across extended histories
Optimal Application Parameters
Timeframe Guidance:
- 1 - 5 min: Intraday swing profile mapping with shorter swing length and faster TPO timeframe for responsive participation tracking within intraday structural moves
- 15 - 60 min: Session-level swing profile analysis with balanced swing length and TPO timeframe producing meaningful letter distributions across typical session swings
- 4H - Daily: Swing-level structural participation mapping with longer swing detection and higher TPO timeframe for profiles that reflect multi-day directional move participation
Suggested Baseline Configuration:
- Swing Length: 12
- TPO Timeframe: 30
- Box Width: 2
- Show POC: Enabled
- Show Value Area: Enabled
- Value Area %: 70
- Gradient Preset: Sunset
- Highlight Single Prints: Enabled
- Extend Single Prints: Enabled
- Show Retest Signals: Enabled
- Signal Cooldown: 5
These suggested parameters should be used as a baseline; their effectiveness depends on the instrument's swing frequency, typical swing range, and preferred profile granularity, so fine-tuning is expected for optimal performance.
Parameter Calibration Notes
Use the following adjustments to refine behavior without altering the core logic:
- Swings too frequent: Increase Swing Length to require more bars on each side of an extreme before it registers as a confirmed swing point, filtering minor oscillations and producing fewer, more structurally significant profiles.
- Swings too infrequent: Decrease Swing Length toward 10 for more sensitive swing detection, producing profiles on smaller structural moves within the overall trend.
- Too few letters per profile: Decrease TPO Timeframe to assign letters to shorter time periods, increasing letter density within each swing and producing more granular participation distributions.
- Too many letters cluttering the profile: Increase TPO Timeframe so each letter covers a longer period, reducing letter density and producing cleaner, more readable profiles on the target timeframe.
- Profile bins too coarse: The bin count derives from the swing range divided by a smoothed ATR-based tick size. On instruments with large typical bar ranges relative to the swing, the profile may appear coarse. Consider using a higher timeframe chart or adjusting swing length to capture larger swings with more granular bin resolution.
- Too many single print signals: Increase Signal Cooldown to enforce greater bar separation between consecutive retest signals, or increase Swing Length to produce swings with fewer single print zones through greater overall participation density.
- Single print extensions cluttering the chart: Disable Extend Single Prints to remove forward projection boxes while retaining single print highlighting within the historical profile, or reduce Max Zones (capped internally at 50) by allowing older zones to naturally expire as price revisits them.
Adjustments should be incremental and evaluated across multiple session types rather than isolated market conditions.
Performance Characteristics
High Effectiveness:
- Trending markets with clear directional swings where each profile captures a single sustained move and produces meaningful POC and value area levels that serve as ongoing structural references
- Instruments with sufficient intrabar participation where TPO letter accumulation produces well-distributed profiles with identifiable concentration zones rather than sparse single-print-dominated structures
- Market profile-based trading approaches that benefit from swing-anchored rather than session-anchored participation context, aligning profile boundaries with actual structural events
- Single print zone strategies where structurally thin levels within completed swings provide anticipatory reference areas for future price reactions with defined signal criteria
Reduced Effectiveness:
- Choppy, low-range markets where frequent swing direction changes produce thin profiles with minimal letter accumulation and limited POC or value area differentiation
- Extremely fast-moving instruments where swing ranges are so large relative to the TPO timeframe that letters are thinly distributed across a wide range, reducing profile interpretive value
- Low-liquidity instruments where participation is insufficient to produce meaningful time-at-price distributions, resulting in profiles dominated by single prints with no identifiable acceptance zones
- Markets where the relationship between swing structure and participation distribution is inconsistent, reducing the reliability of POC and value area levels as structural references across successive swings
- Very short timeframe charts where the ratio between chart timeframe and TPO timeframe produces insufficient letter differentiation to build interpretable profiles within typical swing durations
Integration Guidelines
- Confluence: Combine with BOSWaves structural tools, order flow analysis, or momentum indicators to validate POC and value area reactions with broader analytical context before acting on profile-based reference levels
- POC Migration Awareness: Track whether POC levels across successive swings are migrating higher, lower, or remaining stable as a secondary indicator of directional participation bias beyond raw trend direction
- Single Print Zone Patience: Allow single print zones to extend and be approached naturally rather than anticipating reactions prematurely. The sweep-and-reclaim or sweep-and-reject sequence that triggers signals requires zone interaction to complete before directional evidence is confirmed.
- Gradient Reading: Use gradient distribution within profiles to contextualize POC and value area location. A POC formed late in the gradient sequence suggests late-swing acceptance, potentially indicating exhaustion. An early-forming POC suggests early directional commitment that may carry more structural weight.
- Real-Time Profile Monitoring: Treat the live developing profile as probabilistic rather than confirmed. POC and value area locations in the real-time profile will shift as new bars are added and should be interpreted as dynamic rather than fixed until the swing completes and the historical profile is committed.
Disclaimer
Swing Gradient TPOs [BOSWaves] is a professional-grade swing-anchored market profile and structural participation analysis tool. It uses TPO letter accumulation with gradient chronology encoding and single print zone projection but does not predict future price movements. Results depend on market conditions, instrument participation characteristics, parameter selection, and disciplined execution. BOSWaves recommends deploying this indicator within a broader analytical framework that incorporates momentum context, order flow analysis, and comprehensive risk management.
הערות שחרור
Updated commentsסקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.