Download MetaTrader 5

New article - Trader's Statistical Cookbook: Hypotheses

To add comments, please log in or register
Have you developed an application? Publish it in Code Base!
MetaQuotes Software Corp.
MetaQuotes Software Corp. 2015.02.10 06:32 

New article Trader's Statistical Cookbook: Hypotheses has been published at

This article considers hypothesis - one of the basic ideas of mathematical statistics. Various hypotheses are examined and verified through examples using methods of mathematical statistics. The actual data is generalized using nonparametric methods. The Statistica package and the ported ALGLIB MQL5 numerical analysis library are used for processing data.

Any trader willing to create their own trading system is going to become an analyst sooner or later. They are permanently trying to find market trends and testing trading ideas. Testing an idea can be based on different approaches - from a usual search of best parameter values in the optimization mode of the Strategy Tester to scientific (sometimes pseudo scientific) market research.

In this article I suggest considering statistical hypothesis - an instrument of statistical analysis for research and inference verification. Let us test various hypotheses with the Statistica package and ported numerical analysis library ALGLIB MQL5 using examples.

2. Testing Hypotheses. Theory

The hypothesis to be tested is called a null hypothesis (Н0). A competing hypothesis (Н1) is its alternative. It is on the flip side of the Н0's coin, i.e. it logically refuses the null hypothesis.

Imagine, that there is a population of data on Stop Losses of some trading system. We are going to state two hypotheses making a basis for testing.

Н0 – average Stop Loss value equal to 30 points;

Н1 – average Stop Loss value not equal to 30 points.

Variants of acceptance and rejection of hypotheses:

  1. Н0 is true and it is accepted;
  2. Н0 is wrong and it is rejected in favor of Н1;
  3. Н0 is true but it is rejected in favor of Н1;
  4. Н0 is wrong but it is accepted.

The last two variants are connected with errors.

Now the value of significance level is to be specified. It is the probability that the alternative hypothesis will be accepted whereas the true hypothesis is the null one (third variant). This probability is preferable to be minimized.

In our case such error will occur if we assume that Stop Loss at the average is not equal to 30 points even though that it actually is.

Usually the significance level (α) is equal to 0.05. That means that the test statistic value of the null hypothesis can populate the critical region in no more that 5 cases out of 100.

In our case the test statistic value will be evaluated on a classical chart (Fig.1).

Fig.1 Test statistic value distribution by normal probability law

Fig.1. Test statistic value distribution by normal probability law

Author: Dennis Kirichenko

To add comments, please log in or register