About Us

Executive Editor:
Publishing house "Academy of Natural History"

Editorial Board:
Asgarov S. (Azerbaijan), Alakbarov M. (Azerbaijan), Aliev Z. (Azerbaijan), Babayev N. (Uzbekistan), Chiladze G. (Georgia), Datskovsky I. (Israel), Garbuz I. (Moldova), Gleizer S. (Germany), Ershina A. (Kazakhstan), Kobzev D. (Switzerland), Kohl O. (Germany), Ktshanyan M. (Armenia), Lande D. (Ukraine), Ledvanov M. (Russia), Makats V. (Ukraine), Miletic L. (Serbia), Moskovkin V. (Ukraine), Murzagaliyeva A. (Kazakhstan), Novikov A. (Ukraine), Rahimov R. (Uzbekistan), Romanchuk A. (Ukraine), Shamshiev B. (Kyrgyzstan), Usheva M. (Bulgaria), Vasileva M. (Bulgar).

Additional Information


Login to Personal account

Home / Issues / № 5, 2016


Anantchenko I.V., Kamashev A.O.

There are different trading strategies for trading on the international Forex market. They differ in term between opening and closing orders, ability to work at the same time using only one or more opened orders, work in conjunction with one or more trading tools, etc. Trading strategies are designed for manual trading, partially automated trading (for example, trader just opens orders, but tracking orders and closing carried by special programs) and fully automated trading. Trading strategies can be implemented as specialized software for the trading platform provided by the dealing center (DC), working with them to traders. Currently, trading platform Metatrader version 4 (MT4) and 5 (MT5) is very popular with traders who trade on the Forex market. It should be note that there are other trading platforms, including more convenient and advanced features for testing trading strategies, for example, TSLab (www.tslab.ru) - platform to create and run automated trading systems. However, if the trader for some reasons prefer to work with a particular DC, providing only the MT4 platform (metatrader4.com) and / or MT5 (metatrader5.com), the choice of software is only limited by the tools, which is supported by the data terminals trading platforms. Terminals MT4 and MT5 include software Tester strategies that can be used for testing and optimization of trading robots, as well as for testing of manual trading strategies by using test mode visual fictitious trading robot - "cap" (for example, void OnTick () {return ;}), that allows you to work with the timetable display changes of a financial instrument. "Current quotations value may differ significantly from its market valuation, reflecting the market idea of its value. This is due to the presence of statistical fluctuations due to the large number of wholly or partly uncontrollable factors" [1]. “The processes of change in quotations of currencies, stocks, raw material, and quotations of other assets in various capital markets became one of the vivid examples of chaotic dynamics. Hundreds of thousands of traders throughout the world are round the clock trying to forecast direction of currency instruments by time intervals in the range from several hours («scalping») to months and even years (the processes of strategic investment). More than 90% of traders are being ruined eventually. However, a few traders are still able to find weak links of order in chaos and steadily earn more than considerable capitals on their basis. This, in turn, means that the process of evolution of quotations is not pure chaos and holds local ordered segments in its structure. Two types of infrastructure and market data analysis are mainly used to detect these segments: Fundamental and technical” [2]. The issue of constructing methodically competent system of optimization for trading strategies is difficult, as the dynamics of change of quotations of trading instruments depends not only on the system part x1, but also from random (chaotic, unpredictable) component x2. The proportion of components x1 and x2 can change considerably over time, and assessment of the impact in real time is a difficult task, for which an exact solution is impossible, and can only be a probabilistic assessment. It should be in mind that under the influence of fundamental factors pattern of market behavior in general changes over time. Previously identified laws operating completely or fully incorrect. The optimization problem is to find the coefficients p1, p2, ..., pn, giving the most accurate values for the function f (t, p1, p2, ..., pn), predicting dynamics of the trading instrument quote values in the time t. May take into account parameters such as the closing of the order when the value of a given income level or when the maximum value of the loss, etc. (Parameters z1, z2, ..., zn). Selecting the best solution of the problem parameters p1, p2, ..., pn and z1, z2, ..., zn by varying them with the performance evaluation function f values obtained in practice, as a rule, does not give a positive result, because there is no optimization, and "adapting for the history." This is explained by two factors:

1) insufficient volume of processed values of quotations used trading instrument (quotations archive data can be downloaded, for example, on http://www.forextester.com/data/datasources or http://www.finam.ru/ analysis /quotes/)

2) the amount of the analyzed data is too redundantly - for example, the entire array of data can be considered as the union of two arrays that contain quotes of the financial instrument for the state of the market, "one" and "two", respectively.

