A mechanical trading system for the EURUSD currency pair

P. A. Kryukov, Kemerovo

We consider a mechanical trading system for the EURUSD instrument, which implements a trading strategy, the formal basis of which is a statistical model for analyzing and predicting the dynamics of the exchange rate - an indicator of the probability of an uptrend/downtrend.

Introduction

With the development of computer technology and communications, and the advent of the Internet, it became possible to automate the decision-making process in the form of mechanical trading system (MTS) of the traderThe first of these is a system that allows us to formalize trade rules, scientifically substantiate the elements of the adopted trading strategy (TS). Research, the experience of creating predictive MTS in financial markets is practically not presented in the scientific literature.

A detailed description of the methodology of modeling the dynamics of the exchange rate under the new approach, a rigorous justification of the models are given in the author's previous work (see below). The stage of preliminary testing of the models revealed three models with different compositions of variables suitable for further research. Let us briefly consider the application of one of them to the construction of an effective TS in the Forex market and its implementation in the form of MTS in the environment MetaTrader 4 terminal (H1).

Logit is used to develop and identify the model - regression. The application of the probability integral as a transformation of some linear function allows to obtain the result in the interval from 0 to 1. To prove the adequacy of the market model standard statistical criteria and procedures of the software package SATISTICA 6.0 were used. To assess the quality - the tool ROC - analysis. The structure of the indicator is a general index, describing the multiple classification of signals from different known indicators, oscillators and indices of various indicators of the dynamics of the exchange rate (model variables), expressing the coincidence of signals to identify the current dynamic behavior of the instrument price.

Model description

As a result of the preliminary analysis, the following were selected the following variables (factors). As a dynamic indicator of volatility relative to the average level at time t (yield volatility) we take linear deviation of logarithmic increments of exchange rates, to the value of which, the transformation was applied . In the model it is a variable corLinOtkle.

RSI Oscillator no lag The value of dR= (RSI(8) - MA(8)) shows upcoming trend reversals. The value of dR= (RSI(8) - MA(8)) →0 gives the oscillator crossing its average MA(8) and warns of a price reversal. In the model it is the variable RSI_100 (dR/100). The sign of the indicator value identifies the trend direction: "+" - uptrend, "-" - downtrend; the change of the sign and the value close to zero warns of a trend reversal.

To identify pivot points and trend areas, we use the average growth and growth rate of the closing price for the last n=10 bars. In the model it is the variable korCrGrowth, to which the transformation has been applied. The sign of the indicator value identifies the trend direction: "+" - uptrend, "-" - downtrend; the sign change warns of trend reversal. For an uptrend/downtrend, the average growth (closing prices for the last 10 periods) increases as the price rises/declines and decreases when the price corrects. The formulas for calculating the values of the variables are given in the author's work mentioned above.

The following probability indicator model has been developed:

,

.

The significance level p for the corresponding t-statistic for the model coefficients is taken to be p=0.00000.

At the stage of preliminary study of the model with ROC-analysis the value of the cutoff threshold p=0.5 was obtained.

Description of the strategy

The concept - trading along the trend (without cutting off the flat). Opening/closing a position - on a model signal. Stops, filters are not used. Entry to Buy - the current probability pt>p (greater than the threshold value). Entry to the sale - the current probability pt<p (less than the threshold value). Tactics used - Trade in one order: the opening of a new order on the next tick of the price after the previous one is closed, that is, a check for confirmation of the trend reversal signal.

The strategy is programmed in the MetaEditor in MQL4. We developed MTS, an Expert Advisor that is able to execute trade operations in real time. Fragments of EA code are shown on fig. 1 - opening a position and fig. 2 - closing a position to buy on the indicator signal. Trading is done with 1 lot, initial deposit - $10000, no commissions, other terminal settings - standard.

Strategy testing

