OPEN-SOURCE SCRIPT
Aggiornato

TPO[Fixed Range, Anchored, Bars Back]

742
TPO Bars Back, Fixed Range and Anchored

Overview
The TPO Profile (Time Price Opportunity Profile) is a powerful market profile indicator that displays the amount of time price spent at different levels during a specified period. Unlike traditional volume profile indicators that show volume distribution, TPO Profile shows time distribution, providing insights into where price has spent the most time and identifying key support and resistance levels.

Key Advantages Over TradingView's Built-in TPO
  • Simplified Composite Creation: Automatically creates TPO profiles for any time range without manual split/merge operations
  • Instant Value Area Calculation: Immediately shows Value Area, POC, VAH, and VAL for your selected period
  • No Manual Assembly Required: TradingView's native TPO requires you to manually split sessions and merge them to create composites - this indicator does it automatically
  • Flexible Time Ranges: Create composites for any custom time period (multiple days, weeks, specific events) with a few clicks
  • Real-time Composite Updates: Anchor mode creates live composites that update as new data arrives
  • Multiple Composite Analysis: Easily compare different time periods without the tedious manual process


Key Features

Core Functionality
  • Time-Based Analysis: Shows time spent at each price level rather than volume
  • Configurable Time Blocks: Use any timeframe for TPO counting (30min, 1H, 4H, etc.)
  • Multiple Price Levels: Adjustable from 5 to 200 levels for granular analysis
  • Point of Control (POC): Automatically identifies the price level with highest time activity
  • Value Area Calculation: Shows the price range containing 70% (configurable) of time activity
  • Automatic Composite Generation: Creates multi-session composites without manual intervention


Three Operating Modes

1. Bars Back Mode
  • Analyzes the last N bars from the current bar
  • Perfect for recent market activity analysis
  • Range: 10-500 bars
  • Use Case: Intraday analysis, recent session review


2. Fixed Range Mode
  • Analyzes a specific time period between start and end times
  • Ideal for historical analysis of specific events
  • Creates perfect composites for multi-day periods
  • Use Case: Earnings periods, news events, specific trading sessions, weekly/monthly composites


3. Anchor Mode (NEW)
  • Starts from a specific time and extends to the current bar
  • Dynamically updates as new bars form
  • Perfect for building live composites from any starting point
  • Use Case: Live session monitoring, event-based analysis from a specific point, growing composites


Visual Elements

TPO Bars
  • Horizontal bars showing time distribution at each price level
  • Longer bars = more time spent at that level
  • Color-coded to distinguish Value Area from outlying levels


Point of Control (POC)
  • Red line marking the price level with highest time activity
  • Most significant support/resistance level
  • Configurable line style (Solid/Dashed/Dotted) and width


Value Area High/Low (VAH/VAL)
  • Green and Orange lines marking the boundaries of the Value Area
  • Shows the price range containing the specified percentage of time activity
  • Optional display with customizable line styles


Single Print Detection
  • Identifies price levels touched by only one time block
  • Display options: Lines or Boxes
  • Purple color highlighting these significant levels
  • Often act as strong support/resistance in future trading


Customization Options

Time Block Configuration
  • Block Time: Choose timeframe for TPO counting (30min, 1H, 4H, etc.)
  • Allows analysis at different time granularities
  • Higher timeframes = broader perspective, Lower timeframes = finer detail


Visual Styling
  • Line Styles: Solid, Dashed, or Dotted for all line elements
  • Line Widths: 1-5 pixels for POC, VAH, and VAL lines
  • Colors: Fully customizable colors for all elements
  • Transparency: Adjustable transparency for better chart readability


Label Management
  • Show/Hide Labels: Toggle POC, VAH, VAL labels
  • Font Sizes: Tiny, Small, Normal, Large, Huge
  • Label Positioning: 8 different position options relative to lines
  • Offset Controls: Fine-tune label positioning


Line Extension
  • Level Offset Right: Controls how far lines extend
  • Smart extension logic:

  • Value ≤ 0: Infinite extension (extend.right)
  • Value ≥ 1: Extends exactly N bars ahead


