Composite Fractal Behavior and its aplications

 

In describing the cfb I am going to cheat : since it was invented by Jurik, here is what he is saying about it :

What is the Theory Behind CFB ?
CFB tells you how long the market has been in a quality trend. This value can be used to adjust the period length of other indicators, especially stochastic bands.

In order to quantify the overall duration of a market's trend, we replaced classical cycle analysis methods (FFT, MEM, MESA) with a form of analysis that works even when no cycles exist. We accomplished this by examining a time series for specific fractal patterns of any size. We then gather all the patterns found and combine them into one overall index, CFB (Composite Fractal Behavior) Index.

For good reason, CFB does not analyze time series data for dominant cycles. Classical cycle analysis examines data points (e.g. prices) and estimates the average presence of a cycle in the window. Now suppose a cycle with a period length of 9 days was strong for 50 days and then disappeared for the next 14 days. Because the cycle was present for 50 out of the last (50+14=64) days, the average presence of that cycle would be measured as "strong" even though it does not exist anymore!
Does CFB find the Dominant Cycle ?
No! Consider the following discussion about the MYTH of exploiting dominant cycles.

It is true that the market does have predictable cycles due to its "structural" or physical nature. For example, quarterly earning cycles, triple witching cycles, Federal Reserve meetings, weekly cycles, political election year cycles, the annual end-of-year stock dumping cycle, sunspot cycles, and the slow Kitchin (3-5 years), Juglar (7-11 years), Kuznet (15-25 years) and Kondratieff (45-60 years) cycles. They are very predictable and the markets readily discount their presence as far ahead in time as is reasonable. So there's not much left with regard to those cycles for you to exploit.

What traders see as cycles on an hourly chart, for example, is a different matter. The big, obvious cycles you see on price charts are actually the result of a combination of many weak cyclic forces that sometimes line up in phase to produce APPARENT dominant cycles that suggest the presence of a strong structural cycle that, in fact, does not exist. The slightest shifting in phase of any one component (due to crowd psychology, unscheduled events, etc.) will significantly alter the structure of the apparent dominant wave. This may drive the cycle into a "null" or random period, then reappear, completely out of phase. Now you see it ... and now you don't.

The transitory nature of these apparent dominant cycles makes their automated detection difficult and forecast unreliable. Sometimes cycle forecasting tools appear accurate and other times they are totally off mark. The reason is that tools designed to spot dominant cycles will announce whatever they find, even if they are only apparent (not structural) and transitory. For example, such tools would have no problem detecting cycles in the six charts below. But there is just one problem --- the slow cyclic price action in the six charts below is *impossible* to project into the future with any reasonable accuracy!

Why? Because we produced these six charts by simply adding consecutive random price changes. That's right!! These charts are nothing more than RANDOM WALKS. And by definition, they cannot be forecasted, no matter how impressive their apparent cyclic behavior may be!

The chart above does not "prove" market cycles are non-existent. Indeed, discretionary traders can learn to spot and use periodic price events, and take time to "understand" their causes, in order to verify whether the relevant triggers have actually occurred.

This demonstration does show, however, that cycle-finding tools like FFT, MESA and periodigrams, which have no understanding of market cause-effect relationships, can be easily fooled into seeing ghosts. In contrast, our CFB tool was designed to measure market trending action without assuming the existance of cycles. This makes CFB more reliable.

How would I use CFB's results ?
CFB produces a value proportional to a time series' trend duration. This value is in units of TIME, as measured in bars on a chart. Because CFB's output is in units of time and not price, CFB offers a unique window into a new dimension for representing signal behavior.

Investors have discovered many profitable ways to apply CFB:

* To auto-adjust the lookback of classical indicators, such as RSI

* To auto-adjust the lookback depth of breakout channels in trending markets

* To auto-adjust the minimum amount of retracement needed to reverse position

Making a profit in the market requires your finding a unique niche that very few other people are exploiting. CFB offers this unique perspective.

Do I specify a "period length" for CFB?
In CFB, period length determines how many bars (time slices) are examined for specific fractal patterns. Due to the complexity of the algorithm, CFB permits only four period lengths: 24, 48, 96, 192. The 24-bar version can see trend fractals up to 24 bars wide, and so on. You get all four versions when ordering CFB.

________________________________

Now that was Jurik