According to Pardo, the forward window is chosen to be 6 months long. In his opinion, it is enough to conduct 12 tests and if 50% of them are profitable, the system is ready. Fourteen tests have been conducted. The entire price history (hourly data) from June 1, 2004 to July 1, 2011 is divided into 14 semiannual intervals of research.

forex expert

Fig. 1. Opening a position by the signal of the model

forex expert

Fig. 2. Closing a position by the model signal

For the criterion of TC stability achievement of annual profit not less than 15% (average value of bank deposit) on a wide range of market conditions, and ability of TS to adjust to new market conditions as a result of optimization without updating parameters (coefficients) of the market model is accepted. The criterion of the model fitness for the future is the optimal probability threshold, statistical significance of the results and acceptable performance of the TS. To test the strategy the following is used forward analysiswhich consists of two steps: optimization on a certain interval of the price history and testing (trading) on a new interval, which is not included in the optimization interval, then again optimization on the loss intervals and testing outside the optimization interval, etc. The main results of the research are as follows:

Testing on the interval of model building with the threshold value of p=0.5 confirmed the conclusions of model verification at the preliminary stage of the study and showed the workability of the strategy, although the results can not be called excellent (low value of profitability indicators).

Optimization on the first interval (01.06.2004 - 01.12.2004) allowed to improve the result (pass 11, optimal threshold p=0,01).

Forward analysis (simulated trading) on the remaining intervals from 2 to 14 with this threshold showed the profitability of the strategy on 10 intervals out of 14 (70%). This is a good result, according to Pardo, The strategy is ready for real trading.

The graph of the curve of TC capital for p=0,01 for the period 1.06.2010 - 1.07.2011 is presented in figure 3. The graph shows the unevenness of the curve, however the upward trend can be clearly seen. The unevenness can be explained by trading during the flat, possible misclassification of the dynamics exchange rate during this period. TS results: net profit - $19848.00; profitability - 1.27; average annual earnings - 183.21%; number of transactions - 268, including 132 profitable (49.25%); maximum drawdown - 39.45%.

expert work statistics

Figure 3. TC capital graph

Assessment of statistical significance and performance of MTS

Results of statistical analysis of the average profit/loss per transaction: total transactions -268; winning transactions -132 (49.25%); sample mean - 128.6851; sample standard deviation (SD) - 1313.4636; expected mean SD - 80.2326; t-test (profit/loss>0) - 1.603900866; degrees of freedom -267; probability (p) - 0.9452; statistical significance (1-p) - 0.0548.

Analysis of the confidence interval of the probability of a winning transaction as a percentage: initial data for the function CRITBINOM: total trades - 268; winning trades - 0.4925; probability - 0.99; result: the smallest value for which the integral binomial distribution is greater than or equal to the given criterion, the percentage of profitable trades - 151; the upper 99% bound is 0.563432836; the lower 99% bound is 0.421641791.

In this case the probability (significance) of the average profit/loss per trade is 0.0548, i.e. when tested on independent data the ineffective strategy would show the same profit as when tested, only in 5.48% cases. With a probability of 99% we can say that the percentage of profitable MTS trades in the future will be between 42 and 56.

Conclusions

The model has confirmed its suitability as a mathematical support for the trading strategy. The MTS is robust to random changes in the market over a wide range of market conditions (uptrend, downtrend, sideways trend) and is suitable for real trading in the future.

List of references

1. Kryukova V.V., Kryukov P.A. Statistical Forecasting of Exchange Rate // Vestn. Kuzbass State Technical University, 2010, № 6. С. 178-188.

2. Pardo R. Development, Testing and Optimization of Trading Systems for Stock Trader / Translated from English: Alpina Publisher, 2002. 221 с.

3. Kryukova V.V., Kryukov P.A. Statistical Forecasting of Exchange Rate // Vestn. Kuzbass State Technical University, 2010, № 6. С. 178-188.

4. Pardo R. Development, Testing and Optimization of Trading Systems for the Exchange Trader: Translated from English: Alpina Publisher, 2002. 221 с.

Leave a Reply

Back to top button