Is there a way where one can identify market regime shift from low volatility zone to high volatility zone and vice versa? How I can identify stocks with increasing volatility? Is there a way one can identify the regime shift in volatility? These are the bugging question from many short-term traders.
To kickstart ATR is a measure of volatility and not a directional indicator. when the market participants are active & interested eventually it will result in large trading range. However, if the participants are uninterested which will result in smaller trading range. And the volatility behavior can be seen in cycles where the market moves from high volatile zones to low volatile zones and vice versa.
PercentRank Based Smooth ATR – Nifty Daily Charts
But ATR values alone we cannot use it to predict the change in regime shift from low to high or high to low volatility shift. In order to predict the regime-shift, we need to smooth the ATR. Here smoothing of the ATR data points are done using linear regression to reduce lag in end result and equally responsive as the actual ATR values.
Now Percentrank is applied over smooth ATR to predict the change in regime shift. Percent rank value of 100 indicates that the smooth ATR is the highest for the given lookback range, while a value of 0 indicates that the smooth ATR value is the lowest for the given lookback range(Default lookback range = 20 bars).
From Zero to Increasing Percent Rank indicates regime change from low volatility zones to high volatility zone (Blue Color)
whereas,
From 100 to Decreasing Percent Rank indicates regime shift from high volatility to low volatility zone. (Red Color)
Here are the Amibroker AFL codes for Percent Rank based smooth ATR and colored candles according to the high volatility or low volatility zones. High volatility zones are colored blue and low volatile zones are colored red. Exploration feature is added to find increasing/decreasing Percent rank with values.
Note: Exploration can be used only on 1 recent bar or 1 recent day if on a daily timeframe to get accurate values.
PercentRank Based Smooth ATR Color-coded Candles – Amibroker AFL Code
// Coded by Rajandran R
// Coded Date : 14-09-2018
// Author - Maketcalls (www.marketcalls.in )
// Co-Founder - Traderscafe (www.traderscafe.in)
_SECTION_BEGIN("PRBATR colored Candles");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
periods = Param( "Periods", 20, 1, 200, 1 );
PRBATR=PercentRank(LinearReg(ATR(periods),periods),periods);
color = IIf(PRBATR > Ref(PRBATR,-1) OR PRBATR == 100,colorBlue,colorRed);
Plot( C, "Close", color, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
PercentRank Based Smooth ATR – Amibroker AFL Code
// Coded by Rajandran R
// Coded Date : 14-09-2018
// Author - Maketcalls (www.marketcalls.in )
// Co-Founder - Traderscafe (www.traderscafe.in)
_SECTION_BEGIN("Percent Rank Based ATR");
periods = Param( "Periods", 20, 1, 200, 1 );
PRBATR=PercentRank(LinearReg(ATR(periods),periods),periods);
color = IIf(PRBATR > Ref(PRBATR,-1) OR PRBATR == 100,colorBlue,colorRed);
prbstatus = WriteIf(PRBATR > Ref(PRBATR,-1) OR PRBATR == 100,"Increasing","Decreasing");
Plot( PRBATR, "PRB-ATR", color, styleLine | styleThick );
_SECTION_END();
_SECTION_BEGIN("Exploration");
Filter = 1; //allow all
AddColumn(Close,"LTP",1.2);
AddColumn(PRBATR,"PRBATR",1.2,colorWhite,color);
AddtextColumn(prbstatus,"Status",1,colorWhite,color);
_SECTION_END();
PercentRank Based Smooth ATR – Amibroker AFL Code
Hello Sir
Can you please share python code for this indicator ?
It would be of great help