{"id":176,"date":"2023-10-10T16:02:41","date_gmt":"2023-10-10T07:02:41","guid":{"rendered":"https:\/\/oyaoya.happy.nu\/?p=176"},"modified":"2023-10-10T16:02:41","modified_gmt":"2023-10-10T07:02:41","slug":"ea%e4%bd%9c%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f%ef%bc%81","status":"publish","type":"post","link":"https:\/\/wp.ano-hi.com\/?p=176","title":{"rendered":"EA\u4f5c\u3063\u3066\u307f\u305f\uff01"},"content":{"rendered":"\n<p>EA\u4f5c\u3063\u3066\u307f\u307e\u3057\u305f<br>HP\u3084Youtube\u3092\u3044\u304f\u3064\u304b\u53c2\u8003\u306b\u3057\u3066\u307f\u307e\u3057\u305f<br>\u9806\u5f35\u308a\u306eEA\u3067\u3059<br>\uff12\uff10\uff12\uff12\u5e74\uff19\u6708\u304b\u3089\uff12\uff10\uff12\uff13\u5e74\uff19\u6708\u307e\u3067\u91d1\u3001\uff11\u4e07\u5186\u3001\u30de\u30a4\u30af\u30ed\u53e3\u5ea7\u3067\uff10\uff0e\uff11\u3067\u5b9f\u884c\uff01<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"162\" src=\"http:\/\/wp.ano-hi.com\/wp-content\/uploads\/2023\/10\/20231010-01-1024x162.png\" alt=\"\" class=\"wp-image-177\" srcset=\"https:\/\/wp.ano-hi.com\/wp-content\/uploads\/2023\/10\/20231010-01-1024x162.png 1024w, https:\/\/wp.ano-hi.com\/wp-content\/uploads\/2023\/10\/20231010-01-300x47.png 300w, https:\/\/wp.ano-hi.com\/wp-content\/uploads\/2023\/10\/20231010-01-768x121.png 768w, https:\/\/wp.ano-hi.com\/wp-content\/uploads\/2023\/10\/20231010-01-1536x243.png 1536w, https:\/\/wp.ano-hi.com\/wp-content\/uploads\/2023\/10\/20231010-01.png 1918w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\uff11\u4e07\u5186\u3067\u59cb\u3081\u3066\u3001\uff18\uff12\uff19\uff18\u5186\u306b\u306a\u308a\u307e\u3057\u305f\u3002<br>\u7d42\u308f\u3063\u3066\u307e\u3059\uff57<br>\u4e00\u7b4b\u7e04\u3067\u306f\u3044\u304d\u307e\u305b\u3093\u306d\uff5e<\/p>\n\n\n\n<p>\u4e0b\u306f\u8a18\u9332\u3068\u3057\u3066\u30bd\u30fc\u30b9\u3092\u4e0a\u3052\u3066\u3044\u307e\u3059<br>\u7d76\u5bfe\u52dd\u305f\u306a\u3044\u306e\u3067\u3001\u5229\u7528\u3057\u306a\u3044\u3067\u304f\u3060\u3055\u3044\uff01<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/+------------------------------------------------------------------+\n\/\/|                                                       mv-win.mq4 |\n\/\/|                        Copyright 2022, MetaQuotes Software Corp. |\n\/\/|                                             https:\/\/www.mql5.com |\n\/\/+------------------------------------------------------------------+\n#property copyright \"Copyright 2022, MetaQuotes Software Corp.\"\n#property link      \"https:\/\/www.mql5.com\"\n#property version   \"1.00\"\n#property strict\n#include &lt;stdlib.mqh>\n\n\/\/--- input parameters\ninput int EA_NUMBER = 690406;\ninput double   lots = 0.01;\ninput datetime stop_start1;\ninput datetime stop_end1;\ninput datetime stop_start2;\ninput datetime stop_end2;\ninput datetime stop_start3;\ninput datetime stop_end3;\ndouble max_buy_profit = 0; \/\/\u6700\u5927\u5229\u76ca\ndouble max_sell_profit = 0; \/\/\u6700\u5927\u5229\u76ca\nbool reseted_buy = false;\nbool reseted_sell = false;\n\/\/+------------------------------------------------------------------+\n\/\/| Expert initialization function                                   |\n\/\/+------------------------------------------------------------------+\nint OnInit() {\n\/\/---\n    if(lots > 0.1) {\n        printf(\"\u30a8\u30e9\u30fc\uff1alots\u306f0.1\u3088\u308a\u5927\u304d\u304f\u51fa\u6765\u307e\u305b\u3093\u3002\u51e6\u7406\u3092\u4e2d\u65ad\u3057\u307e\u3059\u3002\");\n        MessageBox(\"lots\u306f0.1\u3088\u308a\u5927\u304d\u304f\u51fa\u6765\u307e\u305b\u3093\u3002\u51e6\u7406\u3092\u4e2d\u65ad\u3057\u307e\u3059\u3002\",\"\u30a8\u30e9\u30fc\",0);\n        return (INIT_PARAMETERS_INCORRECT);\n    }\n\/\/---\n    return(INIT_SUCCEEDED);\n}\n\/\/+------------------------------------------------------------------+\n\/\/| Expert deinitialization function                                 |\n\/\/+------------------------------------------------------------------+\nvoid OnDeinit(const int reason) {\n\/\/---\n\n}\n\/\/+------------------------------------------------------------------+\n\/\/| Expert tick function                                             |\n\/\/+------------------------------------------------------------------+\nvoid OnTick() {\n\/\/---\n    int buy_ticket = -1;\n    double buy_lots = 0.0;\n    double buy_price = 0.0;\n    int sell_ticket = -1;\n    double sell_lots = 0.0;\n    double sell_price = 0.0;\n\n\/\/\u7acb\u3061\u7389\u306e\u5b58\u5728\u3092\u78ba\u8a8d\u3059\u308b\n    int totalOrder = OrdersTotal();\n    for(int i = 0; i &lt; totalOrder; i++) {\n        if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) &amp;&amp; OrderMagicNumber() == EA_NUMBER) {\n            if(OrderType() == OP_BUY) {\n                buy_ticket = OrderTicket();\n                buy_lots = OrderLots();\n                buy_price = OrderOpenPrice();\n            }\n            if(OrderType() == OP_SELL) {\n                sell_ticket = OrderTicket();\n                sell_lots = OrderLots();\n                sell_price = OrderOpenPrice();\n            }\n        }\n    }\n    printf(\"buy_ticket:%d,sell_ticket:%d\",buy_ticket,sell_ticket);\n    if(buy_ticket != -1 &amp;&amp; sell_ticket != -1) {\n        \/\/\u3082\u3057\u58f2\u308a\u3068\u8cb7\u3044\u306e\u4e21\u65b9\u304c\u5b58\u5728\u3059\u308b\u6642\u306f\u4ee5\u4e0a\u306a\u306e\u3067\u3001\u3059\u3079\u3066\u3092\u6c7a\u6e08\u3057\u3001\u7d42\u4e86\u3059\u308b\n        closeOrder(Bid,buy_ticket,buy_lots,Blue);\n        closeOrder(Ask,sell_ticket,sell_lots,Red);\n        printf(\"\u58f2\u308a\u3068\u8cb7\u3044\u306e\u4e21\u65b9\u306e\u6ce8\u6587\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u3002\u7570\u5e38\u304c\u767a\u751f\u3057\u305f\u70ba\u3001\u51e6\u7406\u3092\u4e2d\u65ad\u3057\u307e\u3059\u3002\");\n        MessageBox(\"\u58f2\u308a\u3068\u8cb7\u3044\u306e\u4e21\u65b9\u306e\u6ce8\u6587\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u3002\u7570\u5e38\u304c\u767a\u751f\u3057\u305f\u70ba\u3001\u51e6\u7406\u3092\u4e2d\u65ad\u3057\u307e\u3059\u3002\",\"\u30a8\u30e9\u30fc\",0);\n        ExpertRemove();\n    }\n\n\/\/\u79fb\u52d5\u5e73\u5747\u7dda\u3082\u5024\u3092\u53d6\u5f97\u3059\u308b\n    double ma21 = iMA(NULL,0,21,0,MODE_SMMA,PRICE_CLOSE,1);\n    double ma50 = iMA(NULL,0,50,0,MODE_SMMA,PRICE_CLOSE,1);\n\/\/double ma200 = iMA(NULL,0,200,0,MODE_SMMA,PRICE_CLOSE,1);\n    double rsi = iRSI(NULL,0,14,PRICE_CLOSE,1);\n    double macdSig = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 1);\n    double macdMain = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1);\n    double cci = iCCI(NULL,0,13,PRICE_CLOSE,1);\n\n    printf(\"Ask:%f,Bid:%f\",Ask,Bid);\n    printf(\"ma21:%f,ma50:%f\",ma21,ma50);\n\/\/printf(\"ma21:%f,ma50:%f,ma200:%f\",ma21,ma50,ma200);\n\n    if(buy_ticket == -1 &amp;&amp; ma50 > Ask) {\n        \/\/\u65b0\u305f\u306a\u8cb7\u3044\u6ce8\u6587\u3092\u51fa\u305b\u308b\u3088\u3046\u30ea\u30bb\u30c3\u30c8\u3059\u308b\n        reseted_buy = true;\n    }\n    if(sell_ticket == -1 &amp;&amp; ma50 &lt; Bid) {\n        \/\/\u65b0\u305f\u306a\u58f2\u308a\u6ce8\u6587\u3092\u51fa\u305b\u308b\u3088\u3046\u30ea\u30bb\u30c3\u30c8\u3059\u308b\n        reseted_sell = true;\n    }\n    if(buy_ticket != -1) {\n        if((Bid - buy_price) > max_buy_profit ) {\n            max_buy_profit = (Bid - buy_price);\n        }\n        \/\/\u8cb7\u3044\u6ce8\u6587\u304c\u3042\u308b\u6642\u6c7a\u6e08\u3092\u884c\u3046\n        if(ma50 > ma21 ) {\n            \/\/if(ma50 > ma21 || ma200 > ma21 || ma200 > ma50) {\n            \/\/\u79fb\u52d5\u5e73\u5747\u7dda\u304c\u3001\u4e0a\u304b\u3089ma21,ma50,ma200\u306e\u9806\u304c\u5d29\u308c\u305f\u3089\u8cb7\u3044\u3092\u640d\u5207\n            closeOrder(Bid,buy_ticket,buy_lots,Blue);\n            reseted_buy = false;\n            max_buy_profit = 0;\n        } else if(ma50 > Bid) {\n            \/\/\u4fa1\u683c\u304c\u3001\u79fb\u52d5\u5e73\u5747\u7dda\u306ema50\u306e\u4fa1\u683c\u3088\u308a\u4e0b\u306b\u884c\u304f\u3068\u8cb7\u3044\u3092\u640d\u5207\n            closeOrder(Bid,buy_ticket,buy_lots,Blue);\n            reseted_buy = false;\n            max_buy_profit = 0;\n        } else if(macdMain &lt; macdSig) {\n            closeOrder(Bid,buy_ticket,buy_lots,Blue);\n            reseted_buy = false;\n            max_buy_profit = 0;\n        } else if(max_buy_profit > (Ask - Bid)) {\n            \/\/\u4fa1\u683c\u304c\u3001\u79fb\u52d5\u5e73\u5747\u7dda\u306ema50\u3068ma21\u5dee\u306e\u4fa1\u683c\u306e2\u500d\u4ee5\u4e0ama21\u3088\u308a\u4e0a\u306b\u884c\u304f\u3068\u8cb7\u3044\u3092\u5229\u98df\u3044\n            closeOrder(Bid,buy_ticket,buy_lots,Blue);\n            reseted_buy = false;\n            max_buy_profit = 0;\n        }\n    }\n\n    if(sell_ticket != -1 ) {\n        if((sell_price - Ask) > max_sell_profit ) {\n            max_sell_profit = (sell_price - Ask);\n        }\n        \/\/\u58f2\u308a\u6ce8\u6587\u304c\u3042\u308b\u6642\u6c7a\u6e08\u3092\u884c\u3046\n        if(ma50 &lt; ma21) {\n            \/\/if(ma50 &lt; ma21 || ma200 &lt; ma21 || ma200 &lt; ma50) {\n            \/\/\u79fb\u52d5\u5e73\u5747\u7dda\u304c\u3001\u4e0a\u304b\u3089ma200,ma50,ma21\u306e\u9806\u304c\u5d29\u308c\u305f\u3089\u58f2\u308a\u3092\u640d\u5207\n            closeOrder(Ask,sell_ticket,sell_lots,Red);\n            reseted_sell = false;\n            max_sell_profit = 0;\n        } else if(ma50 &lt; Ask) {\n            \/\/\u4fa1\u683c\u304c\u3001\u79fb\u52d5\u5e73\u5747\u7dda\u306ema50\u306e\u4fa1\u683c\u3088\u308a\u4e0a\u306b\u884c\u304f\u3068\u58f2\u308a\u3092\u640d\u5207\n            closeOrder(Ask,sell_ticket,sell_lots,Red);\n            reseted_sell = false;\n            max_sell_profit = 0;\n        } else if(macdMain > macdSig) {\n            closeOrder(Ask,sell_ticket,sell_lots,Red);\n            reseted_sell = false;\n            max_sell_profit = 0;\n        } else if(max_sell_profit > (Ask - Bid)) {\n            \/\/\u4fa1\u683c\u304c\u3001\u79fb\u52d5\u5e73\u5747\u7dda\u306ema50\u3068ma21\u5dee\u306e\u4fa1\u683c\u306e2\u500d\u4ee5\u4e0ama21\u3088\u308a\u4e0b\u306b\u884c\u304f\u3068\u58f2\u308a\u3092\u5229\u98df\u3044\n            closeOrder(Ask,sell_ticket,sell_lots,Red);\n            reseted_sell = false;\n            max_sell_profit = 0;\n        }\n    }\n\n    if(buy_ticket == -1 &amp;&amp; sell_ticket == -1) {\n        \/\/\u65b0\u898f\u6ce8\u6587\n        printf(\"rsi:%f\",rsi);\n        if(reseted_buy &amp;&amp;  macdMain > macdSig &amp;&amp; rsi > 50.0 &amp;&amp; (Ask - Bid) &lt; (ma21 - ma50) &amp;&amp; cci &lt; 100) {\n            \/\/if(reseted_buy &amp;&amp; rsi > 70.0 &amp;&amp; (Ask - Bid)&lt;(ma21-ma50)) {\n            if(Ask > ma21) {\n                \/\/if(Ask > ma21 &amp;&amp; Bid > ma21 &amp;&amp; ma21 > ma50) {\n                \/\/if(Ask > ma21 &amp;&amp; Bid > ma21 &amp;&amp; ma21 > ma50 &amp;&amp; ma50 > ma200) {\n                int ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, (uint)0.03, 0, 0, \"NEW Ask\", EA_NUMBER, 0, Blue);\n            }\n        }\n        if(reseted_sell &amp;&amp;  macdMain &lt; macdSig &amp;&amp; rsi &lt; 50.0 &amp;&amp; (Ask - Bid) &lt; (ma50 - ma21) &amp;&amp; cci > -100) {\n            \/\/if(reseted_sell &amp;&amp; rsi &lt; 30.0 &amp;&amp; (Ask - Bid)&lt;(ma50-ma21)) {\n            if(ma21 > Ask) {\n                \/\/if(ma21 > Ask &amp;&amp; ma21 > Bid &amp;&amp; ma50 > ma21) {\n                \/\/if(ma21 > Ask &amp;&amp; ma21 > Bid &amp;&amp; ma200 > ma50 &amp;&amp; ma50 > ma21) {\n                int ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, (uint)0.03, 0, 0, \"NEW Bid\", EA_NUMBER, 0, Red);\n            }\n        }\n    }\n}\n\/\/+------------------------------------------------------------------+\n\/\/|                                                                  |\n\/\/+------------------------------------------------------------------+\nbool closeOrder(double close_price,int close_ticket, double close_lots, color close_color) {\n    if(OrderClose(close_ticket, close_lots, close_price, (uint)0.3,close_color) == false) {\n        int err_code = GetLastError();\n        printf(\"\u6c7a\u6e08\u30a8\u30e9\u30fc&#91;%d],%s\", err_code, ErrorDescription(err_code));\n        return false;\n    }\n    return true;\n}\n\n\/\/+------------------------------------------------------------------+\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>EA\u4f5c\u3063\u3066\u307f\u307e\u3057\u305fHP\u3084Youtube\u3092\u3044\u304f\u3064\u304b\u53c2\u8003\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u9806\u5f35\u308a\u306eEA\u3067\u3059\uff12\uff10\uff12\uff12\u5e74\uff19\u6708\u304b\u3089\uff12\uff10\uff12\uff13\u5e74\uff19\u6708\u307e\u3067\u91d1\u3001\uff11\u4e07\u5186\u3001\u30de\u30a4\u30af\u30ed\u53e3\u5ea7\u3067\uff10\uff0e\uff11\u3067\u5b9f\u884c\uff01 \uff11\u4e07\u5186\u3067\u59cb\u3081\u3066\u3001\uff18\uff12\uff19\uff18\u5186\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u7d42\u308f\u3063\u3066\u307e\u3059\uff57\u4e00\u7b4b\u7e04 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":75,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[29,31,85,107],"class_list":["post-176","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fx","tag-ea","tag-fx","tag-85","tag-107"],"_links":{"self":[{"href":"https:\/\/wp.ano-hi.com\/index.php?rest_route=\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.ano-hi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.ano-hi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.ano-hi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.ano-hi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=176"}],"version-history":[{"count":0,"href":"https:\/\/wp.ano-hi.com\/index.php?rest_route=\/wp\/v2\/posts\/176\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wp.ano-hi.com\/index.php?rest_route=\/wp\/v2\/media\/75"}],"wp:attachment":[{"href":"https:\/\/wp.ano-hi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.ano-hi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.ano-hi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}