The Volatility Cycle Breakout indicator draws range boxes overlaid on the price chart. The upper and lower side of the boxes are made from recent Fractals. New boxes will be drawn only if the volatility is weak and if the new fractals discovered are far enough from the current upper and lower ones.
The volatility cycle is extracted from Bollinger Bands (InpBandsPeriod=18 is the bands period). Original indicator is here: Volatility Cycle
Fractals lookback periods can be adapted to catch new fractals far in the history or near of the current price (cp=10).
The “change” variable is the percent variation needed to change the support and resistance levels of the boxes (0.1% seems to work fine for intraday timeframes on forex pairs for instance). This setting is important because it will reduce the noises of “moving boxes” each time new Fractals are discovered, specially when price is ranging. It results perfect range boxes on price to play mean reversion strategy when price is not moving enough to make real breakout.
Original concept (modified since) come from a topic in French forum.
All ideas are welcome and could result in new good indicators, don’t hesitate to post them in forums!
//PRC_Volatility Cycle Breakout | indicator
//03.10.2017
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//--- parameters
//InpBandsPeriod=18 // Period
//Smooth=2 // Smoothness
//cp=10 // Fractals periods
//change=0.1 // Percent change to modify the upper/lower channel
//--- end of parameters
//Cycle
StdDev = std[InpBandsPeriod](close)
highindex = highest[InpBandsPeriod](StdDev)[1]
lowindex = lowest[InpBandsPeriod](StdDev)[1]
if barindex>InpBandsPeriod then
VolDer = (StdDev-highindex)/(highindex-lowindex)
VolSmooth = average[Smooth](VolDer)
if VolSmooth>0 then
VolSmooth = 0
elsif VolSmooth<-1.0 then
VolSmooth = -1.0
endif
endif
//fractals
if high[cp] >= highest[2*cp+1](high) then
LH = 1
else
LH = 0
endif
if low[cp] <= lowest[2*cp+1](low) then
LL = -1
else
LL = 0
endif
if LH = 1 then
TOPy = high[cp]
endif
if LL = -1 then
BOTy = low[cp]
endif
//channel
if VolSmooth = -1.0 then //no volatility
if abs(TOPy-upperchannel)/close>change/100 then
upperchannel = TOPy
endif
if abs(BOTy-lowerchannel)/close>change/100 then
lowerchannel = BOTy
endif
endif
RETURN upperchannel coloured(100,150,100) style(dottedline) as "upper channel", lowerchannel coloured(150,100,100) style(dottedline) as "lower channel"