Not clear about calculation of Floor and Ceiling

Hi,



I need more clarity on the calculation of Floor and Ceiling from Swing lows and highs. The explanation in Section 7 Unit 14 is not clear. What exactly is the floor? what exactly is the ceiling? Are they a rolling lowest and highest point calc within a given window? Or are they the lowest/highest points in the whole dataset? Or is it something else? I've gone over it mulitple times but am not able to understand.



Secondly how is the regime determined from floor and ceiling? Is it always bullish and bearish, or is there a sideways classification as well?



Thanks

Apoorv


The floor and ceiling method

The floor and ceiling are calculated from the swing lows and highs. They are calculated on a rolling basis and not on the whole dataset.

The floor and ceiling method is much closer to people's actual perception of when bull and bear start. We intuitively know that a bull market is underway when new lows fail to penetrate the bottom and rally upward. Conversely, we intuitively know that a bear market has started when new highs fail to take out the peak. The floor ceiling method introduces a statistical quantification of the distance between the peak/bottom and subsequent swings. The objective is to identify the earliest of a regime change: Bull ends on a high note, Bear ends at a low point.

How can you identify a change in trend?
The start of the bear market could be calculated using percentage points, something like 10-20% from the top. Whilst intellectually comfortable, it is also disrespectful of the markets. Stocks do not have the same volatility signature. Then, what are other alternatives?

We can use volatility. It is, therefore, preferable to restate distance in units of volatility. This could be: average true range, realised vol, Garman-Klass, Zhang-Yang etc.

A simple but robust way is to calculate is if the current value is 1.5 standard deviation away from the ceiling, then we mark it as the start of the bear market and start the regime change.

There is no sideways classification. it is only bullish and bearish classification.

I hope this helps.

Stay safe. 

Thanks!




 

So can we say if close is crossing below highest high of 20 days minus 1.5 standard deviation its a change in from bull to bear. So if we can use highest high of lets say 20 days what is use of swing.

Hi Deepak,



If the price is 1.5 standard deviations away from the lowest low of 20 days, then you can expect a regime change from bullishness to bearishness. 



Here standard deviation is 20 days standard deviation of the 1 year rolling low. Below you can find the code to do this.

data['rolling_low'] = data['low'].rolling(252).min()
std_dev = data['rolling_low'].rolling(20).std()
low_point_of_regime_change = data['rolling_low'] - (std_dev * 1.5)

If the price came below low_point_of_regime_change then we can expect a change of regime from bullish to bearish.



You can also identify the regime change without using standard deviation(volatility). If the price falls

20% from the swing high is generally considered an enter a bearish regime.



Hope it helps!