PROTECTED SOURCE SCRIPT

SMA PLOTS & ANCHORED VWAP & CONSOLIDATION FINDER

100
Hi traders,

SMA Plots, Anchored VWAP & Consolidation Finder

This Pine Script indicator combines multiple technical analysis tools to provide traders with a comprehensive view of price trends, volume-weighted price levels, and consolidation periods. It includes Simple Moving Averages (SMAs) for daily and chart timeframes, an Anchored Volume-Weighted Average Price (VWAP) with standard deviation bands, and a consolidation detection system based on Bollinger Bands (BB), Average True Range (ATR), and Relative Strength Index (RSI). Designed for versatility, it caters to both trend-following and range-bound trading strategies.

Indicators and Logic

Simple Moving Averages (SMAs):

Daily SMAs: 50-period and 200-period SMAs are calculated on the daily timeframe, plotted on the chart for trend identification. These are ideal for long-term trend analysis, with the 50-SMA acting as a short-term trend indicator and the 200-SMA as a long-term trend indicator.

Chart SMAs: 50-period and 200-period SMAs are calculated on the current chart timeframe, offering flexibility for intraday or swing trading. These are toggleable and disabled by default to reduce chart clutter.

Labeling: Customizable labels for SMA lines and their values (toggleable) provide clear visual cues, showing the exact price levels of the SMAs on the chart.

Anchored VWAP with Standard Deviation Bands:
The VWAP is anchored to a user-defined date (default: March 20, 2020), calculating the volume-weighted average price from that point. It serves as a dynamic support/resistance level, reflecting the average price traders have paid.

Three standard deviation bands (1σ, 2σ, 3σ) are plotted around the VWAP, helping identify overbought/oversold conditions or potential breakout zones. These bands are toggleable for user convenience.

A 1-period EMA is included (toggleable, disabled by default) for traders who prefer a fast-moving average for short-term price tracking.

Consolidation Detection:
The consolidation finder uses three indicators to identify low-volatility periods, which often precede breakouts:
Bollinger Bands (BB): Measures price range tightness using the BB width (upper band - lower band / SMA). A low BB width (< user-defined threshold) indicates consolidation.

ATR (Average True Range): Assesses volatility as a percentage of the closing price. A low ATR % (< user-defined threshold) confirms reduced market activity.

RSI (Relative Strength Index): A low RSI (< user-defined threshold) suggests weak momentum, typical of consolidation phases.

Two consolidation signals are generated:
New Signal: Detects consolidation if at least a user-defined number of bars (default: 3) within a lookback period (default: 10) meet the criteria.

Standard Signal: Detects instant consolidation based on the current bar’s conditions.

A dynamic table displays historical data (min/max/average) for BB width, ATR %, and RSI within a user-defined date range, aiding in parameter optimization.

Trading Strategies
Trend-Following with SMAs:
Use the 50/200 SMA crossover on the daily timeframe to identify bullish (50 > 200) or bearish (50 < 200) trends.

On the chart timeframe, enable the 50/200 SMAs for shorter-term trend confirmation, aligning trades with the dominant trend.

Example: Enter long positions when the price is above both SMAs and short positions when below, using SMA value labels to confirm price proximity.

Mean-Reversion with Anchored VWAP:
Treat the VWAP as a mean price level. Enter long trades when the price dips to the lower 1σ/2σ bands and short trades when it rises to the upper 1σ/2σ bands, expecting a reversion to the VWAP.

Use the 3σ bands to identify extreme conditions for potential breakout or reversal trades.

Example: If the price touches the lower 2σ band and the RSI is oversold, consider a long trade targeting the VWAP.

Breakout Trading with Consolidation Detection:
Monitor the consolidation signals (new or standard) to identify low-volatility periods. These often precede significant price movements.

Enter breakout trades when the price breaks above/below key levels (e.g., VWAP, SMA, or BB bands) after a consolidation signal.

Example: If the “New Signal” is active and the price breaks above the VWAP with increasing volume, initiate a long trade targeting the upper BB band.

User-Friendly Features
Customizable Inputs: Users can adjust SMA lengths, VWAP anchor date, band multipliers, and consolidation thresholds to suit their trading style.

Toggleable Plots and Labels: Enable/disable SMAs, VWAP bands, EMA, and labels to declutter the chart and focus on relevant data.

Dynamic Table: Displays historical BB width, ATR %, and RSI metrics for the selected date range, helping users fine-tune parameters.

Alert Conditions: Two alert conditions (new and standard consolidation signals) allow users to set notifications for trading opportunities.

Visual Clarity: Color-coded plots (green for bullish, red for bearish) and clear labels enhance readability and decision-making.

How to Use
Add the indicator to your chart and adjust input parameters (e.g., SMA lengths, VWAP anchor date, consolidation thresholds) based on your trading preferences.

Enable/disable plots and labels to customize the chart display.

Monitor the dynamic table for historical data to optimize consolidation detection settings.

Set alerts for consolidation signals to stay informed of potential trading opportunities.

Combine SMA trends, VWAP levels, and consolidation signals to develop a robust trading strategy.

Notes
This indicator is best used in conjunction with other technical/fundamental analysis to confirm signals.

Backtest any strategy thoroughly before live trading, as past performance does not guarantee future results.

The default settings are optimized for general use but may require adjustment for specific markets or timeframes.

Disclaimer
This script is provided for educational purposes and should not be considered financial advice. Always conduct your own research and consult a financial advisor before trading.

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.