If the market is currently in a state of "two", the use to optimize data state of "one", will lead to the fact that the values of p1 parameters are found, p2, ..., pn and z1, z2, ..., zn, which do not allow to obtain profit from trading or profit margin will be significantly less than it could be. With this in mind it appears correct neither use expert assessments that identify the global long-term market conditions, when stored in the general current market trends and, given the fact that to obtain such assessment is quite difficult both objective and subjective reasons, to enter variable r or r(t) function, which allows to take into account the different impact of the new and the old (for example, those that probably had a different pattern of the market) data. Recent findings consider being more significant. Thinking about it, we can assume that for the evaluation and optimization of trading strategies, there is no need to use the entire archive of historical data of the analyzed financial instrument, data for retrospective analysis may be limited to a period of the past few years. The second conclusion is resulting need of continuous performance optimization parameter settings used by trading robots. An example of one of the possible optimization schemes. Select the starting point, for example, 12 months before the current date, and then optimize the trading robot parameters for 3 consecutive months. It is necessary to estimate profit (loss) for trade for the 4th month with optimized parameters, and then optimize the interval following 3 months and estimate profit (loss) for the next month, etc. If the parameter values found for the different periods of 3 months, do not differ greatly, as well as the size of the profits, it may indicate that the optimization performed correctly, otherwise it is necessary to perform an additional analysis of the data and will likely review the trading strategy used. At the stage of development and testing of the trading system, which algorithm is implemented in software as a trading robot, it is necessary not only to identify the signals to open orders (buy or sell), but also to determine the order that will close the order when it reaches a predetermined level of profit (Take Profit - TP) or loss (Stop loss - SL).


Figure 1 - candlestick patterns that determine the signals to buy (A) or sale (B) trading tool

In view of the chaotic component of the market it is accessibly that part of the open orders will be closed with a loss, and total profit can be obtained only if the sum of all closed with orders profit exceeds the total amount of the loss (taking into account all the other costs for the trade, for example, commission, spread, and so on). Often the ratio of TP to slots SL is set as 3 to 1, but can vary within wide limits depending on the characteristics of the trading system used, for example, in Fig. 1 shows that the SL could be defined as the maximum or minimum value of the previous candle. The task was to develop a robot program for MetaTrader 4.0 trading platform terminal, trading on the basis of the analysis of candles: o0 -Price opening current (zero) candles, l1 - the minimum value of the first candle (Low [1]), l2, l3, l4 - 2 , 3.4-x, respectively. h1 - the maximum value of the first candle (High [1]), h2, h3, h4 - 2, 3, 4-x, respectively. The opening price of the first candle - o1 (Open [1]), o2, o3 - 2,3-x. The closing price of the first candle - c1 (Close [1]), the second and third - c2 and c3. Presented in Fig. 1. The signals for the opening of an order to buy or sell implemented lines of code: the order opening a buy signal if ((h4> h3) && (h3> h2) && (h2> h1) && (l4> l3) && (l3> l2 ) && (l2> l1) && (o1 c2) && (o3> c3) && (l2 c1) && (h2> o1) && (h2> c1) && flag == 0) .... Partly flag - introduced to open only one order, the second will not be open until the close of the first. The value of TakeProfit - sets the level of closure orders on reaching a predetermined number of pips, stop_loss_auto (default true) - warrant closing level since a loss is determined dynamically (depending on the type of signal, high or low of the previous candle) if stop_loss_auto is set to false, the value of the closing level of orders at a loss is determined by the setting of StopLoss in points. Magic Setting - Specifies a unique identifier ("magic") number of orders, opened according to trading robot.

The archives are available for download via the link http://mctrewards.ru/files/pattern.zip, there are two initial code pattern.mq4 and pattern-invert.mq4 trading robots and compiled (ex4) files. Trading robot pattern-invert.mq4 implementing a strategy which presented in Fig. 1 sell signal is regarded as a signal on a package and vice versa. Ability to work with the source code of programs enables a relatively small time-consuming to make changes in the program code, by adding additional checks on conditions or changing existing ones. You can add conditions, for example, the control of Money Management (Money Management) - a set of rules and specific techniques, both aimed at minimizing risks and maximizing profits; the possibility of implementing protection of the profits - "pull-up" for the transfer of StopLoss of an open order to breakeven, etc. It should be noted that the programs show different profitability level depending on the order in what timeframe (M1, M5, M30, H1, H4) work and what trading instrument as well as depending on what value stop_loss_auto, TakeProfit and StopLoss used.

Optimal settings have been established on the results of the optimization for two developed trading robots for different trading instruments (AUDJPY, AUDUSD, CHFJPY, EURCAD, EURCHF, EURGBP, EURJPY, EURUSD, GBPCHF, GBPJPY, GBPUSD, NZDJPY, NZDUSD, USDCAD, USDJPY, USDCHF, XAGUSD and XAUUSD).

1. Simulation of a chaotic process, based on the criterion of utility. Ananchenko I.V., Musaev A.A. In: Seventh All-Russia scientific-practical conference "Simulation Theory and Practice." (IMMOD 2015). 2015. P. 142-147.

2. Management Strategy for Mechanical Trade Systems: Brief Review. Musaev A, Anantchenko I, Gazul S, Int J Econ Manag Sci 2015, 4:9. http://dx.doi.org/10.4172/2162-6359.1000284

Bibliographic reference

Anantchenko I.V., Kamashev A.O. SOME FEATURES OF TESTING TRADING STRATEGIES FOR FOREX TRADING. International Journal Of Applied And Fundamental Research. – 2016. – № 5 –
URL: www.science-sd.com/467-25090 (06.06.2023).