{"id":447,"date":"2024-09-06T12:28:04","date_gmt":"2024-09-06T03:28:04","guid":{"rendered":"https:\/\/itadaki-marketing.com\/mpa\/?p=447"},"modified":"2024-09-06T12:28:05","modified_gmt":"2024-09-06T03:28:05","slug":"mql4%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%9f%e3%83%b3%e3%82%b0%e3%81%ab%e3%81%8a%e3%81%91%e3%82%8bfor%e6%96%87%e3%81%ae%e8%bf%bd%e5%8a%a0%e6%96%b9%ef%bc%88%e3%82%b5%e3%83%b3%e3%83%97%e3%83%ab","status":"publish","type":"post","link":"https:\/\/itadaki-marketing.com\/mpa\/2024\/09\/06\/447\/","title":{"rendered":"MQL4\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u304a\u3051\u308bfor\u6587\u306e\u8ffd\u52a0\u65b9\uff08\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3042\u308a\uff09"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">MQL4\u306b\u304a\u3051\u308bfor\u6587\u3068\u306f\uff1f<\/h2>\n\n\n\n<p>MQL4\u306efor\u6587\u306f\u3001\u6307\u5b9a\u3057\u305f\u56de\u6570\u3060\u3051\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u884c\u3046\u305f\u3081\u306e\u5236\u5fa1\u69cb\u6587\u3067\u3059\u3002\u4e3b\u306a\u7279\u5fb4\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u57fa\u672c\u69cb\u6587<\/li>\n<\/ol>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-cpp\" data-lang=\"C++\" data-show-lang=\"0\"><code>for (\u521d\u671f\u5316; \u6761\u4ef6\u5f0f; \u66f4\u65b0\u5f0f) {\n    \/\/ \u7e70\u308a\u8fd4\u3057\u5b9f\u884c\u3057\u305f\u3044\u51e6\u7406\n}<\/code><\/pre><\/div>\n\n\n\n<ol start=\"2\" class=\"wp-block-list\">\n<li>\u4f7f\u7528\u4f8b<\/li>\n<\/ol>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-cpp\" data-lang=\"C++\" data-show-lang=\"0\"><code>for (int i = 0; i &lt; 10; i++) {\n    Print(i);\n}<\/code><\/pre><\/div>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>\u4e3b\u306a\u7528\u9014<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u914d\u5217\u306e\u8981\u7d20\u3092\u9806\u306b\u51e6\u7406\u3059\u308b<\/li>\n\n\n\n<li>\u4e00\u5b9a\u56de\u6570\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u884c\u3046<\/li>\n\n\n\n<li>\u30c1\u30e3\u30fc\u30c8\u30c7\u30fc\u30bf\u3092\u9061\u3063\u3066\u51e6\u7406\u3059\u308b<\/li>\n<\/ul>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>\u7279\u5fb4<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u521d\u671f\u5316\u3001\u6761\u4ef6\u30c1\u30a7\u30c3\u30af\u3001\u66f4\u65b0\u30921\u884c\u3067\u8a18\u8ff0\u3067\u304d\u308b<\/li>\n\n\n\n<li>\u30ab\u30a6\u30f3\u30bf\u5909\u6570\u306e\u30b9\u30b3\u30fc\u30d7\u3092\u30eb\u30fc\u30d7\u5185\u306b\u9650\u5b9a\u3067\u304d\u308b<\/li>\n\n\n\n<li>\u7e70\u308a\u8fd4\u3057\u56de\u6570\u304c\u660e\u78ba\u306a\u5834\u5408\u306b\u9069\u3057\u3066\u3044\u308b<\/li>\n<\/ul>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li>\u5fdc\u7528<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>break\u6587\u3067\u30eb\u30fc\u30d7\u3092\u9014\u4e2d\u3067\u629c\u3051\u308b<\/li>\n\n\n\n<li>continue\u6587\u3067\u73fe\u5728\u306e\u7e70\u308a\u8fd4\u3057\u3092\u30b9\u30ad\u30c3\u30d7\u3057\u3066\u6b21\u306b\u9032\u3080<\/li>\n\n\n\n<li>\u30cd\u30b9\u30c8\u3057\u3066\u4f7f\u7528\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd<\/li>\n<\/ul>\n\n\n\n<p>for\u6587\u3092\u4f7f\u3044\u3053\u306a\u3059\u3053\u3068\u3067\u3001\u52b9\u7387\u7684\u306aEA\u3084\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc\u306e\u958b\u767a\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u7279\u306b\u3001\u904e\u53bb\u306e\u30c7\u30fc\u30bf\u3092\u5206\u6790\u3057\u305f\u308a\u3001\u8907\u6570\u306e\u30dd\u30b8\u30b7\u30e7\u30f3\u3092\u7ba1\u7406\u3057\u305f\u308a\u3059\u308b\u969b\u306b\u975e\u5e38\u306b\u6709\u7528\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n\n\n\n<p>MQL4\u3067for\u6587\u3092\u4f7f\u7528\u3057\u3066\u8907\u6570\u306e\u30dd\u30b8\u30b7\u30e7\u30f3\u3092\u3059\u3079\u3066\u6c7a\u6e08\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\uff08\u30aa\u30ea\u30b8\u30ca\u30eb\u95a2\u6570\uff09\u3092\u4ee5\u4e0b\u306b\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-cpp\" data-lang=\"C++\" data-show-lang=\"0\"><code>void CloseAllPositions()\n{\n    int total = OrdersTotal();\n    \n    for(int i = total - 1; i &gt;= 0; i--)\n    {\n        if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))\n        {\n            int type = OrderType();\n            \n            \/\/ \u73fe\u5728\u306e\u30b7\u30f3\u30dc\u30eb\u306e\u30dd\u30b8\u30b7\u30e7\u30f3\u306e\u307f\u3092\u5bfe\u8c61\u3068\u3059\u308b\n            if(OrderSymbol() == Symbol())\n            {\n                bool result = false;\n                \n                \/\/ \u8cb7\u3044\u30dd\u30b8\u30b7\u30e7\u30f3\u306e\u5834\u5408\n                if(type == OP_BUY)\n                {\n                    result = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 3, clrRed);\n                }\n                \/\/ \u58f2\u308a\u30dd\u30b8\u30b7\u30e7\u30f3\u306e\u5834\u5408\n                else if(type == OP_SELL)\n                {\n                    result = OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 3, clrBlue);\n                }\n                \n                if(!result)\n                {\n                    Print(&quot;OrderClose error: &quot;, GetLastError());\n                }\n                else\n                {\n                    Print(&quot;Position closed: &quot;, OrderTicket());\n                }\n            }\n        }\n    }\n}<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">\u30b3\u30fc\u30c9\u306e\u8aac\u660e<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>OrdersTotal()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u3001\u73fe\u5728\u306e\u30aa\u30fc\u30d7\u30f3\u30dd\u30b8\u30b7\u30e7\u30f3\u306e\u7dcf\u6570\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li>for\u6587\u3092\u4f7f\u7528\u3057\u3066\u3001\u3059\u3079\u3066\u306e\u30aa\u30fc\u30d7\u30f3\u30dd\u30b8\u30b7\u30e7\u30f3\u3092\u30eb\u30fc\u30d7\u51e6\u7406\u3057\u307e\u3059\u3002\u30eb\u30fc\u30d7\u306f\u6700\u65b0\u306e\u30dd\u30b8\u30b7\u30e7\u30f3\u304b\u3089\u958b\u59cb\u3059\u308b\u305f\u3081\u3001\u9006\u9806\uff08total &#8211; 1\u304b\u30890\u307e\u3067\uff09\u3067\u51e6\u7406\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><code>OrderSelect()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u3001\u5404\u30dd\u30b8\u30b7\u30e7\u30f3\u3092\u9078\u629e\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u73fe\u5728\u306e\u30b7\u30f3\u30dc\u30eb\uff08\u901a\u8ca8\u30da\u30a2\uff09\u306e\u30dd\u30b8\u30b7\u30e7\u30f3\u306e\u307f\u3092\u5bfe\u8c61\u3068\u3059\u308b\u305f\u3081\u3001<code>OrderSymbol() == Symbol()<\/code>\u3067\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u30dd\u30b8\u30b7\u30e7\u30f3\u306e\u30bf\u30a4\u30d7\uff08\u8cb7\u3044\u307e\u305f\u306f\u58f2\u308a\uff09\u306b\u5fdc\u3058\u3066\u3001\u9069\u5207\u306a\u6c7a\u6e08\u4fa1\u683c\uff08Bid\u307e\u305f\u306fAsk\uff09\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><code>OrderClose()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30dd\u30b8\u30b7\u30e7\u30f3\u3092\u6c7a\u6e08\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li>\u6c7a\u6e08\u304c\u6210\u529f\u3057\u305f\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3057\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u306f\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u51fa\u529b\u3057\u307e\u3059\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u73fe\u5728\u306e\u30b7\u30f3\u30dc\u30eb\u306b\u95a2\u3059\u308b\u3059\u3079\u3066\u306e\u30aa\u30fc\u30d7\u30f3\u30dd\u30b8\u30b7\u30e7\u30f3\u304c\u6c7a\u6e08\u3055\u308c\u307e\u3059\u3002\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u3001\u7279\u5b9a\u306e\u30de\u30b8\u30c3\u30af\u30ca\u30f3\u30d0\u30fc\u3092\u6301\u3064\u30dd\u30b8\u30b7\u30e7\u30f3\u306e\u307f\u3092\u6c7a\u6e08\u3059\u308b\u306a\u3069\u3001\u6761\u4ef6\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MQL4\u306b\u304a\u3051\u308bfor\u6587\u3068\u306f\uff1f MQL4\u306efor\u6587\u306f\u3001\u6307\u5b9a\u3057\u305f\u56de\u6570\u3060\u3051\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u884c\u3046\u305f\u3081\u306e\u5236\u5fa1\u69cb\u6587\u3067\u3059\u3002\u4e3b\u306a\u7279\u5fb4\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002 for\u6587\u3092\u4f7f\u3044\u3053\u306a\u3059\u3053\u3068\u3067\u3001\u52b9\u7387\u7684\u306aEA\u3084\u30a4\u30f3\u30b8\u30b1\u30fc\u30bf\u30fc\u306e\u958b\u767a\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002\u7279\u306b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":448,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[8,1],"tags":[],"class_list":["post-447","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mql","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/posts\/447","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/comments?post=447"}],"version-history":[{"count":1,"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/posts\/447\/revisions"}],"predecessor-version":[{"id":449,"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/posts\/447\/revisions\/449"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/media\/448"}],"wp:attachment":[{"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/media?parent=447"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/categories?post=447"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/tags?post=447"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}