# CSSA Market Regime

The essence of self-similarity and complexity is to compare the whole to its component parts. For example lets take a square that is divided into four separate squares of equal size. The area of the larger square is equivalent to the sum of the areas of each of its component squares. The same of course is true of a one-dimensional line which is equivalent to the sum of its parts. One of the methods of identifying self-similarity in the stock market is to look at the range or the difference between the highs and the lows. We would expect that in a perfectly self-similar market the longer range would be equivalent to the sum of the ranges measured over a smaller interval. The more chaotic the market is, the greater the difference will be between these two measures. Such market conditions would be characterized by a large ratio between the sum of smaller ranges versus the longer measure of range. Essentially this relationship is called fractal dimension and is a measure of complexity. There are many different ways to measure this including using the Hurst exponent, but the problem I have always found in my own humble research is that the suggested thresholds defined by specific absolute values do not seem to reflect the information consistent with theory. I have often found that relative measures tend to be more robust and consistent- much the same way that the magnitude of past returns has less predictive value than the relative rank of past returns. Relative measures tend to be more stationary than absolute values. To compute this measure of self-similarity I use the intraday range (high minus low) versus a longer range window. Here is how it is calculated:

1) find the high minus the low for each day going back 10 days

2) take the sum of these values (sum of the pieces)

3) find the 10-day range by taking the 10-day maximum (including the highs) and subtracting out the 10-day minimum (whole range)

4) divide the sum of the pieces by the whole range- this is a basic measure of fractal dimension/complexity

5) take the 60-day average of the 10-day series of the complexity values- this is the quarterly “chaos/stability” metric

6) use either the 252-day normsdist of the z-score or the percentile ranking of the chaos/stability metric

7) **values above .5 indicate that the market is in a “chaos” regime and is much less predictable and non-stationary, values below .5 indicate that the market is stable and much more predictable.**

Idea Author: David Varadi

Indicator is implemented for: MT4/MT5/Tradestation/ Multicharts

How to import custom indicators to SQX: https://strategyquant.com/doc/programming-for-sq/import-export-custom-indicators-and-other-snippets/

whats the ELD file for?

Tradestation/Multicharts

Clonex, this is excellent !!!!!!!!!!!!!!!!!!!!!!!!!!! Thank you very much !!!! This will help a lot !!!!!!