{"id":288266,"date":"2018-08-20T19:20:02","date_gmt":"2018-08-20T15:20:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=288266"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=288266","title":{"rendered":"\u0410\u043d\u0430\u043b\u0438\u0437 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0445 \u043e\u043f\u0446\u0438\u043e\u043d\u043e\u0432, \u043c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b \u0438 \u043a\u0430\u0440\u043c\u0430\u043d\u043d\u044b\u0439 event-driven \u0431\u044d\u043a\u0442\u0435\u0441\u0442\u0435\u0440"},"content":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420727\/\" class=\"post__text post__text-html js-mediator-article\">\u0418 \u0432\u0441\u0451 \u0436\u0435, \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u041c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b \u00ab\u0432 \u0432\u0430\u043a\u0443\u0443\u043c\u0435\u00bb \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0433\u0440\u0430\u0442\u044c. \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043b\u0438\u0448\u044c \u043f\u0440\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0438\u0433\u0440\u044b \u0432 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0414\u043b\u044f \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u0438\u0433\u0440\u044b \u043d\u0430 \u043c\u0438\u043d\u0443\u0442\u043d\u043e\u043c \u0442\u0430\u0439\u043c\u0444\u0440\u0435\u0439\u043c\u0435 \u0437\u0430 \u0438\u044e\u043b\u044c 2018 \u0433\u043e\u0434\u0430 \u043d\u0430 \u043f\u0430\u0440\u0435 EUR\/USD. \u041f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 event-driven \u0431\u044d\u043a\u0442\u0435\u0441\u0442\u0435\u0440, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 Jupyter \u043d\u0430 Python 3.6.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u043e\u0431\u044b\u0433\u0440\u0430\u0442\u044c \u043a\u0430\u0437\u0438\u043d\u043e? \u041c\u043e\u0436\u043d\u043e. \u041d\u043e \u043d\u0430 \u0447\u044c\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430?<\/p>\n<p>  \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435: \u0411\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u043e\u043d\u044b \u2014 \u044d\u0442\u043e \u0430\u0437\u0430\u0440\u0442\u043d\u0430\u044f \u0438\u0433\u0440\u0430. \u041e\u043f\u0430\u0441\u043d\u043e \u043d\u0430\u0434\u0435\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u0447\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0431\u0440\u043e\u043a\u0435\u0440\u0430 \u0438 \u0443\u0434\u0430\u0447\u0443. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f \u0441 \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0446\u0435\u043d. \u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/20f\/6aa\/35f\/20f6aa35f06754faf339f8dfdc940498.png\" alt=\"eurusd + \u043c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b&amp;rsi\"><\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<h2>\u0423\u0441\u043b\u043e\u0432\u0438\u044f \u00ab\u0432\u0430\u043a\u0443\u0443\u043c\u0430\u00bb<\/h2>\n<p>  \u041a\u0430\u0437\u0438\u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0438\u0433\u0440\u043e\u043a\u043e\u0432. \u0418\u043d\u043e\u0433\u0434\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430\u043c\u0438. \u0412\u0441\u0451 \u044d\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<ul>\n<li>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0432\u043a\u0430 1000 \u0440\u0443\u0431.<\/li>\n<li>\u041a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u043f\u0440\u0438\u0431\u044b\u043b\u0438 0.82%.<\/li>\n<li>\u041f\u0430\u0440\u0430 EUR\/USD.<\/li>\n<li>\u041f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0442\u0430\u0432\u043a\u0443 \u043a\u0430\u0436\u0434\u0443\u044e \u043c\u0438\u043d\u0443\u0442\u0443.<\/li>\n<li>\u0414\u043e\u0436\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u043f\u0440\u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u0435 \u043c\u0435\u043d\u0435\u0435 0,005%.<\/li>\n<li>\u041c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043a\u0440\u044b\u0442\u044c \u0443\u0431\u044b\u0442\u043e\u043a \u0438 \u043f\u0440\u0438\u043d\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u0431\u044b\u043b\u044c \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0432\u043a\u0438.<\/li>\n<li>\u0423\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0432\u0435\u0447\u0435. \u0415\u0441\u043b\u0438 \u0441\u0432\u0435\u0447\u0430 \u0437\u0435\u043b\u0451\u043d\u0430\u044f, \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0442\u0430\u0432\u043a\u0443 \u043d\u0430 \u0440\u043e\u0441\u0442, \u0435\u0441\u043b\u0438 \u043a\u0440\u0430\u0441\u043d\u0430\u044f \u2014 \u043d\u0430 \u043f\u0430\u0434\u0435\u043d\u0438\u0435.<\/li>\n<\/ul>\n<h2>\u0422\u0435\u0441\u0442\u044b<\/h2>\n<p>  \u0418\u0441\u0442\u043e\u0440\u0438\u044e \u0446\u0435\u043d \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e. \u041d\u0438\u0436\u0435 \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u0445 \u043c\u0438\u043d\u0443\u0442\u043d\u044b\u0435 \u0441\u0432\u0435\u0447\u0438 \u0437\u0430 \u043f\u0435\u0440\u0432\u0443\u044e \u043d\u0435\u0434\u0435\u043b\u044e \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0441\u0432\u0435\u0447\u0435\u0439 \u0434\u043b\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0436\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/003\/d0d\/f1c\/003d0df1c6160563c3fea9222e00db63.png\" alt=\"\u0431\u0430\u0440\u044b \u0437\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u0438 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430 \u0441\u0432\u0435\u0447\u0438\"><\/p>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0435 \u0442\u0435\u0441\u0442\u044b \u0431\u0435\u0437 \u041c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b\u0430 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u044f \u0434\u043e\u0436\u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u0421\u043b\u0435\u0432\u0430 \u2014 \u0431\u0430\u043b\u0430\u043d\u0441, \u0441\u043f\u0440\u0430\u0432\u0430 \u2014 \u043f\u0440\u043e\u0441\u0430\u0434\u043a\u0430 \u0432 \u0434\u043e\u043b\u044f\u0445.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/69b\/345\/9c0\/69b3459c0448b092158cc94f97b6f333.png\" alt=\"\u0431\u0435\u0437 \u0432\u0441\u0435\u0433\u043e\"><\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u041c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b \u0438 \u0432\u0438\u0434\u0438\u043c \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0440\u043e\u0441\u0442 \u0431\u0430\u043b\u0430\u043d\u0441\u0430. \u0422\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0451 \u043e\u043c\u0440\u0430\u0447\u0430\u0435\u0442 \u043f\u0438\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043f\u0435\u0440\u0438\u043e\u0434\u044b \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0432\u043a\u0438 \u043d\u0430 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0448\u0430\u0445.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/a71\/abe\/86b\/a71abe86bdaa61ff6df7c2e41f51c3ac.png\" alt=\"\u043c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b\"><\/p>\n<p>  \u041d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u0445 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0442\u044c 40\u0445 \u043a\u0440\u0430\u0442\u043d\u043e\u0439 \u043f\u0440\u043e\u0441\u0430\u0434\u043a\u0438. \u0421\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043c\u043d\u043e\u0433\u043e, \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c. \u041d\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434\u044b, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0434\u0435\u043b\u0438 \u0431\u0430\u043b\u0430\u043d\u0441 \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0436\u0434\u0430\u0435\u0442 \u0443\u0434\u0430\u0447\u0430. \u041a\u043e\u043c\u0443-\u0442\u043e \u0432\u0435\u0437\u0451\u0442, \u043a\u043e\u043c\u0443 \u043d\u0435\u0442.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043a \u041c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b\u0443 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u044b, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u043d\u0434\u0430. \u041e\u043d\u0438 \u0437\u0430\u043f\u0430\u0437\u0434\u044b\u0432\u0430\u044e\u0442, \u043d\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0431\u043b\u0430\u0433\u043e\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b.<\/p>\n<p>  \u041e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0435\u043c \u043f\u043e RSI(10): \u0432\u044b\u0448\u0435 60 \u2014 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043e \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0440\u043e\u0441\u0442, \u043d\u0438\u0436\u0435 40 \u2014 \u043d\u0430 \u043f\u0430\u0434\u0435\u043d\u0438\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/4c5\/873\/4d5\/4c58734d5a9c4e8516b6746867ecb905.png\" alt=\"\u043c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b+rsi\"><\/p>\n<p>  \u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0441\u0430\u0434\u043a\u0430 \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u0430\u0441\u044c, \u0430 \u0441\u0442\u0430\u0432\u043a\u0438 \u0441\u0442\u0430\u043b\u0438 \u0431\u0435\u0437\u043e\u0431\u0438\u0434\u043d\u0435\u0435. \u0412\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043c\u0438\u043b\u043b\u0438\u043e\u043d.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0442\u0435\u0441\u0442 \u0441 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0440\u0435\u0434\u043d\u0438\u0445. \u041a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u043d\u0430\u0434 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u2014 \u0440\u043e\u0441\u0442, \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442 \u2014 \u043f\u0430\u0434\u0435\u043d\u0438\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e7f\/a1c\/e6d\/e7fa1ce6d33a8e5693f61ba820957ba1.png\" alt=\"\u043c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b+sma\"><\/p>\n<p>  \u0412\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u043d\u0435 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u043d\u0430 \u043f\u043e\u0432\u0430\u043b.<\/p>\n<p>  \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/9f2\/d47\/db0\/9f2d47db029bb34388eaaea21cdb1b3d.png\" alt=\"\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b\"><\/p>\n<ul>\n<li>profit\/loss \u2014 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/li>\n<li>max drawdown, % \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0441\u0430\u0434\u043a\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430\u0445.<\/li>\n<li>max win \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0438\u0433\u0440\u044b\u0448.<\/li>\n<li>max loss \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0448.<\/li>\n<li>bets \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0432\u043e\u043a.<\/li>\n<li>wins \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u0438\u0433\u0440\u044b\u0448\u043d\u044b\u0445 \u0441\u0442\u0430\u0432\u043e\u043a.<\/li>\n<li>loss \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0448\u043d\u044b\u0445 \u0441\u0442\u0430\u0432\u043e\u043a.<\/li>\n<li>candles \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0430\u0440\u043e\u0432.<\/li>\n<\/ul>\n<h2>\u0421\u043e\u0431\u044b\u0442\u0438\u0439\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0431\u044d\u043a\u0442\u0435\u0441\u0442\u0435\u0440<\/h2>\n<p>  \u042d\u0442\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 \u0431\u044d\u043a\u0442\u0435\u0441\u0442\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0446\u0435\u043d \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044f \u0437\u0430\u0433\u043b\u044f\u0434\u044b\u0432\u0430\u043d\u0438\u0435 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u0435. \u0417\u0430 \u0441\u0447\u0451\u0442 \u0442\u043e\u043f\u043e\u0440\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0435\u0433\u043a\u043e\u043c\u0443 \u043f\u043e\u0438\u0441\u043a\u0443 \u043e\u0448\u0438\u0431\u043e\u043a. \u0414\u043b\u044f \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f:<\/p>\n<ul>\n<li>\u041a\u043b\u0430\u0441\u0441 (Account), \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0431\u0430\u043b\u0430\u043d\u0441 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441\u0442\u0430\u0432\u043a\u0438.<\/li>\n<li>\u0424\u0443\u043d\u043a\u0446\u0438\u044f (simple), \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0430\u044f \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0432\u0435\u0447\u0435, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0430\u044f \u0441 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439.<\/li>\n<li>Pandas \u0434\u0430\u0442\u0430\u0444\u0440\u0435\u0439\u043c \u0441 OHLC \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u0446\u0435\u043d.<\/li>\n<\/ul>\n<h3>Account<\/h3>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e. \u0421\u043b\u0435\u0434\u0438\u043c \u0437\u0430 \u0431\u0430\u043b\u0430\u043d\u0441\u043e\u043c, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0442\u0430\u0432\u043a\u0438.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043d\u0430 Python<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">class Account(object):     def __init__(self, bet_profit=0.82):         self._bet = None         self.equity = []         self.loss = []         self.bet_profit = 0.82              def bet(self, direction=None, amount=None, ts=None):         self._bet = {'direction': direction, 'amount': amount, 'ts': ts}          def tick(self, ticks):         result = 0         if self._bet is not None and self._bet['direction'] is not None:             if self._bet['direction'] &gt; 0 and ticks.close[-1] &gt; ticks.close[-2]:                 result = self._bet['amount'] * self.bet_profit                 self.equity.append({'ts': ticks.index[-1], 'amount': result})                 self.loss = []             elif self._bet['direction'] &lt; 0 and ticks.close[-1] &lt; ticks.close[-2]:                 result = self._bet['amount'] * self.bet_profit                 self.equity.append({'ts': ticks.index[-1], 'amount': result})                 self.loss = []             else:                 result = -self._bet['amount']                 self.equity.append({'ts': ticks.index[-1], 'amount': result})                 self.loss.append(result)             # reset bet             self.bet()                  return result, np.sum(self.loss)<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h3>\u041f\u043e\u0431\u0430\u0440\u043d\u044b\u0439 \u0446\u0438\u043a\u043b<\/h3>\n<p>  \u042d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043c\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u0432 \u043c\u0435\u0442\u043e\u0434 pd.Dataframe().apply(), \u0447\u0442\u043e\u0431\u044b \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0451 \u043f\u0440\u043e\u0448\u043b\u0438 \u0432\u0441\u0435 \u0438\u043c\u0435\u044e\u0449\u0438\u0435\u0441\u044f \u0446\u0435\u043d\u043e\u0432\u044b\u0435 \u0431\u0430\u0440\u044b. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u0431\u0430\u0440 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c account \u0438 \u043f\u043e\u043b\u043d\u043e\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0435\u0439 \u0446\u0435\u043d. \u0412 \u043d\u0430\u0447\u0430\u043b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0438\u043b\u044c\u0442\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0434\u0430\u0442\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0431\u0430\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u0435\u0447\u044c \u0431\u0443\u0434\u0443\u0449\u0435\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043d\u0430 Python<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">def simple(tick, data=None, account=None, skip_dogi=False, martingale=False):     if account is None:         print('Account is not available')         return 0     fltr = data.index &lt;= tick.ts          # send last ticks to account     result, loss = account.tick(data[fltr][-5:].copy())          amount = 1000         if martingale:         if loss &lt; 0:             amount += abs(loss) \/ account.bet_profit                  if skip_dogi and tick.dogi &lt;= 0.00005:         pass     elif tick.open &gt; tick.close:         # sell on red         account.bet(-1, amount=amount, ts=tick.ts)     elif tick.open &lt; tick.close:         # buy on green         account.bet(1, amount=amount, ts=tick.ts)          return result<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a<\/h3>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434 \u043d\u0430 Python<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">df = pd.read_csv('DAT_MT_EURUSD_M1_201807.csv', names=['date', 'time', 'open', 'high', 'low', 'close', 'volume']) # ... df = df[['ts', 'open', 'high', 'low', 'close']].set_index('ts', drop=False).sort_index() df['dogi'] = (df.close \/ df.open - 1).abs()  account = Account() results = df.apply(partial(simple, data=df, account=account, skip_dogi=True), raw=False, axis=1)<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0433\u0440\u0430\u0430\u043b\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u041c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b\u0430, \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u043a\u0430\u043f\u0438\u0442\u0430\u043b\u0430. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0447\u0443\u0442\u044c \u0445\u0443\u0436\u0435. \u0411\u0440\u043e\u043a\u0435\u0440\u044b, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0449\u0438\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0440\u0430\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432\u043d\u0435 \u0440\u0435\u0433\u0443\u043b\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0438 \u0443 \u043d\u0438\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0431\u043c\u0430\u043d\u0430 \u0438\u0433\u0440\u043e\u043a\u0430.<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0439 \u0431\u044d\u043a\u0442\u0435\u0441\u0442\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439 \u043d\u0430 \u043b\u044e\u0431\u044b\u0445 \u0444\u0438\u043d\u0430\u043d\u0441\u043e\u0432\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u0445. \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043b\u0438\u0448\u044c \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p><\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/420727\/\"> https:\/\/habr.com\/post\/420727\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div data-io-article-url=\"https:\/\/habr.com\/post\/420727\/\" class=\"post__text post__text-html js-mediator-article\">\u0418 \u0432\u0441\u0451 \u0436\u0435, \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u041c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b \u00ab\u0432 \u0432\u0430\u043a\u0443\u0443\u043c\u0435\u00bb \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0433\u0440\u0430\u0442\u044c. \u0418\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043b\u0438\u0448\u044c \u043f\u0440\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u0438\u0433\u0440\u044b \u0432 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f. \u0414\u043b\u044f \u0434\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u0438\u0433\u0440\u044b \u043d\u0430 \u043c\u0438\u043d\u0443\u0442\u043d\u043e\u043c \u0442\u0430\u0439\u043c\u0444\u0440\u0435\u0439\u043c\u0435 \u0437\u0430 \u0438\u044e\u043b\u044c 2018 \u0433\u043e\u0434\u0430 \u043d\u0430 \u043f\u0430\u0440\u0435 EUR\/USD. \u041f\u043e\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 event-driven \u0431\u044d\u043a\u0442\u0435\u0441\u0442\u0435\u0440, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 Jupyter \u043d\u0430 Python 3.6.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u043e\u0431\u044b\u0433\u0440\u0430\u0442\u044c \u043a\u0430\u0437\u0438\u043d\u043e? \u041c\u043e\u0436\u043d\u043e. \u041d\u043e \u043d\u0430 \u0447\u044c\u0435\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430?<\/p>\n<p>  \u041d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0435: \u0411\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0446\u0438\u043e\u043d\u044b \u2014 \u044d\u0442\u043e \u0430\u0437\u0430\u0440\u0442\u043d\u0430\u044f \u0438\u0433\u0440\u0430. \u041e\u043f\u0430\u0441\u043d\u043e \u043d\u0430\u0434\u0435\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u0447\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0431\u0440\u043e\u043a\u0435\u0440\u0430 \u0438 \u0443\u0434\u0430\u0447\u0443. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u044f \u0441 \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0446\u0435\u043d. \u041f\u043e\u0435\u0445\u0430\u043b\u0438!<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/20f\/6aa\/35f\/20f6aa35f06754faf339f8dfdc940498.png\" alt=\"eurusd + \u043c\u0430\u0440\u0442\u0438\u043d\u0433\u0435\u0439\u043b&amp;rsi\"><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-288266","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288266","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=288266"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/288266\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=288266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=288266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=288266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}