Wednesday, May 6, 2009

From Bollinger to Fractal Bands

Bollinger Bands indicator is a well-known and interesting indicator, as it provides with entry and exit points. It basically consists in a MA and two bands above and below it. Each band is classically placed at 2 standard deviations away from the MA. If we assume that price variations follow a normal distribution, this ensures that 95% of the prices will fall within the bands.
______________________________________________________________________________________________________

I-Some theoretical points

Keeping this assumption for now, the time-series of price variations can be described by a Wiener Brownian Motion of normal distribution N(0,t). It is interesting to see the probability of the prices to be within the bands is equal to the probability of the maximum of the price (that we will name M(t)) to be within them, as shown below:



For more details and the justification of this formula, see my other blog.
We then see:



Such probabilities are calculated for the theoretical value of the standard deviation of the WBM, the Bollinger Bands, however, calculates an empirical value for it using the well known formula:



Given this practical σ and the theoretical one, we can equate the two:



And knowing the theoretical standard deviation for a FBM (see there), we get the practical standard deviation for FBM (of Hurst parameter H):




II-Implementation of Fractal Bands

A straightforward way to implement Fractal Bands seems to just take classical Bollinger Bands and merely increase the width of the bands by raising the standard deviation to the power of 2H. However, if we do that, here is what we get (the MA is the FRASMAv2, the reference period is 30, the blue bands are Bollinger Bands for the same speed) :



I don't find this indicator very useful (not useful at all actually, for me). It seems necessary here to get some perspective about how we wish to improve on the Bollinger Bands. From my point of view, as a day trader, I feel Bollinger Bands too narrow, the prices hit them too often, especially in a trending market, where I would like to get a clear signal only when the trend is over. But, with Bollinger Bands, most of the trend occurs outside the bands, prompting me to close the trade much too early and basically inciting me not to ride the trend.
Applying equation (1) however, we get the counter-productive effect of narrowing the bands when in a trend, because, in our case of price variation, the standard variation is much lower than 1(this may not be the case for stock exchange, but it clearly is for FOREX), raising it to a higher power therefore decreases its value proportionally.
A way out of this quandary is simply to apply the following treatment to the standard deviation from the Bollinger Bands instead of the one from (1):



By taking α greater than 1, the higher our H, the wider the bands will be, here is what it leads to (with the same setup as before, and α=2):



The script fractal_bands.mq4 can be downloaded from this address from the MQL4 site.
The input parameters of the indicator are as follows:
e_period (integer): This is the period considered for calculating the fractal dimension, default is 30.
normal_speed (integer): This is the speed of the SMA before being modified to become the FRASMA, default is 30.
alpha (real): This is the alpha from equation (2), default is 2.
shift (integer): This is the number of bars the FRASMA is shifted to the right(positive) or to the left(negative), default is 0.
e_type_data (0,1,2 or 3): This is the type of price the indicator will consider (0=CLOSE, 1=OPEN, 2=HIGH, 3=LOW), default is 0.


III-Strategical considerations

I have started using the Fractal Bands indicator, and am very happy of it so far. The strategy is quite straightforward.
I enter in a BUY position after the price have rebounded (after touching it) from the lower band and crossed the FRASMA, my Stop Loss is then set to the level the prices hit the lower band, and my Take Profit is when the prices hit the higher band.
Symmetrically, I enter a SELL position after the price have fallen from the higher band (after touching it) and crossed the FRASMA, Stop Loss set at the level of the hit of the higher band, and Take Profit when the lower band is hit.
It is obviously possible (and even advised) to make your Stop Loss trailing the price changes.
I used this strategy for EUR/USD on a 5 minutes timeframe, using it on other timeframes or on other instruments may require a different setup, mine was to set the speed of the FRASMA at 30, and α=2 (in equation (2) above), it is possible to change these values.

9 comments:

Unknown said...
This comment has been removed by the author.
xsnowing said...

Hi, JP,

I made a simple EA with the strategy you mentioned above last weekend.

the EA; takes only 1 position in 1 time with SL/TP as you said.

it works very well with default setting for eur/usd pair in 2009/01 - 2009/05. but not stable in 2008/5-2008 year end.

also for other major pairs in 2009, not better than eur/usd but net profit is plus.

maybe my implementation still has bug or we meet the same problem as other MA indicators do...

will debug the EA for a while and let you know the result.
---
xsnowing

Unknown said...

Could you make a "fractalized" version of Stochastic RSI? :)

Jean-Philippe said...

Hi xsnowing,

Thanks for your remarks on the EA. I am still looking at a more performing strategy than the one I mentioned on the post.

And don't hesitate to publish your EA on some metatrader site when you feel good about it.

Cheers

JP

Jean-Philippe said...

Hi Zood,

I actually never really thought of a fractalised RSI.

Immediately though, all those signals (Momentum, RSI, stochastic) are smoothened version of price variations, in one way or another, but the readability gained by the smoothing is at the expense of the information embedded in the chaotic variations, and it is this information that is precisely retrieved by fractal geometry.

So I am not sure whether we can do anything involving fractals at the level of RSI (or any other such indicators) which are already free from chaotic behavior somehow and therefore from what fractal geometry clarifies, as of now anyway, I don't see how.

Such is my intuition, at this point, but if you feel good about it, you are perfectly justified to research further in this direction.

Cheers

JP

xsnowing said...

Hi, JP

I read your fractals bands again and tried to add a PRICE_TYPICAL price chain to calcuate fractal properities. It works almost like the original seems a bit better than only using 1 price. because it included more price fluctions inside.

Maybe I can email it to you, your yahoo account? Since the above is pretty simple change, think you can implement it soon.

However they are almost same should enhance the performance more.
---
xsnowing

Jean-Philippe said...

Hi xsnowing,

Yes, email is fine, or you can also publish it on your blog (I saw you started one), or both, as you wish.

cheers

JP

Blogger said...

Hello Everyone,

I've included a list of the highest ranking FOREX brokers:
1. #1 Forex Broker
2. eToro - $50 minimum deposit.

Here is a list of the best forex instruments:
1. ForexTrendy - Recommended Odds Software.
2. EA Builder - Custom Indicators Autotrading.
3. Fast FX Profit - Secret Forex Strategy.

I hope you find these lists beneficial...

Forex Signals said...
This comment has been removed by the author.