A simple indicator that can help traders define their trading zone based on the volatility identified by the Bandwidth of Band Based Technical Indicators such as Bollinger Band, Keltner Channel or Donchian Channel
Link to the indicator: Relative Bandwidth Filter
Concept of Relative Bandwidth
This script tries to identify the area of low and high volatility based on the comparison between Bandwidth of higher length and ATR of lower length.
Relative Bandwidth = Bandwidth / ATR
Bandwidth can be based on either Bollinger Band, Keltner Channel or Donchian Channel. Length of the bandwidth need to be ideally higher. ATR is calculated using the built-in ATR method and ATR length needs to be ideally lower than that used for calculating Bandwidth. Once we got Relative Bandwidth, the next step is to apply Bollinger Band on this to measure how relatively high/low this value is.
Overall - If relative bandwidth is higher, then volatility is comparatively low. If relative bandwidth is lower, then volatility is comparatively high.
Usage of Relative Bandwidth Filter
This can be used with your own strategy to filter out your non-trading zones based on volatility. Script plots a variable called "Signal" - which is not shown on the chart pane. But, it is available in the data window. This can be used in another script as external input and apply logic.
Signal values are defined as
- 1: Allow only Long
- -1: Allow only short
- 0: Do not allow any trades
- 2: Allow both Long and Short
Here are the settings available on the indicator
Bands to calculate the Current Bandwidth
- Type - Type of Band Used. Can be Bollinger Band, Keltner Channel or Donchian Channel
- Source - Source on which the bands are applied. Generally on close price. But, users can also apply it to other values including an external indicator. Only applicable for Donchian Channel when Use Alternate Source is selected.
- Moving Average - Moving average type used for calculating bands. The default is "Simple moving average".
- Length - Moving average length to calculate the bands
- Multiplier - Standard deviation(For Bollinger Bands) or ATR multiplier (For Keltner Channel). Not applicable to Donchian Channel.
- Use True Range - Only applicable for Keltner Channel calculations.
- Use Alternate Source - Only applicable for Donchian Channel. Used in conjunction with Source.
- Sticky - Used for calculation of bands in sticky fasion.
Outer Band and Desired Condition Calculation
- ATR Length - For the calculation of ATR to define the relative bandwidth
- Band Paramerers for Outer Band - These are used for the calculation of bands on relative bandwidth.
- Desired Condition - This lets you set the intended zone as a high volatility zone or low volatility zone.
- Reference Band - Used for defining the cutoff of high and lows.