# Composite Fractal Behavior and its aplications - page 2

47

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

139662

:)

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

47

CFB etc

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
47

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
139662

...

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

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
Files:
139662

...

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

47

Mladen, thanks for clarifying this. It is comforting to know that CFB is indeed trying and maybe succeding to capture more. My provisional conclusion,

without derogating the CFB, which I really like, is that these two indicators appoximately coincide in many trend instances (of course, with appropriate choice of periods).

A nice outcome of this discussion is the smoothed VHF you created, which can be applied with any period length. The picture shows an application. In the panel you see VHF and CFB superimposed. The long term VHF(200, heavily smoothed) nicely captures the two long term (and one shorter term) trends.

The CFB(7) indicates several reatively safe entries along these trends.

Regards,

- trendick

Edit: further inspection show that this example is a better-case instance and there are many other examples where the VHF isn't that bright in identifying such longer-term trends. I wonder if an MTF version of the CFB would be better.

Files:
vhf_cfb_1.gif 29 kb
139662

...

trendick,

As any good discussion (and I mean discussion not "discussion") some fruits must come from it. One more : multi time frame version of CFB. Try it out.

Just one additional parameter : Interpolate - to interpolate or not to interpolate the mtf ___________________

Updated version posted here : https://www.mql5.com/en/forum/179686

regards

Files:
cfb_-_mtf.gif 19 kb
cfb_mtf.mq4 11 kb
47

That was quick!

It looks really nice! With suitable smoothing it gives impressive calls that can make a difference.

I'm now going to torture the data with this s&#B^&(@# until Nature will confess.

Thanks,

- trendick

47

using cfb mtf in EA

I tried using the cfb mtf in an EA and I have the following problem.

Since this is an MTF indicator it should be possible in principle to apply it as follows:

CALL 1 (say, attached to H1):

iCustom(NULL,0,"cfb mtf",240,7,6,1000,30,5,3,true,true,0,0);[/PHP]

A stundard alternative would be as follows (and for that we don't need the MTF version):

[PHP]CALL 2

iCustom(NULL,240,"cfb mtf","Current time frame",7,6,1000,30,5,3,true,true,0,0);

The problem is that CALL 1 has some recurssion termination problems and cannot be run (attach it to "MACD sample" and see). Is it something that can be fixed?

Thanks,

trendick

PS you may ask why to use CALL 1 in the first place. My motivation was to enjoy the benefits of the interpolation. Am I correct?