The main problem in building this indicator for metatrader was the shear number of buffers it must use for its calculations and the calculations itself. There were some attempts to make it, but those were stopped at a first step : making a basic calculation function and that was all that was done. This is the "real" one. With some additions of course

In this indicator the "period" is replaced with "depth" :
depth 1 -> period 24

depth 2 -> period 32

depth 3 -> period 48

depth 4 -> period 64

depth 5 -> period 96

depth 6 -> period 128

depth 7 -> period 192

What deviates from Juriks cfb is the post smoothing : since the slope should determine the "trending" or "no trending" that I thought that some smoothing would not hurt. Smoothing used is the one from one more average and gives satisfactory results. Do not confuse the Smooth parameter with SmoothResult, SmoothSpeedand SmoothAdaptiveparameters. Smooth is a part of cfb calculations and the last 3 are used to smooth the already calculated cfb.

PS: attached a welth lab source that I used as a model for this indicator. Do not be alarmed when you compare the two sources : that is cfb (value wise the same thing, believe me, just everything can be done a BIT differently and faster ) Also attached what can be found and what people wrongly believe to be a cfb : the cfbAux function (this function is a correct, if you compare it to those posted on some sites )


____________________________

Updated version posted here : Composite Fractal Behavior and its aplications

Files:
cfb_-_1.gif  8 kb
cfb_-_basic.gif  15 kb
cfb.mq4  7 kb
cfbaux.mq4  3 kb
 

Cfb channel+oma

mladen:
One (simple this time) implementation of cfb : cfb channel

This channel is a high/low channel with a twist. The channel and its "speed" are modified by a "stochastic-ised" cfb in order to be more responsive

_______________________________

Of parameters :
CfbResultSmooth-> when set to values > 1 smooths internal cfb results used by this indicator

Depth1-> the minimal "depth" of the high/low lookback

Depth2-> the maximal "depth" of the high/low lookback

CfbDepth, CfbPriceand CfbSmoothare the parameters passed to cfb, and for explanation of them, please look at the previous post.

_______________________________

PS: this indicator is made as a direct idea of Mark Jurik, and is interesting as a simplest implementation of cfb in another indicator. Later on will be posted some much more useful implementations (like cfb modified speed of RSX, for example) Also attached the stochastic of the cfb - it might be interesting to see exactly when and why is the channel modified, but also there is some interesting behavior of the stochastic version itself as a standalone indicator

Mladen,

Your CFB channel is very interesting when used in combination with your OMA,usual settings I use that I explained at your "one more average" thread.

Please see pic...The basic idea is as follows...for longs(inverse for shorts,same concept)

1-SETUP:Price Closes below external OMA,once the OMAS have crossed(Adaptive over non Adaptive)

2-Entry trigger:We wait for the cfb channel band to flatten,then enter at bar close...this will usually give us an entry with price action in our favour,and good "company" (orderflow)...so,we will not enter at the low,but we will enter a very good probability trade....see pic with the arrow

3-Stoploss:1/2 ATR Below lower low,which,probably,will be previous bar low...move to BE once first TP is touched or, in case you choose OPTION2 for TP,when 1 H4 ATR is reached....then Trail(optional,I personally do not believe in trailing stops)

4-TP:

Option1: 1/3 at 1 ATR H4,1/3 at near support,1/3 At next OMA cross.

Option2: 1/2 at 1 D1 ATR,1/2 at next OMA cross...

I think that this basic method can be used to catch the 123..or first retracement at the beginning of a new swing.

Additionally,I have been testing your CFB Stochastic with CRB bars,there are interesting patterns there,for sure,but totally unrelated to the "usual" stochastics behaviour ...When I am sure about them,I will post an example.

Regards

S

Files:
omaampcfbch.gif  73 kb
 

Thanks Mladen for your indicator and detailed explanation! Between you and Simba, a continuous learning experience.

 
mrtools:
Thanks Mladen for your indicator and detailed explanation! Between you and Simba, a continuous learning experience.

Thanks Tools,between you and Mladen kind help,it is a continuous learning experience

S

 

Thanks Mladen

 

cfb definition

Mladen, the CFB indeed looks intriguing. Would it be possible to post its mathematical definition?

I realize that you did post the source and the original wealth lab code, which formally speaking are "definitions".

What I'm asking is for something that abstracts away the implementation details (a pseudo code would be just fine).

Thanks.

trendick

 

:)

trendick,

