- Bookmarks
- EA Expert Advisors and Speculative Opportunities
- Fractal scalper (available only for logged in users)

By JohnLast 2317 days ago Comments (9)

http://beathespread.com/file/view/7561/fractal-scalper

От 08 ноември 2011 |

This is the fractal scalper I was talking about. It is from the same family as the Entropy scalper but here we are using the fractal dimension of the time series to decide to enter or not in a trade.

**Basic principle: detecting pockets of predictability using fractal dimension treshholds and taking a directionnal signal**

**How to detect a pocket of predictability?**

The basic principle is the same we are looking for a pocket of predictability. The mechanism is straightforward. We are looking what is going on for the last 2 consequtive bars. a3 and a4 parameter.

So we are interested what was going on the two bars before (a3) and one bar before (a4). Those values needed to be below an iVAR treshhold in order to take the signal. Here I use the iVAR (because I was told that it was easier to implement in an EA, but the code is ready so you can replace it by FGDI). In this example I use treshhold of 0.4. So we are in a low fractal dimension 2 bars before and 1 bar before. And we open a trade at the current bar. Yes it is a little bit late but I wanted to scalp a little bit when a probability of a directionnal movement is strong enough, and that time delay would give enough time of the directionnal indicator to give the correct direction.

**How we take a directionnal signal?**

When we are in such a pocket we are going to take a directionnal signal. The directionnal signal is from the PFE (Polarysed fractal efficiency indicator). However I do not use the original but a mod of it with filtering. The Fractal efficiency is calculated like in KAMA, Kaufman’s Adaptive Moving Average efficiency ratio, plus polarization and with optional exponential moving average.

**What about money management?**

The money management model for the example is 15 pips target, 15 pips stop loss. Mainly I wanted to have this expert for hypothesis testing. I wanted to test if the fractal break - out pattern really exist. And yes that is a valid pattern but the things are not easy because you need to optimize the treshholds.

**How the market state analysis will help?**

However it has two values.

1. When the market state is good, like from the beginning of this January 2012, this expert is handling very well those kind of market conditions. Quiet and trending, Volatile and trending.

2. It keeps you out from ranging market (quiet and ranging).

The danger would come (theortically) from Ranging and volatile market conditions.

(However a lot depend how you will set - up the treshhold filter, making it more or less permissive, if you make it very permissive you will make more money when there are clear directionnal impulses but less money when the market is turning to ranging periods)

There is one more thing. There is a possibility to setup a time filter. That is very important because you can set and test and trade only when there are predictied daily periods of high volatility.

## Comments

This is a great EA

alo, if you would like to create such stuff in MQ5L, there is a thead :

for this http://www.mql5.com/en/articles/347

I was checking the PFE mod indicator, the modifications are so substantial that I would not even say that it has anything similar with the Original PFE (polarysed fractal efficiency). However it can be replaced with just anything. I like this PFE because it is smooth and very light on the backtesting. As the expert is not interested into the intrabar dynamics it is OK to test it with open prices.

ok PFE is smooth and light on the backtesting, john, did you try PFE(1), PFE(2), PFE(3), PFE(4) ?

it's amazing, I will put the result now

No I did not. Recently I compared the pfe, the ergodic and the entropy math within the same EA. The results obtained were quite similar, nevertheless I found the PFE a little bit better.

BTW, I noticed similarities betwwen RSI and PFE in the code;

for RSI, calculation is :

int k=Bars-2;//---- initial accumulationwhile(k>=i){rel=Close[k]-Close[k+1];if(rel>0)sump+=rel;elsesumn-=rel;k--;}positive=sump/RSIPeriod;negative=sumn/RSIPeriod;for PFE, the old calculation is :

while(i>=0){noise=0.000000001;for(k=0;k<PfePeriod;k++){noise=noise+MathAbs((Close[i+k]) - (Close[i+k+1]) );}PfeBuffer[i]= (( Close[i]) - (Close[i+PfePeriod]))/noise;i--;}

andf the one I put in PFEBESTfor (int i = counted_bars - 1; i >= 0; i--){pfe1 = MathSqrt(MathPow(Close[i] - (Close[i + PFE_period]), 2) + MathPow(PFE_period, 2));Sum = 0;for (int count = 0; count < PFE_period; count++)Sum += MathSqrt(MathPow(Close[i + count] - (Close[i + count + 1]), 2) + 1.0);}

The only difference between RSI and PFE (outside the noise resolution by mathsqrt of mathpow ) is the value of the bars :the RSI_calcul

=Close[k]-Close[k+1];the PFE_calcul=Close[k]-Close[k+PfePeriod];==> The RSI is a Smoothed PFE with PfePeriod = 1 !So, RSI reveals the strength of the market, the PFE shows the direction. It's just a question of the shifted numbered of barsI don't know if you understand me, but I jsut found the confirmation of using fractals

The difference , is just a question of the number of shifted bars.

This is a confirmation of using fractals and associated elements to fractals like fractals dimension and so on.

The next step is to figure out how to calculate pockets

of predictability using fractal dimension treshold (as you wrote on top)

It's like calculate sub-dimensions , the problem is what to determine :- sub dimension of correlation matrix ?

- or sub-dimension of fractals behavior ?

Luis Princ just found that fractals can help for fetching reversal points. (always w/ PFE) ! yep, this is a very good news!

Hi, this code exactly mirrors the fractal scalper. However in the entropy scalper we use entropy indicator and in the fractal scalper we use the iVAR or the FGDI.

The concept is exactly the same.

Basically this EA follows the KISS (Keep It Simple Stupid) concept à la lettre.

This EA was build because in a number of forums I was talking about fractal break - outs. Then finally I was asking myself it this is real or just an illusion. The only way was to make a very simple system that will test the idea. The system is measuring drop in the fractal dimension for two consecutive bars. Then when we have a drop below a specified treshhold we take a directionnal trade using the local momentum.

Basically:

1. We look for predictavility

2. When we have a sufficient level of predictability we follow the momentum.

All the additional work is to replace the momentum indicator by a neural networ using as input momentum indicators with different settings.

That is how the idea evolved.

If you add other ideas that will make a completely different thing that will ask a name for itself.

Yes

1) predictability (w/ all the stuff we have here on this forum)

2) Momentum (yes, or may be volatility or viscosity of the market)