ProfitProgrammers

Volatility Bands

We used Marc Chaikin’s Chaikin Volatility as somewhat of a baseline for this indicator and then built on it. Like Chaikin Volatility, our indicator draws primarily upon high-low spreads to quantify a security’s volatility. It also has similarities to Keltner Channels as it uses ATR rather than standard deviations in its calculation of the different bands.

Inputs:
int ‘len0’, lookback window for fast EMA of high-low ranges.
int ‘len1’, lookback window for slow EMA of high-low ranges.
int ‘len2’, lookback window for slow EMA of closing prices.
float ‘m0’, ATR multiplier for first upper and lower volatility bands.
float ‘m1’, ATR multiplier for second upper and lower volatility bands.
float ‘m2’, ATR multiplier for third upper and lower volatility bands.
int ‘lenATR’, window length for ATR calculation.

Output: 3 Upper and Lower Volatility Bands (6 total).
1. Compute High Low Spread for current period.
hlr = (high – low)

2. Calculate Exponential Moving Average of HLR at length len0
fastEMA = ema(hlr, len0)

3. Calculate Exponential Moving average of HLR at length len1 (where len1 > len0)
slowEMA = ema(hlr, len1)

4. Get EMA of closing prices at length len2(where len2 > len1 and len1 > len0)
priceEMA = ema(close, len2)

5. Use adjusted Chaikin Volatility Formula to quantify volatility
v = (fastEMA – slowEMA) / slowEMA

6. Calculate three upper and three lower volatility bands (6 total):
ex:
upper0 = priceEMA + ((1 – cv) * (atrMult0 * atr(lenATR)))
lower0 = priceEMA – ((1 – cv) * (atrMult0 * atr(lenATR)))


One possible way to use this indicator is to enter a long position when the security’s price falls below the lowest volatility band and then exit when it crosses above the third upper band. This seems to get the best results for quick, high frequency trading. Another approach is to enter a position when the bands begin to break out from a compact state and the width between them increases.

Still tweaking the idea, so any feedback would be appreciated.

-Profit Programmers
www.profitprogrammer.com
Skrip dilindungi
Skrip ini diterbitkan secara sumber tertutup dan anda boleh menggunakannya dengan bebas. Anda boleh menyukainya untuk menggunakannya pada carta. Anda tidak dapat melihat atau mengubah kod sumbernya.
Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Ingin menggunakan skrip ini pada carta?