I think that, in the end, it all comes to one line of code (the rest is the "sampling", "analysis" and the "confirmation" part). That line would be the following (it is the part of calculateCFB function) :

storec[r][_roc] = MathAbs(storec[r][_prices] - storec[r-1][_prices]);

As you can see it is a kind of momentum (absolute momentum, to be more precise, I used a _roc in name and it could be as well a definition : an absolute rate of change) All the rest is is there to "refine" it and to make sure that sample data from predefined points is confirming same direction. If it does, than the assumption is that there is a valid trend

_________________________

But, I would also like to add that the fact that its "secret" is a momentum does not make it worth less (at least it is my opinion) : some of the best indicators I have seen are based on momentum and I think that the momentum is one of the most useful ways found and applied in technical analysis. This one tends to be on my list of favorites because it is not a "trigger happy" indicator that jumps on every little change declaring it a "trend"

regards

mladen

 

guess who?

The picture shows CFB and VHS smoothed. VHS should look even better with more sophisticated smoothing (here I simply draw the signal line, already existing in the VHF implementation by Igorad).

Now tell me that the name "composite fractal behavior" is at the least not misleading...

- trendick

Files:
vhf_cfb3.gif  23 kb
 

CFB etc

Mladen, thanks for the explanation.

Check out the striking resemblence to cousin VHF (bottom panel), which computes noise as the "total variation" (sum of absolute momentum values).

Some appropriate smoothing of VHF might make them even closer.

I saw that your code disables the first seven Depths (2,3,4,6,8,12,16).

Why is that?

The way I currently use CFB is straightforward, to reject entry signals showing up on a down swing of the CFB. A shallow study shows that this use has decent potential to eliminate bad entries. What's your favourite application of CFB?

Another question: among the various CFB normalizations you implemented, were you able to indentify anyone that is better than the others?

Regards,

trendick

Files:
vhf_cfb.gif  25 kb
 

...

OK

_________________________

Let test it : here is one that is smoothed. As a basis I used the one made by igorad and added the latest Jurik smoothing. Found one more but that one has a logical error in my opinion - the way how lows and highs in the "other" one are found do not seem to be logical :

double HCP = High;

double LCP = Low[Lowest(NULL,0,MODE_CLOSE,period,bar)];

[/php]While, in igorads version it is (if we would write the code the same way)

[php] double HCP = Close;

double LCP = Close[Lowest(NULL,0,MODE_CLOSE,period,bar)];

Now the comparison (I am comparing same lengths in this case, since Depth 2 is in effect length 32) :
I would like to remind that cfb is rising when it indicates that there is a "trend". You will find that there are considerable differences in the way indicators are showing values (marked 2 periods with 3 vertical lines). Even if the values look similar (which is normal since the basis for the 2 is almost the same) at the first glance, in "critical periods" they are actually indicating different "things"

So, I would not dismiss either of the indicators. As I told, in my opinion, momentum based indicators are very useful ones and every one that is there and does it job decently, can be used.

_________________________

PS: thanks for the pointing to this direction. It is always good (and crucial) to know the similarities and differences between tools and now we have some more light on both indicators

regards

mladen

trendick:
The picture shows CFB and VHS smoothed. VHS should look even better with more sophisticated smoothing (here I simply draw the signal line, already existing in the VHF implementation by Igorad).

Now tell me that the name "composite fractal behavior" is at the least not misleading...

- trendick
 

...

As of "composite fractal behavior" name, and if it is misleading or not :

_________________________

The main difference in the way that VHF and CFB work is the way how they treat a "chunk of time" (Length wide time segment in cases of both indicators) VHF is treating it "linearly" : start point and end point and that is all. CFB takes samples from smaller "chunks" to longer "chunks" and from those samples it calculates its value.

If we remember the fractal definition (the original Mandelbrot fractal definition) of self similarity regardless of the "chunk" we are observing, then CFB is doing exactly what it is saying : comparing smaller "chunks" with larger and larger "chunks" in order to find similarity. So, the name is not misleading (this time Mark Jurik did not do what he sometimes does : like when he renamed a smoothed Spearman to TPO )

_________________________

And the last : the seven disabled Depths (2,3,4,6,8,12,16) - they are not disabled, but are just a basic bricks that are taken into consideration but are not shown since their lengths are not long enough to show any kind of trend.

Hope this clarifies the CFB. Not preaching but in this case it seems that CFB deserves its name

regards

mladen

Reason: