{"id":418,"date":"2024-08-22T17:12:35","date_gmt":"2024-08-22T08:12:35","guid":{"rendered":"https:\/\/itadaki-marketing.com\/mpa\/?p=418"},"modified":"2024-09-06T12:28:38","modified_gmt":"2024-09-06T03:28:38","slug":"mql4%e3%81%ab%e3%81%8a%e3%81%91%e3%82%8bgetlasterror%e9%96%a2%e6%95%b0%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9","status":"publish","type":"post","link":"https:\/\/itadaki-marketing.com\/mpa\/2024\/08\/22\/418\/","title":{"rendered":"MQL4\u306b\u304a\u3051\u308bGetLastError()\u95a2\u6570\u306e\u4f7f\u3044\u65b9"},"content":{"rendered":"\n<p><code>GetLastError()<\/code>\u95a2\u6570\u306f\u3001MQL4\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5b9f\u884c\u4e2d\u306b\u767a\u751f\u3057\u305f\u76f4\u8fd1\u306e\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u308b\u95a2\u6570\u3067\u3059\u3002\u3053\u306e\u95a2\u6570\u306f\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u969b\u306b\u305d\u306e\u539f\u56e0\u3092\u7279\u5b9a\u3057\u3001\u9069\u5207\u306a\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3092\u884c\u3046\u305f\u3081\u306b\u91cd\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong><code>GetLastError()<\/code>\u95a2\u6570\u306e\u57fa\u672c\u69cb\u9020<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u623b\u308a\u5024<\/strong>:\u00a0<code>int<\/code>\u578b\u306e\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u3092\u8fd4\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u5f15\u6570<\/strong>: \u306a\u3057<\/li>\n<\/ul>\n\n\n\n<p>\u3053\u306e\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\u3068\u3001\u30b7\u30b9\u30c6\u30e0\u5909\u6570<code>_LastError<\/code>\u306b\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u304c\u8fd4\u3055\u308c\u3001\u305d\u306e\u5f8c<code>_LastError<\/code>\u306e\u5185\u5bb9\u306f\u30ea\u30bb\u30c3\u30c8\u3055\u308c\u307e\u3059<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/docs.mql4.com\/check\/getlasterror\"><\/a><a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/yukifx.web.fc2.com\/sub\/reference\/12_checkup\/cone\/checkup_getlasterror.html\"><\/a><a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/mt4-traders.com\/reference\/getlasterror\/\"><\/a>\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9:&nbsp;<code>GetLastError()<\/code>\u3092\u4f7f\u7528\u3057\u305f\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0<\/strong><\/h2>\n\n\n\n<p>\u4ee5\u4e0b\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u3001<code>OrderSend()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u6ce8\u6587\u3092\u9001\u4fe1\u3057\u3001\u5931\u6557\u3057\u305f\u5834\u5408\u306b<code>GetLastError()<\/code>\u3092\u4f7f\u3063\u3066\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u3092\u53d6\u5f97\u3057\u3001\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u51fa\u529b\u3059\u308b\u4f8b\u3067\u3059\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-csharp\" data-lang=\"C#\" data-show-lang=\"0\"><code>\/\/+------------------------------------------------------------------+\n\/\/| Expert initialization function                                   |\n\/\/+------------------------------------------------------------------+\nint OnInit()\n  {\n   \/\/ \u6ce8\u6587\u3092\u9001\u4fe1\n   int ticket = OrderSend(Symbol(), OP_BUY, 0.1, Ask, 10, 0, 0, &quot;&quot;, 123, 0, clrNONE);\n   \n   \/\/ \u6ce8\u6587\u304c\u5931\u6557\u3057\u305f\u5834\u5408\n   if(ticket == -1)\n     {\n      \/\/ \u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u3092\u53d6\u5f97\n      int errorCode = GetLastError();\n      \n      \/\/ \u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u306b\u57fa\u3065\u3044\u3066\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u51fa\u529b\n      Print(&quot;OrderSend failed with error code: &quot;, errorCode);\n     }\n   else\n     {\n      Print(&quot;Order placed successfully with ticket #&quot;, ticket);\n     }\n   \n   return(INIT_SUCCEEDED);\n  }\n\/\/+------------------------------------------------------------------+<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u30b3\u30fc\u30c9\u306e\u8aac\u660e<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>OrderSend()<\/code><\/strong>: \u65b0\u898f\u6ce8\u6587\u3092\u9001\u4fe1\u3059\u308b\u95a2\u6570\u3002\u5931\u6557\u3057\u305f\u5834\u5408\u306f<code>-1<\/code>\u3092\u8fd4\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong><code>GetLastError()<\/code><\/strong>: \u76f4\u8fd1\u306e\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<code>OrderSend()<\/code>\u304c\u5931\u6557\u3057\u305f\u5834\u5408\u306b\u547c\u3073\u51fa\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong><code>Print()<\/code><\/strong>: \u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u3092\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u51fa\u529b\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3053\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001<code>OrderSend()<\/code>\u95a2\u6570\u304c\u5931\u6557\u3057\u305f\u5834\u5408\u306b<code>GetLastError()<\/code>\u3092\u4f7f\u7528\u3057\u3066\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u3092\u53d6\u5f97\u3057\u3001\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u51fa\u529b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u308c\u306b\u3088\u308a\u3001\u4f55\u304c\u554f\u984c\u3067\u6ce8\u6587\u304c\u5931\u6557\u3057\u305f\u306e\u304b\u3092\u7279\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u306f\u6570\u5024\u3067\u8fd4\u3055\u308c\u308b\u305f\u3081\u3001\u5177\u4f53\u7684\u306a\u30a8\u30e9\u30fc\u5185\u5bb9\u3092\u77e5\u308b\u306b\u306f\u3001\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u3092\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u5909\u63db\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306b\u306f\u3001<code>ErrorDescription()<\/code>\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059<a href=\"https:\/\/labo.gogojungle.co.jp\/articles\/53\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a><a href=\"https:\/\/strategyofc.blogspot.com\/2018\/10\/mql4-getlasterror.html\" target=\"_blank\" rel=\"noreferrer noopener\"><\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GetLastError()\u95a2\u6570\u306f\u3001MQL4\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5b9f\u884c\u4e2d\u306b\u767a\u751f\u3057\u305f\u76f4\u8fd1\u306e\u30a8\u30e9\u30fc\u30b3\u30fc\u30c9\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u308b\u95a2\u6570\u3067\u3059\u3002\u3053\u306e\u95a2\u6570\u306f\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u969b\u306b\u305d\u306e\u539f\u56e0\u3092\u7279\u5b9a\u3057\u3001\u9069\u5207\u306a\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3092\u884c\u3046\u305f\u3081\u306b\u91cd\u8981\u3067\u3059 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[8,1],"tags":[],"class_list":["post-418","post","type-post","status-publish","format-standard","hentry","category-mql","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/posts\/418","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=418"}],"version-history":[{"count":1,"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/posts\/418\/revisions"}],"predecessor-version":[{"id":419,"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/posts\/418\/revisions\/419"}],"wp:attachment":[{"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/media?parent=418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/categories?post=418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itadaki-marketing.com\/mpa\/wp-json\/wp\/v2\/tags?post=418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}