OPEN-SOURCE SCRIPT

Enhanced Volume Profile

█ OVERVIEW
The Enhanced Volume Profile (EVP) is an indicator designed to plot a volume profile on the chart based on either the visible chart range or a fixed lookback period. The script helps analyze the distribution of volume at different price levels over time, providing insights into areas of high trading activity and potential support/resistance zones.


█ KEY FEATURES

1. Visible Chart Range vs. Fixed Lookback Depth
  • Visible Chart Range
    - Default analysis mode
    - Calculates profile based on visible portion of the chart
    - Dynamically updates with chart view changes

  • Fixed Lookback Depth
    - Optional alternative to visible range
    - Uses specified number of bars (10-3000)
    - Provides consistent analysis depth
    - Independent of chart view


2. Custom Resolution

Auto-Resolution Mode
Automatically selects timeframes based on chart's current timeframe:
  • ≤ 1 minute: Uses 1-minute resolution
  • ≤ 5 minutes: Uses 1-minute resolution
  • ≤ 15 minutes: Uses 5-minute resolution
  • ≤ 1 hour: Uses 5-minute resolution
  • ≤ 4 hours: Uses 15-minute resolution
  • ≤ 12 hours: Uses 15-minute resolution
  • ≤ 1 day: Uses 1-hour resolution
  • ≤ 3 days: Uses 2-hours resolution
  • ≤ 1 week: Uses 4-hours resolution


Custom Resolution Override
  • Optional override of auto-resolution system
  • Provides control over data granularity
  • Must be lower than or equal to chart's timeframe
  • Falls back to auto-resolution if validation fails


3. Volume Profile Resolution
  • Adjustable number of points (10-400)
  • Controls profile granularity
  • Higher resolution provides more detail
  • Balance between precision and performance


4. Point of Control (PoC)
  • Identifies price level with highest traded volume
  • Optional display with customizable appearance
  • Adjustable line thickness (1-30)
  • Configurable color


5. Value Area (VA)
  • Shows price range of majority trading volume
  • Adjustable coverage (5-95%), default is 68%
  • Customizable boundary lines
  • Configurable lines color and thickness (1-20)



█ INPUT PARAMETERS

Lookback Settings
  • Use Visible Chart Range
    - Default: true
    - Calculates profile based on visible bars
    - Ideal for focused analysis

  • Fixed Lookback Bars
    - Range: 10-3000
    - Default: 200
    - Used when visible range is disabled


Resolution Settings
  • Enable Custom Resolution
    - Default: false
    - Overrides auto-resolution

  • Custom Resolution
    - Default: 1-minute
    - Changes automatically when "Enable Custom Resolution" is disabled


Volume Profile Appearance
  • Profile Resolution
    - Range: 10-400
    - Default: 200
    - Controls detail level

  • Profile Width Scale
    - Range: 1-50
    - Default: 15
    - Adjusts profile width

  • Right Offset
    - Range: 0-500
    - Default: 20
    - Controls spacing from price bars

  • Profile Fill Color
    - Default: #5D606B (70% transparency)


Point of Control Settings
  • Show Point of Control
    - Default: true
    - Toggles PoC visibility

  • PoC Line Thickness
    - Range: 1-30
    - Default: 1

  • PoC Line Color
    - Default: Red


Value Area Settings
  • Show Value Area
    - Default: true
    - Toggles VA lines

  • Value Area Coverage
    - Range: 5-95%
    - Default: 68%

  • Value Area Line Color
    - Default: Blue

  • Value Area Line Thickness
    - Range: 1-20
    - Default: 1



█ TECHNICAL IMPLEMENTATION DETAILS

Exceeding Bars Management
  • The script dynamically adjusts the number of bars used in the volume profile calculation based on the selected timeframe and the maximum allowed bars (max_bars_back).
  • If the total number of bars exceeds the predefined threshold (6000 bars), the script reduces the lookback period (lookback_bars) by trimming some of the historical data, ensuring the chart does not become overloaded with data.
  • The adjustment is made based on the ratio of bars per candle (bars_per_candle), ensuring that the volume profile remains computationally efficient while maintaining its relevance.



█ EXAMPLE USE CASES

1. Visible Range Mode
  • For analyzing a recent trend and focusing on only the visible part of the chart, enabling the "Use Visible Chart Range" option calculates the profile based on the current view, without considering historical data outside the visible area.


2. Fixed Lookback Depth
  • For analyzing a specific period in the past (e.g., the last 200 bars), disabling the visible range and setting a fixed lookback depth of 200 bars ensures the profile always considers the last 200 bars, regardless of the visible range.


3. Custom Resolution
  • If there’s a need for greater control over the timeframe used for volume profile calculations (e.g., using a 5-minute resolution on a 15-minute chart), enabling custom resolution and setting the desired timeframe provides this control.



HAPPY TRADING ✌️

Disclaimer