IMPLEMENTATION OF A TRADING ADVISOR FOR THE METATRADER 5 MULTI-MARKET PLATFORM
Abstract
The article describes the process of creating a flexible trading strategy for algorithmic trading in a specialized development environment MQL5 IDE in the MetaTrader 5 multi-asset platform. The advantages and expediency of using the MetaTrader 5, MetaTrader 4 platforms and their respective trading applications Trade Assistant, Forex Trade Manager, Trade Time Manager, CAP Gold Albatross EA and Fast Copy are shown. A comparative analysis of the existing implementations of trading advisors based on various indicators, as well as those created using intelligent technologies, has been carried out. In the previously implemented trading advisors, for predicting the prices of the volatility of financial assets, flexible learning algorithms, compensatory fuzzy logic models, and technical analysis tools are mainly used, which entails high time costs, in conditions of high financial market volatility. To solve this problem, the authors propose an integrated approach based on the use of technical analysis tools built into the MetaTrader 5 multimedia platform and the trading strategy automation algorithm, which makes it possible to obtain a forecast of a given accuracy for the selected instrument in real time. The paper substantiates the need to introduce elements of automatic trading when analyzing the quotes of financial instruments and managing a trading account in order to avoid mechanical, analytical, organizational and psychological mistakes made by traders. The study shows step by step the process of creating, debugging, testing, optimizing and executing the implemented trading advisor. An algorithm for automating a trading strategy has been developed and its block diagram has been presented. The initial data for the trading strategy automation algorithm are determined, and the mathematical apparatus for calculating indicators of limit orders of the TakeProfit and StopLoss types is described. Since exchange trading is associated with many risks, we analyzed the impact of different values of lots of TakeProfit and StopLoss limit orders on possible profit and drawdown limit (loss). As a result, the EA worked correctly in real time without human intervention for eightweeks using two trading strategies. The results of testing the developed software allow us to draw the following conclusions: when the EA shows a high degree of recommendation, the actual financial assets show high efficiency.
References
[Technical analysis tools using Python and MetaTrader 5], Obrazovanie i nauka bez granic:
social'no-gumanitarnye nauki [Education and science without borders: social sciences and
humanities], 2022, No 17, pp. 46-52.
2. Kondratieva T.N., Rveveeva I.F. Avtomaticheskaya torgovaya sistema v klientskom terminale
MetaTrader 5 [Automated trading system in the MetaTrader 5 client terminal], Sovremennye
naukoemkie tekhnologii [Modern high technologies], 2018, No 10. pp. 56-60.
3. Kondratieva T.N. Printsip raboty trendovykh indikatorov [The principle of operation of trend
indicators], Internet-zhurnal Naukovedenie [Journal of Naukovedenie], 2013, No. 3. Available
at: https://naukovedenie.ru/PDF/63trgsu313.pdf (accessed 09/11/2022).
4. Kasparinsky F.O. Printsipy mul'titreydinga [Principles of multitrading]. Elektronnye biblioteki
[Electronic libraries], 2021, Vol. 24, No 5, pp. 808-869. DOI 10.26907/1562-5419-2021-24-5-
808-869.
5. Eremin V.V. Vybor tekhnicheskogo indikatora dlya rossiyskogo fondovogo rynka [The choice
of a technical indicator for the Russian stock market], Alleya nauki [Alley of Science], 2020,
Vol. 1, No 11 (50), pp. 97-105.
6. Nazário R.T.F., Silva J.L., Sobreiro V.A., Kimura H.A. literature review of technical analysis
on financial asset markets, Q. Rev. Econ. Financ., 2017, Vol. 66, pp. 115-126.
7. Scott G., Carr M, Cremonie M. Technical Analysis: Modern Perspectives; CFA Institute Research
Foundation: Charlottesville, VA, USA, 2016.
8. Fernandez E., Navarro J., Solares E., Coello C.C. A novel approach to select the best portfolio
considering the preferences of the decision maker, Swarm Evol. Comput., 2019, Vol. 46,
pp. 140-153.
9. Saul J., Jun M. Modeling Technical Analysis; EPSRC: Swindon, UK, 2018; Chapter 1, pp. 3.
10. Irwin S.H., Park C.-H. What do we know about the profitability of technical analysis?,
J. Econ. Surv., 2007, No. 21, pp. 786-826.
11. Market Technicians Association. CMT Level I 2016: An Introduction to Technical Analysis;
JohnWiley & Sons: Hoboken, NJ, USA, 2015.
12. Sevryugin Yu.V., Soshin N.A. Klassifikatsiya avtomatizirovannykh birzhevykh torgovykh
strategiy – torgovyh robotov [Classification of automated exchange trading strategies – trading
robots]. Aktual'nye problemy i perspektivy razvitiya ekonomiki: rossiyskiy i zarubezhnyy opyt
[Actual problems and prospects for the development of the economy: Russian and foreign experience],
2022, No 2 (40), pp. 7-11.
13. Gasimova L.A. Sozdanie torgovogo robota na osnove stokhasticheskogo ostsillyatora dlya
torgovli privilegirovannymi aktsiyami Sberbanka [Creation of a trading robot based on a stochastic
oscillator for trading preferred shares of Sberbank], Matematicheskoe i komp'yuternoe
modelirovanie v ekonomike, strakhovanii i upravlenii riskami [Mathematical and computer
modeling in economics, insurance and risk management], 2021, No. 6, pp. 47-52.
14. Dolgovskaya Yu.A. Cozdanie torgovogo robota dlya avtomaticheskoy torgovli na fondovom
rynke [Creation of a trading robot for automatic trading in the stock market], Matematicheskoe i
komp'yuternoe modelirovanie v ekonomike, strakhovanii i upravlenii riskami [Mathematical and
computer modeling in economics, insurance and risk management], 2017, No. 2, pp. 46-49.
15. Timofeev A.G., Lebedinskaya O.G. Sozdanie torgovoy programmy-robota dlya
algoritmicheskoy torgovli i birzhevykh operatsiy [Creation of a trading robot program for algorithmic
trading and exchange operations], Ekonomika i upravlenie: problemy, resheniya
[Economics and management: problems, solutions]. 2018. Vol. 4. No 4. pp. 97-104.
16. Belokonskaya E.G., Kalyagin I.I. Razvitie instrumental'nykh sredstv algotreydinga na osnove
primeneniya neyronnykh setey [Development of tools for algorithmic trading based on the use
of neural networks]. Izvestiya vysshikh uchebnykh zavedeniy. Seriya: Ekonomika, finansy i
upravlenie proizvodstvom [News of higher educational institutions. Series: Economics, finance
and production management], 2017, No 1 (31), pp. 53-56.
17. Kondratieva T.N. Kompleksnyy podkhod analiza sovremennykh indikatorov finansovogo
rynka [An integrated approach to the analysis of modern indicators of the financial market],
Obozrenie prikladnoy i promyshlennoy matematiki [Review of Applied and Industrial Mathematics],
2015, Vol. 22, No 5, pp. 589-590.
18. Daniali S.M., Barykin S.E., Kapustina I.V., Mohammadbeigi Khortabi F., Sergeev S.M., Kalinina
O.V., Mikhaylov A., Veynberg R., Zasova L,; Senjyu T. Predicting Volatility Index According to
Technical Index and Economic Indicators on the Basis of Deep Learning Algorithm, Sustainability,
2021, No. 13, pp. 14011. Available at: https://doi.org/10.3390/su132414011.
19. Rodríguez-Cándido, N.P., Espin-Andrade R.A., Solares E., Pedrycz W.A. Compensatory Fuzzy
Logic Model in Technical Trading, Axioms, 2021, No. 10, pp. 36. Available at:
https://doi.org/10.3390/axioms10010036.
20. Yanyun Yao, Shangzhen Cai & Huimin Wang. Are technical indicators helpful to investors in
china’s stock market? A study based on some distribution forecast models and their combinations,
Economic Research-Ekonomska Istraživanja, 2022, Vol. 35:1, P. 2668-2692. DOI:
10.1080/1331677X.2021.1974921.
21. Han Yufeng, Liu Yang, Zhou Guofu and Zhu Yingzi. Technical Analysis in the Stock Market:
A Review (May 21, 2021). Available at SSRN: https://ssrn.com/abstract=3850494 or
http://dx.doi.org/10.2139/ssrn.3850494.