Granular Candle-by-Candle VWAP

Customizable Features
Users have extensive control over various aspects of the Granular Candle-by-Candle VWAP indicator. Below are the key features that can be customized to align with individual trading preferences:
🎛️ Customizable Features
Users have extensive control over various aspects of the Granular Candle-by-Candle VWAP indicator. Below are the key features that can be customized to align with individual trading preferences:
🔢 Lookback Period
- Description: Defines the number of lower timeframe bars used in the VWAP calculation.
- Customization:
- Input: VWAP Lookback Period (Number of Lower Timeframe Bars)
- Default Value: 20 bars
- Range: Minimum of 1 bar
- Purpose: Allows traders to adjust the sensitivity of the VWAP. A smaller lookback period makes the VWAP more responsive to recent price changes, while a larger period smoothens out fluctuations.
📈 Price Type Selection
- Description: Determines which price metric is used in the VWAP calculation.
- Customization:
- Input: Price Type for VWAP Calculation
- Options:
- Open: Uses the opening price of each lower timeframe bar.
- High: Uses the highest price of each lower timeframe bar.
- Low: Uses the lowest price of each lower timeframe bar.
- Close: Uses the closing price of each lower timeframe bar.
- OHLC/4: Averages the Open, High, Low, and Close prices.
- HL/2: Averages the High and Low prices.
- Typical Price: (High + Low + Close) / 3
- Weighted Close: (High + Low + 2 × Close) / 4
- Default Value: Close
- Purpose: Offers flexibility in how the average price is calculated, allowing traders to choose the price metric that best fits their analysis style.
🕒 Lower Timeframe Selection
- Description: Specifies the lower timeframe from which data is fetched for granular VWAP calculations.
- Customization:
- Input: Lower Timeframe for Granular Data
- Default Value: 1 minute ("1")
- Options: Any valid TradingView timeframe (e.g., "1", "3", "5", "15", etc.)
- Purpose: Enables traders to select the granularity of data used in the VWAP calculation, enhancing the indicator's precision on higher timeframe charts.
🎨 VWAP Line Customization
- Description: Adjusts the visual appearance of the VWAP line based on price position relative to the VWAP.
- Customizations:
- Color When Price is Above VWAP:
- Input: VWAP Color (Price Above)
- Default Value: Green
- Color When Price is Below VWAP:
- Input: VWAP Color (Price Below)
- Default Value: Red
- Line Thickness:
- Input: VWAP Line Thickness
- Default Value: 2
- Range: Minimum of 1
- Line Style:
- Input: VWAP Line Style
- Options: Solid, Dashed, Dotted
- Default Value: Solid
- Purpose: Enhances visual clarity, allowing traders to quickly assess price positions relative to the VWAP through color coding and line styling.
🔔 Alerts and Notifications
- Description: Provides real-time notifications when the price crosses the VWAP.
- Customizations:
- Enable/Disable Alerts:
- Input: Enable Alerts for Price Crossing VWAP
- Default Value: Enabled (true)
- Alert Conditions:
- Price Crossing Above VWAP:
- Trigger: When the closing price crosses from below to above the VWAP.
- Alert Message: "Price has crossed above the Granular VWAP."
- Price Crossing Below VWAP:
- Trigger: When the closing price crosses from above to below the VWAP.
- Alert Message: "Price has crossed below the Granular VWAP."
- Purpose: Keeps traders informed of significant price movements relative to the VWAP, facilitating timely trading decisions.
📊 Plotting and Visualization
- Description: Displays the calculated Granular VWAP on the chart with user-defined styling.
- Customization Options:
- Color, Thickness, and Style: As defined in the VWAP Line Customization section.
- Track Price Feature:
- Parameter: trackprice=true
- Function: Ensures that the VWAP line remains visible even when the price moves far from the VWAP.
- Purpose: Provides a clear and persistent visual reference of the VWAP on the chart, aiding in trend analysis and support/resistance identification.
⚙️ Performance Optimizations
- Description: Ensures the indicator runs efficiently, especially on higher timeframes with large datasets.
- Strategies Implemented:
- Minimized Security Calls: Utilizes two separate request.security calls to fetch necessary data, balancing functionality and performance.
- Efficient Calculations: Employs built-in functions like ta.sum for rolling calculations to reduce computational load.
- Conditional Processing: Alerts are processed only when enabled, preventing unnecessary computations.
- Purpose: Maintains smooth chart performance and responsiveness, even when using lower timeframe data for granular calculations.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.
Declinazione di responsabilità
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Per un accesso rapido a un grafico, aggiungi questo script ai tuoi preferiti: per saperne di più clicca qui.