Trading Applications

Support & Resistance
  • POC often acts as strong support/resistance
  • Value Area boundaries provide key levels
  • Single prints frequently become significant levels


Market Structure Analysis
  • Identify areas of price acceptance (thick TPO bars)
  • Spot areas of price rejection (thin TPO bars)
  • Understand where market participants are comfortable trading


Composite Profile Analysis
  • Create multi-day, weekly, or monthly composites instantly
  • Compare different composite periods without manual work
  • Analyze longer-term price acceptance levels
  • Build composites around specific events or announcements


Session Analysis
  • Monitor intraday session development in real-time
  • Compare different sessions (London, New York, Asia)
  • Track how profiles change throughout the trading day
  • Build live composites across multiple sessions


Event Analysis
  • Use Fixed Range mode for earnings, news events
  • Use Anchor mode to track price development from specific events
  • Compare pre/post event price acceptance levels
  • Create event-based composites automatically


Input Parameters

Mode Selection
  • Mode: Bars Back | Fixed Range | Anchor
  • Bars Back: Number of bars to analyze (10-500)
  • Start Time: Beginning time for Fixed Range and Anchor modes
  • End Time: Ending time for Fixed Range mode only


Analysis Configuration
  • Block Time: Timeframe for TPO blocks (e.g., "30" for 30-minute blocks)
  • TPO Levels: Number of price levels (5-200)
  • Value Area %: Percentage for Value Area calculation (50-95%)


Display Options
  • Show POC: Display Point of Control line
  • Show Value Area: Display Value Area box
  • Show VAH/VAL Lines: Display Value Area boundary lines
  • Show Single Prints: Display single print detection
  • Single Print Style: Lines or Boxes


Styling Controls
  • Colors: TPO, POC, Value Area, VAH, VAL, Single Print colors
  • Line Styles: POC, VAH, VAL line styles
  • Line Widths: POC, VAH, VAL line widths
  • Labels: Show/hide, font size, position, offset controls


Technical Details

Calculation Method
  1. Divides the price range into equal levels based on TPO Levels setting
  2. For each time block, determines which price levels it crosses
  3. Adds +1 count to each crossed level
  4. Identifies POC as the level with highest count
  5. Calculates Value Area by expanding from POC until target percentage is reached


Performance Considerations
  • Historical data limited to prevent buffer overflow errors
  • Smart bounds checking for different timeframes
  • Optimized cleanup routines to prevent drawing object accumulation


Pine Script Version
  • Built on Pine Script v6
  • Uses modern Pine Script best practices
  • Efficient array handling and drawing object management


Best Practices

Timeframe Selection
  • Block Time = Chart Timeframe: Traditional TPO approach
  • Block Time > Chart Timeframe: Smoother, broader perspective
  • Block Time < Chart Timeframe: More granular, detailed analysis


Level Count Guidelines
  • Low levels (10-20): Better for swing trading, major levels
  • High levels (50-100): Better for scalping, precise entries
  • Very high levels (100+): For very detailed analysis


Mode Selection
  • Bars Back: Daily analysis, recent activity
  • Fixed Range: Historical events, specific periods, manual composites
  • Anchor: Live monitoring, event-based analysis, growing composites


Composite Creation Workflow
  1. Select Fixed Range or Anchor mode
  2. Set your desired start time (and end time for Fixed Range)
  3. Adjust TPO Levels for desired granularity
  4. Enable VAH/VAL lines to see Value Area boundaries
  5. The composite profile generates automatically with all key levels


This indicator eliminates the tedious manual process of creating composite TPO profiles in TradingView. Instead of splitting sessions and manually merging them, you get instant composite analysis with automatic Value Area calculation, POC identification, and single print detection. The combination of time-based analysis, multiple operating modes, and extensive customization options makes it a powerful tool for understanding market structure and price acceptance levels across any time period.
Note di rilascio
- Fix VAH Label Switching
Note di rilascio
- Changing the Display Screen

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.