# Composite Fractal Behavior and its aplications - page 29

139662

fabiogeraci:

And they are working OK

On the other hand, if you are trying to use dynamic zones version, you have to have dynamiczones.dll in the libraries folder and you have to enable dll imports in the indicators properties - or else, it will not work. The dll you can download from here : https://www.mql5.com/en/forum/179876

372

And they are working OK

On the other hand, if you are trying to use dynamic zones version, you have to have dynamiczones.dll in the libraries folder and you have to enable dll imports in the indicators properties - or else, it will not work. The dll you can download from here : https://www.mql5.com/en/forum/179876

Thank you
3231

fabiogeraci:
Thank you
Which one were you using?
Moderator
110880

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

Moderator
110880

### Composite Fractal Behavior (CFB) invented by Jurik

The forum

• Composite Fractal Behavior and its aplications - the thread with many good indicators

The articles

============

Moderator
110880

### Composite Fractal Behavior (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.

Composite Fractal Behavior and its aplications - good thread with the following indicators:

• CFB indicator, CFB channel, CFB_adaptive Stochastic Confidence Bands indicator, CFB stochastic, cfb new and cfb channel new indicators, cfb channel new - separate indicator.
• Cfb - normalized, Cfb - zero mean (z-score) normalized, Cfb - sigmoidal (logistic and hyperbolic) normalized, Cfb - logarithm modified sigmoidal (logistic and hyperbolic) normalized.
• Velocity cfb adaptive indicator, Dynamic zone velocity cfb adaptive dj indicator and Dynamic zone velocity cfb adaptive 1.01 indicator (Velocity that uses cfb for changing / adapting it's length. The velocity itself is a smoothed momentum indicator and can be used as a signal indicator but the "cfb adaptive" is different indicator which gives dramatically faster crosses for the signal).
• cfb mtf indicator (Multi Timeframe version of Composite Fractal Behavior and the other MTF version - cfb call).
• cfb channel new on ds jurik , Rvi on jurik cfb adaptive indicator, rsx cfb adaptive dj new and velocity cfb dj adaptive new indicators (These are similar yet a little different, used jurik smoothing for these 3, with double smooth = true then it is using double smooth jurik, and with it set to false uses regular jurik).

============

It is very advanced multi timeframe fractal indicator with alerts. There are some good features such as how to show the arrows when showJustOneArrow parameter is set to true :
showArrowType parameter :
0 -> draw arrow just on the first bar of the target time frame
1 -> draw arrow just on the last bar of the target time frame
2 -> draw arrow when the high is equal to high fractal or low is equal for low fractal
Additional option is to show the arrow just on the first bar of the target time frame fractal, or to repeat it on every bar belonging to that time frame bar.

1. Fractals MTF alerts indicator - the post and this post.
2. Fractals mtf alerts 2 indicator - the post: it will not alert you on a first start, on time frame change, on parameters change ... It will alert only if a new fractal is drawn. So it can alert only once for a fractal.
1386

And they are working OK

On the other hand, if you are trying to use dynamic zones version, you have to have dynamiczones.dll in the libraries folder and you have to enable dll imports in the indicators properties - or else, it will not work. The dll you can download from here : https://www.mql5.com/en/forum/179876

It seems their is nothing on page 13 for coding?

The cfb_adabtive_smoothed_cci_2 or 2.1 neither seems to work on mt4, maybe Im doing something wrong?

Or any of the other ones, all I get is a blank indicator window. dll imports is selected also. Any suggestions?

Files:
cfb_CCI.jpg 144 kb
139662

Richard Caughell:

It seems their is nothing on page 13 for coding?

The cfb_adabtive_smoothed_cci_2 or 2.1 neither seems to work on mt4, maybe Im doing something wrong?

Or any of the other ones, all I get is a blank indicator window. dll imports is selected also. Any suggestions?

Page 13 seems to have fallen as a victim to one of the many "migrations" that the forex tsd forum had been gone through - unfortunatelly, as far as I know, nothing can be done regarding that

As of the rest : use the "nmc" (New Metatrader 4 Compatible) versions (ie: the newer versions, since, due to changes that mt4 has undergone some older code needed so changes). So, simply go further the thread and you shall find those versions too or simply recompile the code a couple of times (eventually the build 1090 will get it right and the values are going to re-appear since there is nothing wrong with the code in some cases when line display is used)

1386

Page 13 seems to have fallen as a victim to one of the many "migrations" that the forex tsd forum had been gone through - unfortunatelly, as far as I know, nothing can be done regarding that

As of the rest : use the "nmc" (New Metatrader 4 Compatible) versions (ie: the newer versions, since, due to changes that mt4 has undergone some older code needed so changes). So, simply go further the thread and you shall find those versions too or simply recompile the code a couple of times (eventually the build 1090 will get it right and the values are going to re-appear since there is nothing wrong with the code in some cases when line display is used)

Such a simple fix, haha I wish I knew more about this kinda stuff. Thanks a lot.

96

I tried to put the CFB indicator on my chart but couldn't see the actual indicator even though it compiled and was showing the correct data in the window.  I tried everything, including switching to a different computer. I thought I was going insane.

Turns out it's a bug in build 1090.  The fix is changing the code and recompiling it as Mladen explains here:  https://www.mql5.com/en/forum/170914#comment_5642504
Indicators: Schaff trend cycle - adjustable smoothing
• 2017.02.23
• www.mql5.com