Table of Contents

Forex - Probability

Trading is thinking in probabilities and finding setups that make money.


Positive Expectancy


Probability

                Profitable Trades
probability =  -------------------
                 Total Trades 

Example

Suppose that you have made nine trades, six of which turned out to be profitable.

                 6
probability =  -----  =  67
                 9

What is the probability of winning for a future trade?

                (6+1)            6
probability =  -------   or   -------
                (9+1)          (9+1)

Using the average of these values, has the estimate of the probability of winning as follows:

                 6 + 0.5
probability =  ----------  =  0.65
                  9 + 1

NOTE: This is slightly less than the original value of 6/9.

  • This method is called Laplace smoothing.

Smoothing using Weights

double value=price[i+center], // Price value at the center.
       max=_Point;            // Maximum deviation.
 
for(int j=0; j<period; j++)   //Calculate price deviations from the central one and the max deviation.
{
  weight[j]=MathAbs(value-price[i+j]);
  max=MathMax(max, weight[j]);
}
 
double width=(period+1)*max/period,  // Correct the maximum deviation from the center so that there are no zeros at the ends.
sum=0,
denom=0;
 
for(int j=0; j<period; j++)  // Calculate weight ratios for each price.
{
  if (Smoothing==Linear)  // Linear smoothing.
    weight[j]=1-weight[j]/width;
 
  if (Smoothing==Quadratic)  // Quadratic smoothing.
    weight[j]=1-MathPow(weight[j]/width, 2);
 
  if (Smoothing==Exponential)  // Exponential smoothing.
    weight[j]=MathExp(-weight[j]/width);
 
  sum=sum+weight[j]*price[i+j];
  denom=denom+weight[j];
}
 
buffer[i]=sum/denom;  // Indicator value.

References

https://www.mql5.com/en/articles/11627