OPEN-SOURCE SCRIPT

Displaced MAs

Displaced Moving Averages with Customizable Bands
Overview

The "Displaced Moving Averages with Customizable Bands" indicator is a powerful and versatile tool designed to provide a comprehensive view of price action in relation to various moving averages (MAs) and their volatility. It offers a high degree of customization, allowing traders to tailor the indicator to their specific needs and trading styles. The indicator features a primary moving average with multiple configurable percentage-based displacement bands. It also includes additional moving averages with standard deviation bands for a more in-depth analysis of different timeframes.

Key Features

Multiple Moving Average Types:

Choose from a wide range of popular moving average types for the primary MA calculation:

WMA (Weighted Moving Average)

EMA (Exponential Moving Average)

SMA (Simple Moving Average)

HMA (Hull Moving Average)

VWAP (Volume-Weighted Average Price)

Smoothed VWAP

Rolling VWAP

The flexibility to select the most appropriate MA type allows you to adapt the indicator to different market conditions and trading strategies.

Smoothed VWAP with Customizable Smoothing:

When "Smoothed VWAP" is selected, you can further refine it by choosing a smoothing type: SMA, EMA, WMA, or HMA.

Customize the smoothing period based on the chart's timeframe (1H, 4H, D, W) or use a default period. This feature offers fine-grained control over the responsiveness of the VWAP calculation.

Rolling VWAP with Adjustable Lookback:

The "Rolling VWAP" option calculates the VWAP over a user-defined lookback period.

Customize the lookback length for different timeframes (1H, 4H, D, W) or use a default period. This provides a dynamic VWAP calculation that adapts to the chosen timeframe.

Customizable Lookback Lengths:

Define the lookback period for the primary moving average calculation.

Tailor the lookback lengths for different timeframes (1H, 4H, D, W) or use a default value.

This allows you to adjust the sensitivity of the MA to recent price action based on the timeframe you are analyzing. Also has inputs for 5m, and 15m timeframes.

Percentage-Based Displacement Bands:

The core feature of this indicator is the ability to plot multiple displacement bands above and below the primary moving average.

These bands are calculated as a percentage offset from the MA, providing a clear visualization of price deviations.

Visibility Toggles: Independently show or hide each band (+/- 2%, 5%, 7%, 10%, 15%, 20%, 25%, 30%, 40%, 50%, 60%, 70%).

Customizable Colors: Assign unique colors to each band for easy visual identification.

Adjustable Multipliers: Fine-tune the percentage displacement for each band using individual multiplier inputs.

The bands are useful for identifying potential support and resistance levels, overbought/oversold conditions, and volatility expansions/contractions.

Labels for Displacement Bands:

The indicator displays labels next to each plotted band, clearly indicating the percentage displacement (e.g., "+7%", "-15%").

Customize the label text color for optimal visibility.

The labels can be horizontally offset by a user-defined number of bars.

Additional Moving Averages with Standard Deviation Bands:

The indicator includes three additional moving averages, each with upper and lower standard deviation bands. These are designed to provide insights into volatility on different timeframes.

Timeframe Selection: Choose the timeframes for these additional MAs (e.g., Weekly, 4-Hour, Daily).

Sigma (Standard Deviation Multiplier): Adjust the standard deviation multiplier for each MA.

MA Length: Set the lookback period for each additional MA.

Visibility Toggles: Show or hide the lower band of MA1, the middle/upper/lower bands of MA2, and the bands of MA3.

4h Bollinger Middle MA is unticked by default to provide a less cluttered chart

These additional MAs are particularly useful for multi-timeframe analysis and identifying potential trend reversals or volatility shifts.

How to Use

Add the indicator to your TradingView chart.

Customize the settings:

Select the desired Moving Average Type for the primary MA.

If using Smoothed VWAP, choose the Smoothing Type and adjust the Smoothing Period for different timeframes.

If using Rolling VWAP, adjust the Lookback Length for different timeframes.

Set the Lookback Length for the primary MA for different timeframes.

Toggle the visibility of the Displacement Bands and adjust their Colors and Multipliers.

Customize the Label Text Color and Offset.

Configure the Timeframes, Sigma, and MA Length for the additional moving averages.

Toggle the visibility of the additional MA bands.

Interpret the plotted lines and bands:

Primary MA: Represents the average price over the selected lookback period, calculated using the chosen MA type.

Displacement Bands: Indicate potential support and resistance levels, overbought/oversold conditions, and volatility ranges. Price trading outside these bands may signal significant deviations from the average.

Additional MAs with Standard Deviation Bands: Provide insights into volatility on different timeframes. Wider bands suggest higher volatility, while narrower bands indicate lower volatility.

Potential Trading Applications

Trend Identification: Use the primary MA to identify the overall trend direction.

Support and Resistance: The displacement bands can act as dynamic support and resistance levels.

Overbought/Oversold: Price reaching the outer displacement bands may suggest overbought or oversold conditions, potentially indicating a pullback or reversal.

Volatility Analysis: The standard deviation bands of the additional MAs can help assess volatility on different timeframes.

Multi-Timeframe Analysis: Combine the primary MA with the additional MAs to gain a broader perspective on price action across multiple timeframes.

Entry and Exit Signals: Use the interaction of price with the MA and bands to generate potential entry and exit signals. For example, a bounce off a lower band could be a buy signal, while a rejection from an upper band could be a sell signal.

Disclaimer

This indicator is for informational and educational purposes only and should not be considered financial advice. Trading involves risk, and past performance is not indicative of future results. Always conduct thorough research and consider your risk tolerance before making any trading decisions.

Enjoy using the "Displaced Moving Averages with Customizable Bands" indicator!

Penafian