Download MetaTrader 5

Math and Forex - Please take a moment to read.

To add comments, please log in or register
jester2630
7
jester2630  

So a mathematical law was recently brought to my attention called "Bayes Law".

Bayes Law:

Basically a statistical probability calculation based on a set of predefined variables (or historical data) which calculates the statistical probability of event A when event B is true.

The reason I'm interested in this calculation:

I want to study when a candle is X pips in size, what is the probability that it will make it to Y pips in size.

For instance, When I look at the 1hr time frame, I want to know what the probability of a candle that is 25 pips in size will make it to 30 pips in size. I would like someone with indicator coding expertise to create an indicator that can do these calculations for me. I believe I have figured out how to do the math (see below), I just need it to be incorporated in an indicator format. What this will allow any user to do is determine when to enter the market and how may pips to take with high probability. I feel this tool could be useful for both scalping and longer term trades. Could someone please review the information below and let me know how possible this idea is. I think there is some huge potential but I lack the coding knowledge to test it.

My concept that needs to be applied to MT4 coding:

Bayes Law Equation:

P(A|B) = P(B|A)*P(A) / P(B)

Definitions:

P(A|B) = the probability of A, if B is true

P(B|A) = the probability of B, given A is true

P(A) = the probability of A, or how often does A occur?

P(B) = the probability of B, or how often does B occur?

User input Parameters:

Number of candles

Study candle range

Target pip profit

Formula:

Count number of candles within "number of candles" whos range is equal to or greater than "study candle range" parameter. Return a number that defines A. Then compute A/"number of candles". This solution defines P(A).

Count number of candles within "number of candles" whos range is equal to or greater than "study candle range" + "target pip profit". Return a number that defines B. Then compute B/"number of candles". This solution defines P(B).

Then compute P(B)/P(A). This solution defines P(B|A).

Then compute P(B|A)*P(A)/P(B). This solution defines P(A|B).

Then display results on the chart.

Items to display on the chart:

"Number of Candles"

"Study Candle Range"

"Target Pip Profit"

"P(A|B)"

Thanks in advance for everyone's input.

To add comments, please log in or register