{"id":1026331,"date":"2024-12-31T10:41:43","date_gmt":"2024-12-31T02:41:43","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1026331.html"},"modified":"2024-12-31T10:41:46","modified_gmt":"2024-12-31T02:41:46","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e8%bf%9b%e8%a1%8cmt4%e4%ba%a4%e6%98%93","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1026331.html","title":{"rendered":"\u5982\u4f55\u7528python\u8fdb\u884cmt4\u4ea4\u6613"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/883d070b-9cfc-40b7-a9b6-e65c11268d58.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\u5982\u4f55\u7528python\u8fdb\u884cmt4\u4ea4\u6613\" \/><\/p>\n<p><p> <strong>\u5982\u4f55\u7528Python\u8fdb\u884cMT4\u4ea4\u6613<\/strong><\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528Python\u8fdb\u884cMT4\u4ea4\u6613\u7684\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528MetaTrader 4\u7684API\u3001\u4f7f\u7528MetaTrader 4\u7684MQL4\u8bed\u8a00\u7f16\u5199EA\u3001\u901a\u8fc7MT4\u7684\u6865\u63a5\u5de5\u5177\u8fde\u63a5Python\u4e0eMT4\u3001\u5229\u7528\u73b0\u6709\u7684Python\u5e93\uff08\u5982MetaTrader5\u5e93\uff09\u8fdb\u884c\u4ea4\u6613\u7b49\u3002<\/strong> \u4e0b\u9762\u5c06\u8be6\u7ec6\u63cf\u8ff0\u5176\u4e2d\u4e00\u79cd\u65b9\u6cd5\uff0c\u5373\u901a\u8fc7MT4\u7684API\u4e0ePython\u8fdb\u884c\u4ea4\u4e92\uff0c\u5b9e\u73b0\u81ea\u52a8\u5316\u4ea4\u6613\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u4f7f\u7528MetaTrader 4\u7684API<\/p>\n<\/p>\n<p><p>MetaTrader 4\uff08MT4\uff09\u662f\u4e00\u4e2a\u975e\u5e38\u6d41\u884c\u7684\u5916\u6c47\u4ea4\u6613\u5e73\u53f0\uff0c\u8bb8\u591a\u4ea4\u6613\u8005\u4f7f\u7528\u5b83\u8fdb\u884c\u81ea\u52a8\u5316\u4ea4\u6613\u3002\u4e3a\u4e86\u4f7f\u7528Python\u8fdb\u884cMT4\u4ea4\u6613\uff0c\u6211\u4eec\u9700\u8981\u501f\u52a9MT4\u7684API\u3002MetaTrader 4\u7684API\u5141\u8bb8\u5f00\u53d1\u4eba\u5458\u521b\u5efa\u81ea\u5b9a\u4e49\u7684\u4ea4\u6613\u7cfb\u7edf\uff0c\u81ea\u52a8\u5316\u4ea4\u6613\u7b56\u7565\uff0c\u5e76\u4eceMT4\u5e73\u53f0\u83b7\u53d6\u5e02\u573a\u6570\u636e\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><h3>1\u3001\u5b89\u88c5MetaTrader 4<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5728\u8ba1\u7b97\u673a\u4e0a\u5b89\u88c5MetaTrader 4\u3002\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u4eceMetaQuotes\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5MT4\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u786e\u4fdd\u4f60\u6709\u4e00\u4e2a\u6709\u6548\u7684\u4ea4\u6613\u8d26\u6237\uff0c\u5e76\u767b\u5f55MT4\u5e73\u53f0\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u5b89\u88c5\u5e76\u914d\u7f6eMetaTrader 4 Python Wrapper<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u5728Python\u4e2d\u4e0eMT4\u4ea4\u4e92\uff0c\u6211\u4eec\u9700\u8981\u4f7f\u7528\u4e00\u4e2aPython\u5e93\uff0c\u5982<code>MetaTrader5<\/code>\u3002\u8be5\u5e93\u63d0\u4f9b\u4e86\u4e0eMT4 API\u4ea4\u4e92\u7684\u529f\u80fd\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u8fd9\u4e2a\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install MetaTrader5<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u9700\u8981\u914d\u7f6e\u5e93\u4ee5\u8fde\u63a5\u5230MT4\u5e73\u53f0\u3002<\/p>\n<\/p>\n<p><h3>3\u3001\u7f16\u5199Python\u4ee3\u7801\u8fdb\u884c\u4ea4\u6613<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684Python\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528<code>MetaTrader5<\/code>\u5e93\u8fdb\u884cMT4\u4ea4\u6613\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import MetaTrader5 as mt5<\/p>\n<p>import time<\/p>\n<h2><strong>\u8fde\u63a5\u5230MetaTrader 5<\/strong><\/h2>\n<p>if not mt5.initialize():<\/p>\n<p>    print(&quot;\u521d\u59cb\u5316\u5931\u8d25&quot;)<\/p>\n<p>    mt5.shutdown()<\/p>\n<h2><strong>\u767b\u5f55\u5230\u4ea4\u6613\u8d26\u6237<\/strong><\/h2>\n<p>account = 12345678  # \u66ff\u6362\u4e3a\u4f60\u7684\u8d26\u6237\u53f7\u7801<\/p>\n<p>password = &quot;your_password&quot;  # \u66ff\u6362\u4e3a\u4f60\u7684\u8d26\u6237\u5bc6\u7801<\/p>\n<p>server = &quot;MetaQuotes-Demo&quot;  # \u66ff\u6362\u4e3a\u4f60\u7684\u670d\u52a1\u5668\u540d\u79f0<\/p>\n<p>if not mt5.login(account, password, server):<\/p>\n<p>    print(&quot;\u767b\u5f55\u5931\u8d25&quot;)<\/p>\n<p>    mt5.shutdown()<\/p>\n<h2><strong>\u83b7\u53d6\u5e02\u573a\u62a5\u4ef7<\/strong><\/h2>\n<p>symbol = &quot;EURUSD&quot;<\/p>\n<p>symbol_info = mt5.symbol_info(symbol)<\/p>\n<p>if symbol_info is None:<\/p>\n<p>    print(f&quot;{symbol} \u4e0d\u5b58\u5728\uff0c\u68c0\u67e5\u8f93\u5165\u662f\u5426\u6b63\u786e&quot;)<\/p>\n<p>    mt5.shutdown()<\/p>\n<h2><strong>\u786e\u4fdd\u5e02\u573a\u62a5\u4ef7\u53ef\u7528<\/strong><\/h2>\n<p>if not symbol_info.visible:<\/p>\n<p>    print(f&quot;{symbol} \u4e0d\u53ef\u89c1\uff0c\u5c1d\u8bd5\u4f7f\u5176\u53ef\u89c1&quot;)<\/p>\n<p>    if not mt5.symbol_select(symbol, True):<\/p>\n<p>        print(f&quot;\u65e0\u6cd5\u9009\u62e9 {symbol}&quot;)<\/p>\n<p>        mt5.shutdown()<\/p>\n<h2><strong>\u521b\u5efa\u4ea4\u6613\u8bf7\u6c42<\/strong><\/h2>\n<p>lot_size = 0.1<\/p>\n<p>price = mt5.symbol_info_tick(symbol).ask<\/p>\n<p>request = {<\/p>\n<p>    &quot;action&quot;: mt5.TRADE_ACTION_DEAL,<\/p>\n<p>    &quot;symbol&quot;: symbol,<\/p>\n<p>    &quot;volume&quot;: lot_size,<\/p>\n<p>    &quot;type&quot;: mt5.ORDER_TYPE_BUY,<\/p>\n<p>    &quot;price&quot;: price,<\/p>\n<p>    &quot;deviation&quot;: 20,<\/p>\n<p>    &quot;magic&quot;: 234000,<\/p>\n<p>    &quot;comment&quot;: &quot;Python script open&quot;,<\/p>\n<p>    &quot;type_time&quot;: mt5.ORDER_TIME_GTC,<\/p>\n<p>    &quot;type_filling&quot;: mt5.ORDER_FILLING_RETURN,<\/p>\n<p>}<\/p>\n<h2><strong>\u53d1\u9001\u4ea4\u6613\u8bf7\u6c42<\/strong><\/h2>\n<p>result = mt5.order_send(request)<\/p>\n<h2><strong>\u68c0\u67e5\u4ea4\u6613\u7ed3\u679c<\/strong><\/h2>\n<p>if result.retcode != mt5.TRADE_RETCODE_DONE:<\/p>\n<p>    print(f&quot;\u4ea4\u6613\u5931\u8d25\uff0c\u9519\u8bef\u4ee3\u7801: {result.retcode}&quot;)<\/p>\n<p>else:<\/p>\n<p>    print(f&quot;\u4ea4\u6613\u6210\u529f\uff0c\u8ba2\u5355\u53f7: {result.order}&quot;)<\/p>\n<h2><strong>\u65ad\u5f00\u4e0eMetaTrader 5\u7684\u8fde\u63a5<\/strong><\/h2>\n<p>mt5.shutdown()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>4\u3001\u6267\u884cPython\u4ee3\u7801<\/h3>\n<\/p>\n<p><p>\u5c06\u4e0a\u8ff0\u4ee3\u7801\u4fdd\u5b58\u4e3a\u4e00\u4e2aPython\u811a\u672c\u6587\u4ef6\uff08\u4f8b\u5982<code>mt4_trade.py<\/code>\uff09\uff0c\u7136\u540e\u5728\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8fd0\u884c\u8be5\u811a\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python mt4_trade.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>5\u3001\u76d1\u63a7\u4ea4\u6613\u7ed3\u679c<\/h3>\n<\/p>\n<p><p>\u6267\u884c\u811a\u672c\u540e\uff0c\u4f60\u53ef\u4ee5\u5728MetaTrader 4\u5e73\u53f0\u4e0a\u67e5\u770b\u4ea4\u6613\u7ed3\u679c\u3002\u786e\u4fdd\u4f60\u7684\u4ea4\u6613\u8d26\u6237\u6709\u8db3\u591f\u7684\u8d44\u91d1\uff0c\u5e76\u4e14\u4ea4\u6613\u53c2\u6570\uff08\u5982\u7b26\u53f7\u3001\u624b\u6570\uff09\u8bbe\u7f6e\u6b63\u786e\u3002<\/p>\n<\/p>\n<p><h3>6\u3001\u8bbe\u7f6e\u81ea\u52a8\u5316\u4ea4\u6613\u7b56\u7565<\/h3>\n<\/p>\n<p><p>\u4f60\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u4ea4\u6613\u7b56\u7565\uff0c\u4fee\u6539\u4e0a\u8ff0\u4ee3\u7801\u4e2d\u7684\u4ea4\u6613\u903b\u8f91\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u901a\u8fc7\u6280\u672f\u6307\u6807\uff08\u5982\u5747\u7ebf\u3001\u76f8\u5bf9\u5f3a\u5f31\u6307\u6570\u7b49\uff09\u6765\u51b3\u5b9a\u4e70\u5356\u65f6\u673a\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528\u79fb\u52a8\u5e73\u5747\u7ebf\u7b56\u7565\u8fdb\u884c\u4ea4\u6613\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import MetaTrader5 as mt5<\/p>\n<p>import pandas as pd<\/p>\n<p>import time<\/p>\n<h2><strong>\u8fde\u63a5\u5230MetaTrader 5<\/strong><\/h2>\n<p>if not mt5.initialize():<\/p>\n<p>    print(&quot;\u521d\u59cb\u5316\u5931\u8d25&quot;)<\/p>\n<p>    mt5.shutdown()<\/p>\n<h2><strong>\u767b\u5f55\u5230\u4ea4\u6613\u8d26\u6237<\/strong><\/h2>\n<p>account = 12345678  # \u66ff\u6362\u4e3a\u4f60\u7684\u8d26\u6237\u53f7\u7801<\/p>\n<p>password = &quot;your_password&quot;  # \u66ff\u6362\u4e3a\u4f60\u7684\u8d26\u6237\u5bc6\u7801<\/p>\n<p>server = &quot;MetaQuotes-Demo&quot;  # \u66ff\u6362\u4e3a\u4f60\u7684\u670d\u52a1\u5668\u540d\u79f0<\/p>\n<p>if not mt5.login(account, password, server):<\/p>\n<p>    print(&quot;\u767b\u5f55\u5931\u8d25&quot;)<\/p>\n<p>    mt5.shutdown()<\/p>\n<h2><strong>\u83b7\u53d6\u5e02\u573a\u62a5\u4ef7<\/strong><\/h2>\n<p>symbol = &quot;EURUSD&quot;<\/p>\n<p>symbol_info = mt5.symbol_info(symbol)<\/p>\n<p>if symbol_info is None:<\/p>\n<p>    print(f&quot;{symbol} \u4e0d\u5b58\u5728\uff0c\u68c0\u67e5\u8f93\u5165\u662f\u5426\u6b63\u786e&quot;)<\/p>\n<p>    mt5.shutdown()<\/p>\n<h2><strong>\u786e\u4fdd\u5e02\u573a\u62a5\u4ef7\u53ef\u7528<\/strong><\/h2>\n<p>if not symbol_info.visible:<\/p>\n<p>    print(f&quot;{symbol} \u4e0d\u53ef\u89c1\uff0c\u5c1d\u8bd5\u4f7f\u5176\u53ef\u89c1&quot;)<\/p>\n<p>    if not mt5.symbol_select(symbol, True):<\/p>\n<p>        print(f&quot;\u65e0\u6cd5\u9009\u62e9 {symbol}&quot;)<\/p>\n<p>        mt5.shutdown()<\/p>\n<h2><strong>\u5b9a\u4e49\u79fb\u52a8\u5e73\u5747\u7ebf\u53c2\u6570<\/strong><\/h2>\n<p>short_window = 20<\/p>\n<p>long_window = 50<\/p>\n<h2><strong>\u83b7\u53d6\u5386\u53f2\u6570\u636e<\/strong><\/h2>\n<p>rates = mt5.copy_rates_from_pos(symbol, mt5.TIMEFRAME_M1, 0, 100)<\/p>\n<h2><strong>\u5c06\u5386\u53f2\u6570\u636e\u8f6c\u6362\u4e3apandas DataFrame<\/strong><\/h2>\n<p>data = pd.DataFrame(rates)<\/p>\n<p>data[&#39;time&#39;] = pd.to_datetime(data[&#39;time&#39;], unit=&#39;s&#39;)<\/p>\n<p>data.set_index(&#39;time&#39;, inplace=True)<\/p>\n<h2><strong>\u8ba1\u7b97\u79fb\u52a8\u5e73\u5747\u7ebf<\/strong><\/h2>\n<p>data[&#39;short_ma&#39;] = data[&#39;close&#39;].rolling(window=short_window).mean()<\/p>\n<p>data[&#39;long_ma&#39;] = data[&#39;close&#39;].rolling(window=long_window).mean()<\/p>\n<h2><strong>\u68c0\u67e5\u4e70\u5356\u4fe1\u53f7<\/strong><\/h2>\n<p>if data[&#39;short_ma&#39;].iloc[-1] &gt; data[&#39;long_ma&#39;].iloc[-1]:<\/p>\n<p>    # \u521b\u5efa\u4e70\u5165\u8bf7\u6c42<\/p>\n<p>    lot_size = 0.1<\/p>\n<p>    price = mt5.symbol_info_tick(symbol).ask<\/p>\n<p>    request = {<\/p>\n<p>        &quot;action&quot;: mt5.TRADE_ACTION_DEAL,<\/p>\n<p>        &quot;symbol&quot;: symbol,<\/p>\n<p>        &quot;volume&quot;: lot_size,<\/p>\n<p>        &quot;type&quot;: mt5.ORDER_TYPE_BUY,<\/p>\n<p>        &quot;price&quot;: price,<\/p>\n<p>        &quot;deviation&quot;: 20,<\/p>\n<p>        &quot;magic&quot;: 234000,<\/p>\n<p>        &quot;comment&quot;: &quot;Python script open&quot;,<\/p>\n<p>        &quot;type_time&quot;: mt5.ORDER_TIME_GTC,<\/p>\n<p>        &quot;type_filling&quot;: mt5.ORDER_FILLING_RETURN,<\/p>\n<p>    }<\/p>\n<p>    # \u53d1\u9001\u4ea4\u6613\u8bf7\u6c42<\/p>\n<p>    result = mt5.order_send(request)<\/p>\n<p>    # \u68c0\u67e5\u4ea4\u6613\u7ed3\u679c<\/p>\n<p>    if result.retcode != mt5.TRADE_RETCODE_DONE:<\/p>\n<p>        print(f&quot;\u4ea4\u6613\u5931\u8d25\uff0c\u9519\u8bef\u4ee3\u7801: {result.retcode}&quot;)<\/p>\n<p>    else:<\/p>\n<p>        print(f&quot;\u4ea4\u6613\u6210\u529f\uff0c\u8ba2\u5355\u53f7: {result.order}&quot;)<\/p>\n<p>elif data[&#39;short_ma&#39;].iloc[-1] &lt; data[&#39;long_ma&#39;].iloc[-1]:<\/p>\n<p>    # \u521b\u5efa\u5356\u51fa\u8bf7\u6c42<\/p>\n<p>    lot_size = 0.1<\/p>\n<p>    price = mt5.symbol_info_tick(symbol).bid<\/p>\n<p>    request = {<\/p>\n<p>        &quot;action&quot;: mt5.TRADE_ACTION_DEAL,<\/p>\n<p>        &quot;symbol&quot;: symbol,<\/p>\n<p>        &quot;volume&quot;: lot_size,<\/p>\n<p>        &quot;type&quot;: mt5.ORDER_TYPE_SELL,<\/p>\n<p>        &quot;price&quot;: price,<\/p>\n<p>        &quot;deviation&quot;: 20,<\/p>\n<p>        &quot;magic&quot;: 234000,<\/p>\n<p>        &quot;comment&quot;: &quot;Python script open&quot;,<\/p>\n<p>        &quot;type_time&quot;: mt5.ORDER_TIME_GTC,<\/p>\n<p>        &quot;type_filling&quot;: mt5.ORDER_FILLING_RETURN,<\/p>\n<p>    }<\/p>\n<p>    # \u53d1\u9001\u4ea4\u6613\u8bf7\u6c42<\/p>\n<p>    result = mt5.order_send(request)<\/p>\n<p>    # \u68c0\u67e5\u4ea4\u6613\u7ed3\u679c<\/p>\n<p>    if result.retcode != mt5.TRADE_RETCODE_DONE:<\/p>\n<p>        print(f&quot;\u4ea4\u6613\u5931\u8d25\uff0c\u9519\u8bef\u4ee3\u7801: {result.retcode}&quot;)<\/p>\n<p>    else:<\/p>\n<p>        print(f&quot;\u4ea4\u6613\u6210\u529f\uff0c\u8ba2\u5355\u53f7: {result.order}&quot;)<\/p>\n<h2><strong>\u65ad\u5f00\u4e0eMetaTrader 5\u7684\u8fde\u63a5<\/strong><\/h2>\n<p>mt5.shutdown()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528\u4e86\u7b80\u5355\u7684\u79fb\u52a8\u5e73\u5747\u7ebf\u7b56\u7565\u6765\u51b3\u5b9a\u4e70\u5356\u65f6\u673a\u3002\u5f53\u77ed\u671f\u79fb\u52a8\u5e73\u5747\u7ebf\uff0820\u671f\uff09\u9ad8\u4e8e\u957f\u671f\u79fb\u52a8\u5e73\u5747\u7ebf\uff0850\u671f\uff09\u65f6\uff0c\u6211\u4eec\u4f1a\u53d1\u9001\u4e70\u5165\u8ba2\u5355\uff1b\u5f53\u77ed\u671f\u79fb\u52a8\u5e73\u5747\u7ebf\u4f4e\u4e8e\u957f\u671f\u79fb\u52a8\u5e73\u5747\u7ebf\u65f6\uff0c\u6211\u4eec\u4f1a\u53d1\u9001\u5356\u51fa\u8ba2\u5355\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528MetaTrader 4\u7684MQL4\u8bed\u8a00\u7f16\u5199EA<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u76f4\u63a5\u4f7f\u7528Python\u4e0eMT4 API\u4ea4\u4e92\u5916\uff0c\u53e6\u4e00\u79cd\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u4f7f\u7528MetaTrader 4\u7684MQL4\u8bed\u8a00\u7f16\u5199\u4ea4\u6613\u673a\u5668\u4eba\uff08EA\uff09\u3002\u7136\u540e\uff0c\u901a\u8fc7Python\u811a\u672c\u63a7\u5236EA\u7684\u8fd0\u884c\u3002\u4f8b\u5982\uff0c\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684EA\u6765\u5904\u7406\u4e70\u5356\u4fe1\u53f7\uff0c\u5e76\u901a\u8fc7Python\u811a\u672c\u53d1\u9001\u4ea4\u6613\u6307\u4ee4\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u7f16\u5199MQL4 EA<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5728MetaTrader 4\u5e73\u53f0\u4e0a\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684EA\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u7f16\u5199\u4e00\u4e2aEA\u6765\u5904\u7406\u4e70\u5356\u4fe1\u53f7\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-mql4\">\/\/+------------------------------------------------------------------+<\/p>\n<p>\/\/|                                                   SimpleEA.mq4   |<\/p>\n<p>\/\/|                        Copyright 2021, MetaQuotes Software Corp. |<\/p>\n<p>\/\/|                                       http:\/\/www.metaquotes.net\/ |<\/p>\n<p>\/\/+------------------------------------------------------------------+<\/p>\n<p>#property strict<\/p>\n<p>\/\/ \u5b9a\u4e49\u5168\u5c40\u53d8\u91cf<\/p>\n<p>double shortMA, longMA;<\/p>\n<p>int shortWindow = 20;<\/p>\n<p>int longWindow = 50;<\/p>\n<p>\/\/+------------------------------------------------------------------+<\/p>\n<p>\/\/| Expert initialization function                                   |<\/p>\n<p>\/\/+------------------------------------------------------------------+<\/p>\n<p>int OnInit()<\/p>\n<p>  {<\/p>\n<p>   \/\/ \u521d\u59cb\u5316\u51fd\u6570<\/p>\n<p>   return(INIT_SUCCEEDED);<\/p>\n<p>  }<\/p>\n<p>\/\/+------------------------------------------------------------------+<\/p>\n<p>\/\/| Expert deinitialization function                                 |<\/p>\n<p>\/\/+------------------------------------------------------------------+<\/p>\n<p>void OnDeinit(const int reason)<\/p>\n<p>  {<\/p>\n<p>   \/\/ \u53bb\u521d\u59cb\u5316\u51fd\u6570<\/p>\n<p>  }<\/p>\n<p>\/\/+------------------------------------------------------------------+<\/p>\n<p>\/\/| Expert tick function                                             |<\/p>\n<p>\/\/+------------------------------------------------------------------+<\/p>\n<p>void OnTick()<\/p>\n<p>  {<\/p>\n<p>   \/\/ \u83b7\u53d6\u5f53\u524d\u4ef7\u683c<\/p>\n<p>   double price = iClose(Symbol(), 0, 0);<\/p>\n<p>   \/\/ \u8ba1\u7b97\u79fb\u52a8\u5e73\u5747\u7ebf<\/p>\n<p>   shortMA = iMA(Symbol(), 0, shortWindow, 0, MODE_SMA, PRICE_CLOSE, 0);<\/p>\n<p>   longMA = iMA(Symbol(), 0, longWindow, 0, MODE_SMA, PRICE_CLOSE, 0);<\/p>\n<p>   \/\/ \u68c0\u67e5\u4e70\u5356\u4fe1\u53f7<\/p>\n<p>   if(shortMA &gt; longMA)<\/p>\n<p>     {<\/p>\n<p>      \/\/ \u4e70\u5165\u4fe1\u53f7<\/p>\n<p>      OrderSend(Symbol(), OP_BUY, 0.1, Ask, 10, 0, 0, &quot;Buy Order&quot;, 0, 0, Blue);<\/p>\n<p>     }<\/p>\n<p>   else if(shortMA &lt; longMA)<\/p>\n<p>     {<\/p>\n<p>      \/\/ \u5356\u51fa\u4fe1\u53f7<\/p>\n<p>      OrderSend(Symbol(), OP_SELL, 0.1, Bid, 10, 0, 0, &quot;Sell Order&quot;, 0, 0, Red);<\/p>\n<p>     }<\/p>\n<p>  }<\/p>\n<p>\/\/+------------------------------------------------------------------+<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5c06\u4e0a\u8ff0\u4ee3\u7801\u4fdd\u5b58\u4e3a<code>SimpleEA.mq4<\/code>\uff0c\u5e76\u5c06\u5176\u653e\u7f6e\u5728MetaTrader 4\u7684<code>Experts<\/code>\u6587\u4ef6\u5939\u4e2d\u3002\u7136\u540e\u5728MetaTrader 4\u5e73\u53f0\u4e0a\u7f16\u8bd1\u5e76\u8fd0\u884c\u8be5EA\u3002<\/p>\n<\/p>\n<p><h3>2\u3001\u901a\u8fc7Python\u63a7\u5236EA<\/h3>\n<\/p>\n<p><p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Python\u811a\u672c\u4e0eMT4\u5e73\u53f0\u8fdb\u884c\u4ea4\u4e92\uff0c\u5e76\u901a\u8fc7\u53d1\u9001\u7279\u5b9a\u7684\u4fe1\u53f7\u6765\u63a7\u5236EA\u7684\u8fd0\u884c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684Python\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u901a\u8fc7Python\u63a7\u5236EA\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import MetaTrader5 as mt5<\/p>\n<p>import time<\/p>\n<h2><strong>\u8fde\u63a5\u5230MetaTrader 5<\/strong><\/h2>\n<p>if not mt5.initialize():<\/p>\n<p>    print(&quot;\u521d\u59cb\u5316\u5931\u8d25&quot;)<\/p>\n<p>    mt5.shutdown()<\/p>\n<h2><strong>\u767b\u5f55\u5230\u4ea4\u6613\u8d26\u6237<\/strong><\/h2>\n<p>account = 12345678  # \u66ff\u6362\u4e3a\u4f60\u7684\u8d26\u6237\u53f7\u7801<\/p>\n<p>password = &quot;your_password&quot;  # \u66ff\u6362\u4e3a\u4f60\u7684\u8d26\u6237\u5bc6\u7801<\/p>\n<p>server = &quot;MetaQuotes-Demo&quot;  # \u66ff\u6362\u4e3a\u4f60\u7684\u670d\u52a1\u5668\u540d\u79f0<\/p>\n<p>if not mt5.login(account, password, server):<\/p>\n<p>    print(&quot;\u767b\u5f55\u5931\u8d25&quot;)<\/p>\n<p>    mt5.shutdown()<\/p>\n<h2><strong>\u53d1\u9001\u4fe1\u53f7\u7ed9EA<\/strong><\/h2>\n<p>def send_signal(signal):<\/p>\n<p>    global account<\/p>\n<p>    global password<\/p>\n<p>    global server<\/p>\n<p>    if not mt5.login(account, password, server):<\/p>\n<p>        print(&quot;\u767b\u5f55\u5931\u8d25&quot;)<\/p>\n<p>        mt5.shutdown()<\/p>\n<p>    symbol = &quot;EURUSD&quot;<\/p>\n<p>    symbol_info = mt5.symbol_info(symbol)<\/p>\n<p>    if symbol_info is None:<\/p>\n<p>        print(f&quot;{symbol} \u4e0d\u5b58\u5728\uff0c\u68c0\u67e5\u8f93\u5165\u662f\u5426\u6b63\u786e&quot;)<\/p>\n<p>        mt5.shutdown()<\/p>\n<p>    if signal == &quot;buy&quot;:<\/p>\n<p>        # \u53d1\u9001\u4e70\u5165\u4fe1\u53f7<\/p>\n<p>        lot_size = 0.1<\/p>\n<p>        price = mt5.symbol_info_tick(symbol).ask<\/p>\n<p>        request = {<\/p>\n<p>            &quot;action&quot;: mt5.TRADE_ACTION_DEAL,<\/p>\n<p>            &quot;symbol&quot;: symbol,<\/p>\n<p>            &quot;volume&quot;: lot_size,<\/p>\n<p>            &quot;type&quot;: mt5.ORDER_TYPE_BUY,<\/p>\n<p>            &quot;price&quot;: price,<\/p>\n<p>            &quot;deviation&quot;: 20,<\/p>\n<p>            &quot;magic&quot;: 234000,<\/p>\n<p>            &quot;comment&quot;: &quot;Python script open&quot;,<\/p>\n<p>            &quot;type_time&quot;: mt5.ORDER_TIME_GTC,<\/p>\n<p>            &quot;type_filling&quot;: mt5.ORDER_FILLING_RETURN,<\/p>\n<p>        }<\/p>\n<p>        result = mt5.order_send(request)<\/p>\n<p>        if result.retcode != mt5.TRADE_RETCODE_DONE:<\/p>\n<p>            print(f&quot;\u4ea4\u6613\u5931\u8d25\uff0c\u9519\u8bef\u4ee3\u7801: {result.retcode}&quot;)<\/p>\n<p>        else:<\/p>\n<p>            print(f&quot;\u4ea4\u6613\u6210\u529f\uff0c\u8ba2\u5355\u53f7: {result.order}&quot;)<\/p>\n<p>    elif signal == &quot;sell&quot;:<\/p>\n<p>        # \u53d1\u9001\u5356\u51fa\u4fe1\u53f7<\/p>\n<p>        lot_size = 0.1<\/p>\n<p>        price = mt5.symbol_info_tick(symbol).bid<\/p>\n<p>        request = {<\/p>\n<p>            &quot;action&quot;: mt5.TRADE_ACTION_DEAL,<\/p>\n<p>            &quot;symbol&quot;: symbol,<\/p>\n<p>            &quot;volume&quot;: lot_size,<\/p>\n<p>            &quot;type&quot;: mt5.ORDER_TYPE_SELL,<\/p>\n<p>            &quot;price&quot;: price,<\/p>\n<p>            &quot;deviation&quot;: 20,<\/p>\n<p>            &quot;magic&quot;: 234000,<\/p>\n<p>            &quot;comment&quot;: &quot;Python script open&quot;,<\/p>\n<p>            &quot;type_time&quot;: mt5.ORDER_TIME_GTC,<\/p>\n<p>            &quot;type_filling&quot;: mt5.ORDER_FILLING_RETURN,<\/p>\n<p>        }<\/p>\n<p>        result = mt5.order_send(request)<\/p>\n<p>        if result.retcode != mt5.TRADE_RETCODE_DONE:<\/p>\n<p>            print(f&quot;\u4ea4\u6613\u5931\u8d25\uff0c\u9519\u8bef\u4ee3\u7801: {result.retcode}&quot;)<\/p>\n<p>        else:<\/p>\n<p>            print(f&quot;\u4ea4\u6613\u6210\u529f\uff0c\u8ba2\u5355\u53f7: {result.order}&quot;)<\/p>\n<h2><strong>\u793a\u4f8b\uff1a\u53d1\u9001\u4e70\u5165\u4fe1\u53f7<\/strong><\/h2>\n<p>send_signal(&quot;buy&quot;)<\/p>\n<h2><strong>\u65ad\u5f00\u4e0eMetaTrader 5\u7684\u8fde\u63a5<\/strong><\/h2>\n<p>mt5.shutdown()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e09\u3001\u901a\u8fc7MT4\u7684\u6865\u63a5\u5de5\u5177\u8fde\u63a5Python\u4e0eMT4<\/p>\n<\/p>\n<p><p>\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528MT4\u7684\u6865\u63a5\u5de5\u5177\uff0c\u5c06Python\u4e0eMT4\u5e73\u53f0\u8fde\u63a5\u8d77\u6765\u3002\u8fd9\u4e9b\u5de5\u5177\u901a\u5e38\u63d0\u4f9b\u4e86\u4e00\u4e2a\u4e2d\u95f4\u5c42\uff0c\u4f7f\u5f97Python\u811a\u672c\u53ef\u4ee5\u4e0eMT4\u5e73\u53f0\u8fdb\u884c\u901a\u4fe1\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528<code>ZeroMQ<\/code>\u7b49\u6865\u63a5\u5de5\u5177\u3002<\/p>\n<\/p>\n<p><h3>1\u3001\u5b89\u88c5ZeroMQ<\/h3>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u5b89\u88c5ZeroMQ\u5e93\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install pyzmq<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>2\u3001\u914d\u7f6eMT4<\/h3>\n<\/p>\n<p><p>\u5728MT4\u5e73\u53f0\u4e0a\uff0c\u4f60\u9700\u8981\u914d\u7f6eZeroMQ\u4ee5\u63a5\u53d7\u6765\u81eaPython\u7684\u4fe1\u53f7\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u5728MQL4\u4ee3\u7801\u4e2d\u4f7f\u7528ZeroMQ\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-mql4\">#include &lt;ZeroMQ.mqh&gt;<\/p>\n<p>void OnTick()<\/p>\n<p>  {<\/p>\n<p>   \/\/ \u521d\u59cb\u5316ZeroMQ<\/p>\n<p>   zmq::context_t context(1);<\/p>\n<p>   zmq::socket_t socket(context, ZMQ_REP);<\/p>\n<p>   socket.bind(&quot;tcp:\/\/*:5555&quot;);<\/p>\n<p>   while(true)<\/p>\n<p>     {<\/p>\n<p>      zmq::message_t request;<\/p>\n<p>      socket.recv(&amp;request);<\/p>\n<p>      std::string signal = std::string(static_cast&lt;char*&gt;(request.data()), request.size());<\/p>\n<p>      if(signal == &quot;buy&quot;)<\/p>\n<p>        {<\/p>\n<p>         \/\/ \u6267\u884c\u4e70\u5165\u64cd\u4f5c<\/p>\n<p>         OrderSend(Symbol(), OP_BUY, 0.1, Ask, 10, 0, 0, &quot;Buy Order&quot;, 0, 0, Blue);<\/p>\n<p>        }<\/p>\n<p>      else if(signal == &quot;sell&quot;)<\/p>\n<p>        {<\/p>\n<p>         \/\/ \u6267\u884c\u5356\u51fa\u64cd\u4f5c<\/p>\n<p>         OrderSend(Symbol(), OP_SELL, 0.1, Bid, 10, 0, 0, &quot;Sell Order&quot;, 0, 0, Red);<\/p>\n<p>        }<\/p>\n<p>      zmq::message_t reply(5);<\/p>\n<p>      memcpy(reply.data(), &quot;Done&quot;, 5);<\/p>\n<p>      socket.send(reply);<\/p>\n<p>     }<\/p>\n<p>  }<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>3\u3001\u901a\u8fc7Python\u53d1\u9001\u4fe1\u53f7<\/h3>\n<\/p>\n<p><p>\u5728Python\u811a\u672c\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528ZeroMQ\u53d1\u9001\u4fe1\u53f7\u7ed9MT4\u5e73\u53f0\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import zmq<\/p>\n<h2><strong>\u521b\u5efaZeroMQ\u4e0a\u4e0b\u6587<\/strong><\/h2>\n<p>context = zmq.Context()<\/p>\n<h2><strong>\u521b\u5efaZeroMQ\u5957\u63a5\u5b57<\/strong><\/h2>\n<p>socket = context.socket(zmq.REQ)<\/p>\n<p>socket.connect(&quot;tcp:\/\/localhost:5555&quot;)<\/p>\n<h2><strong>\u53d1\u9001\u4e70\u5165\u4fe1\u53f7<\/strong><\/h2>\n<p>socket.send_string(&quot;buy&quot;)<\/p>\n<h2><strong>\u63a5\u6536\u54cd\u5e94<\/strong><\/h2>\n<p>message = socket.recv()<\/p>\n<p>print(f&quot;Received reply: {message}&quot;)<\/p>\n<h2><strong>\u53d1\u9001\u5356\u51fa\u4fe1\u53f7<\/strong><\/h2>\n<p>socket.send_string(&quot;sell&quot;)<\/p>\n<h2><strong>\u63a5\u6536\u54cd\u5e94<\/strong><\/h2>\n<p>message = socket.recv()<\/p>\n<p>print(f&quot;Received reply: {message}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u4f7f\u7528Python\u8fdb\u884cMT4\u4ea4\u6613\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u4f7f\u7528MetaTrader 4\u7684API\u3001\u4f7f\u7528MetaTrader 4\u7684MQL4\u8bed\u8a00\u7f16\u5199EA\u3001\u901a\u8fc7MT4\u7684\u6865\u63a5\u5de5\u5177\u8fde\u63a5Python\u4e0eMT4\u3001\u5229\u7528\u73b0\u6709\u7684Python\u5e93\uff08\u5982MetaTrader5\u5e93\uff09\u8fdb\u884c\u4ea4\u6613\u7b49\u3002\u672c\u6587\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5176\u4e2d\u51e0\u79cd\u65b9\u6cd5\uff0c\u5e76\u63d0\u4f9b\u4e86\u4ee3\u7801\u793a\u4f8b\u3002\u901a\u8fc7\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u5b9e\u73b0\u81ea\u52a8\u5316\u4ea4\u6613\u7b56\u7565\uff0c\u5e76\u5728MT4\u5e73\u53f0\u4e0a\u8fdb\u884c\u4ea4\u6613\u3002\u5e0c\u671b\u672c\u6587\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5728Python\u4e2d\u5982\u4f55\u8fde\u63a5MT4\u8fdb\u884c\u4ea4\u6613\uff1f<\/strong><br \/>\u8981\u5728Python\u4e2d\u8fde\u63a5MT4\u8fdb\u884c\u4ea4\u6613\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528MetaTrader 4\u7684API\u63a5\u53e3\u3002\u9996\u5148\uff0c\u786e\u4fdd\u60a8\u5df2\u7ecf\u5b89\u88c5\u4e86MetaTrader 4\uff0c\u5e76\u4e14\u80fd\u591f\u8bbf\u95ee\u5176MQL4\u7f16\u7a0b\u73af\u5883\u3002\u63a5\u7740\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528Python\u7684<code>MetaTrader5<\/code>\u5e93\u6216\u5176\u4ed6\u76f8\u5173\u5e93\u6765\u8fde\u63a5MT4\u3002\u901a\u8fc7\u7f16\u5199Python\u811a\u672c\uff0c\u60a8\u53ef\u4ee5\u5b9e\u73b0\u767b\u5f55\u3001\u4e0b\u5355\u3001\u67e5\u8be2\u8d26\u6237\u4fe1\u606f\u7b49\u529f\u80fd\u3002<\/p>\n<p><strong>\u4f7f\u7528Python\u8fdb\u884cMT4\u4ea4\u6613\u7684\u4e3b\u8981\u6b65\u9aa4\u6709\u54ea\u4e9b\uff1f<\/strong><br \/>\u8fdb\u884cMT4\u4ea4\u6613\u7684\u4e3b\u8981\u6b65\u9aa4\u5305\u62ec\uff1a\u5b89\u88c5MetaTrader 4\u53ca\u5176Python\u63a5\u53e3\u5e93\uff0c\u914d\u7f6eAPI\u8bbf\u95ee\u6743\u9650\uff0c\u7f16\u5199Python\u4ee3\u7801\u8fdb\u884c\u767b\u5f55\uff0c\u6267\u884c\u4ea4\u6613\u6307\u4ee4\uff08\u5982\u4e70\u5165\u548c\u5356\u51fa\uff09\uff0c\u4ee5\u53ca\u76d1\u63a7\u4ea4\u6613\u72b6\u6001\u548c\u83b7\u53d6\u5b9e\u65f6\u6570\u636e\u3002\u5728\u4ee3\u7801\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u51fd\u6570\u6765\u7ba1\u7406\u8ba2\u5355\u548c\u83b7\u53d6\u5e02\u573a\u884c\u60c5\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u6267\u884c\u4ea4\u6613\u7b56\u7565\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u5982\u4f55\u5b9e\u73b0\u81ea\u52a8\u5316\u4ea4\u6613\uff1f<\/strong><br \/>\u5b9e\u73b0\u81ea\u52a8\u5316\u4ea4\u6613\u7684\u5173\u952e\u5728\u4e8e\u7f16\u5199\u6709\u6548\u7684\u4ea4\u6613\u7b56\u7565\u548c\u7a0b\u5e8f\u903b\u8f91\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528Python\u5b9e\u73b0\u6280\u672f\u6307\u6807\u7684\u8ba1\u7b97\u3001\u4fe1\u53f7\u751f\u6210\u4ee5\u53ca\u4e0b\u5355\u903b\u8f91\u3002\u7ed3\u5408\u5386\u53f2\u6570\u636e\u5206\u6790\u548c\u5b9e\u65f6\u884c\u60c5\u76d1\u63a7\uff0c\u60a8\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684\u4ea4\u6613\u7cfb\u7edf\u3002\u5efa\u8bae\u4f7f\u7528\u5982Pandas\u548cNumPy\u7b49\u6570\u636e\u5206\u6790\u5e93\u6765\u5904\u7406\u6570\u636e\uff0c\u63d0\u9ad8\u7b56\u7565\u7684\u51c6\u786e\u6027\u548c\u6267\u884c\u6548\u7387\u3002<\/p>\n<p><strong>\u5728Python\u4e2d\u8fdb\u884cMT4\u4ea4\u6613\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u98ce\u9669\uff1f<\/strong><br \/>\u5728\u4f7f\u7528Python\u8fdb\u884cMT4\u4ea4\u6613\u65f6\uff0c\u98ce\u9669\u7ba1\u7406\u81f3\u5173\u91cd\u8981\u3002\u786e\u4fdd\u60a8\u5bf9\u5e02\u573a\u6709\u5145\u5206\u7684\u7406\u89e3\uff0c\u5236\u5b9a\u5408\u7406\u7684\u6b62\u635f\u548c\u6b62\u76c8\u7b56\u7565\u3002\u6b64\u5916\uff0c\u76d1\u63a7\u4ea4\u6613\u7cfb\u7edf\u7684\u6027\u80fd\uff0c\u907f\u514d\u8fc7\u5ea6\u6760\u6746\u548c\u9ad8\u9891\u4ea4\u6613\u5e26\u6765\u7684\u98ce\u9669\u3002\u5b9a\u671f\u56de\u6d4b\u548c\u4f18\u5316\u4ea4\u6613\u7b56\u7565\uff0c\u53ef\u4ee5\u5e2e\u52a9\u60a8\u66f4\u597d\u5730\u5e94\u5bf9\u5e02\u573a\u6ce2\u52a8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5982\u4f55\u7528Python\u8fdb\u884cMT4\u4ea4\u6613 \u4f7f\u7528Python\u8fdb\u884cMT4\u4ea4\u6613\u7684\u65b9\u6cd5\u6709\uff1a\u4f7f\u7528MetaTrader 4\u7684API [&hellip;]","protected":false},"author":3,"featured_media":1026344,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1026331"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1026331"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1026331\/revisions"}],"predecessor-version":[{"id":1026345,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1026331\/revisions\/1026345"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1026344"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1026331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1026331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1026331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}