Statistical trading with normal distribution

 

Every instrument has its own price distribution, in this article I deal with the fact that a normal distribution (also known as a bell curve), can give us a tip at where the price could go in the next few bars. I will use some distribution formula to draw bell curve right into ProRealTime charts.

Plotting a normal distribution of the instrument

A mathematical distribution is a simple representation of the price behaviour around a mean. There are a lot of distribution of price that can be found, what we want here is to find the best mean of price over a large timescale, because a good statistical approach mean a lot of information.

A normal distribution of price :

normal distribution

What we can observe here is that when the price derivates a lot from its mean, it will not be there too long, because each segment of this distribution plot is a cumulative of the price position over the study period (as much barindex as your ProRealTime chart is actually showing).

XLE ETF SPDR plot distributionSPDR S&P 500

Different instrument (SPDR XLE and SP500 ETF) show different normal distribution. Each bar in the plot represent a 1 percent deviation of the price from its mean. On the Y axe, we have the percentage of this deviation representation over the whole study.

Building a channel where 80% of the price is living

A simple channel could be build upon what we observe through our price distribution. If the price is living 80% into the channel, we can assume that if the price exceed this deviation limit it could :

  1. revert to the mean
  2. continue in that direction, outer channel

price distribution 80 percent

As for the XLE ETF, we find that a 5% deviation from the mean has 80% of the price distribution, so we can draw a channel with an upper and a lower band made of this observation:

price channel deviation

Nope, it’s not magical, it’s statistical! 🙂

Of course, price doesn’t always revert to its mean quickly and that’s where is the major con of this strategy :

mean reversion dont work either

Different timing/period for a better entry?

Well, no one will never know where the price will be in a hour or even in the next few minutes. So while there are different manner of dealing with losing trade (averaging down, martingale, ..), I would prefer to take my loss and go on next trade. There are no easy path to follow when you are trading counter-trend and I’m not gonna tell you that this kind of strategy is the better approach for “easy” trading 🙂

In that specific losing trade, a tip would be to re-enter, this time in the trend direction, just below your previous candle entry, this time to follow the herd like a good sheep 🙂

trade re entry after losing trade

To conclude..

Of course I assume in my example that a 50 period linear regression is the best mean to trade this statistical strategy. It could be a part of another study, finding the best mean for each instrument, maybe .. I’m looking forward for react about this article, how to optimize it and find an edge about it, dealing with losing trade, etc. Anyway, you’ll find the different files at the bottom of the post, the distribution indicator and the channel one.

Share this

  1. Wilko • 03/17/2016 #

    Thank you for an interesting post and for the code

  2. Kenneth Kvistad • 03/17/2016 #

    hi.. how do I get the indicator laying over my price chart?

    • Nicolas • 03/17/2016 #

      Use the wrench of the price chart when you want to add indicator on it.

  3. Tartesso • 03/17/2016 #

    distribution-plot, it seems a great indicator, someone has trouble opening it on your pc, is it my problem is to solve it.

  4. Salocin • 03/17/2016 #

    Hi, Distribution Plot is shown as a flat line at the bottom in the indicator window and also in the Chart window. Any Idea, what to do?
     
    Thanks in advance
    Salocin

    • Nicolas • 03/17/2016 #

      You must change the date in the code where your want the distribution to be plotted (actually it’s somewhere between October and November 2016).

  5. dddjean • 03/17/2016 #

    Bonjour à tous ! Utilisation de la loi normale est très pertinente. Pourriez vous ainsi m’aider à télécharger ”distribution-plot” et ”lr-percentage-deviation-channel”
    ?

    • Nicolas • 03/17/2016 #

      Ces fichiers sont à importer dans votre plateforme après avoir été téléchargé sur votre ordinateur.

  6. dddjean • 03/17/2016 #

    Car impossible d’ouvrir le fichier itf

  7. dddjean • 03/17/2016 #

    Merci beaucoup Nicolas !

  8. Gianluca • 03/17/2016 #

    Great did you worker again on this?

avatar
Register or

Top