{"id":1892,"date":"2025-02-11T07:58:00","date_gmt":"2025-02-10T23:58:00","guid":{"rendered":"https:\/\/blog.laoyulaoyu.top\/?p=1892"},"modified":"2025-01-12T19:23:47","modified_gmt":"2025-01-12T11:23:47","slug":"%e6%9c%ba%e5%99%a8%e5%ad%a6%e4%b9%a0sma-ema%ef%bc%9a%e8%8b%b9%e6%9e%9c%e8%82%a1%e7%a5%a8%e8%87%aa%e5%8a%a8%e6%ad%a2%e7%9b%88%e7%ad%96%e7%95%a5%ef%bc%8c%e6%94%b6%e7%9b%8a%e6%8f%90%e5%8d%8750%ef%bc%81","status":"publish","type":"post","link":"https:\/\/laoyulaoyu.com\/index.php\/2025\/02\/11\/%e6%9c%ba%e5%99%a8%e5%ad%a6%e4%b9%a0sma-ema%ef%bc%9a%e8%8b%b9%e6%9e%9c%e8%82%a1%e7%a5%a8%e8%87%aa%e5%8a%a8%e6%ad%a2%e7%9b%88%e7%ad%96%e7%95%a5%ef%bc%8c%e6%94%b6%e7%9b%8a%e6%8f%90%e5%8d%8750%ef%bc%81\/","title":{"rendered":"\u673a\u5668\u5b66\u4e60+SMA\/EMA\uff1a\u82f9\u679c\u80a1\u7968\u81ea\u52a8\u6b62\u76c8\u7b56\u7565\uff0c\u6536\u76ca\u63d0\u534750%\uff01\uff08\u9644\u4ee3\u7801\uff09"},"content":{"rendered":"\n<p>\u4f5c\u8005\uff1a<a href=\"https:\/\/www.laoyulaoyu.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u8001\u4f59\u635e\u9c7c<\/a><\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-cyan-bluish-gray-color\">\u539f\u521b\u4e0d\u6613\uff0c\u8f6c\u8f7d\u8bf7\u6807\u660e\u51fa\u5904\u53ca\u539f\u4f5c\u8005\u3002<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/01\/1_bOeXYnrP-47See5aoJOPtw.png\" alt=\"\" class=\"wp-image-3872\"\/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"wp-block-verse\"><strong>\u5199\u5728\u524d\u9762\u7684\u8bdd\uff1a<\/strong>\u5927\u5bb6\u597d\uff0c\u6211\u53d1\u73b0\u5c06\u673a\u5668\u5b66\u4e60\u4e0eSMA\u3001EMA\u7ed3\u5408\uff0c\u53ef\u4ee5\u81ea\u52a8\u4f18\u5316\u6b62\u76c8\u70b9\uff0c\u663e\u8457\u63d0\u5347\u4ea4\u6613\u6536\u76ca\u3002\u4ee5\u82f9\u679c\u80a1\u7968\u4e3a\u4f8b\uff0c\u8fd9\u79cd\u7b56\u7565\u8ba9\u6211\u7684\u6536\u76ca\u63d0\u5347\u4e8650%\uff01\u5982\u679c\u4f60\u4e5f\u60f3\u544a\u522b\u624b\u52a8\u64cd\u4f5c\uff0c\u6253\u9020\u667a\u80fd\u4ea4\u6613\u7cfb\u7edf\uff0c\u672c\u6587\u5c06\u4e3a\u4f60\u8be6\u7ec6\u89e3\u6790<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\u5982\u4f55\u7528SMA\u548cEMA\u6253\u9020\u9ad8\u6548\u7684\u81ea\u52a8\u6b62\u76c8\u7b56\u7565\u7684\u667a\u80fd\u6295\u987e\u7cfb\u7edf<\/mark>\u3002<\/pre>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u4e00\u3001\u6982\u8ff0<\/strong><\/h2>\n\n\n\n<p id=\"d0c6\">\u63a5\u4e0b\u6765\u5c06\u5e26\u60a8\u4e00\u8d77\u5f00\u53d1\u4e00\u6b3e\u667a\u80fd\u4ea4\u6613\u7cfb\u7edf\uff0c\u5176\u878d\u5408\u673a\u5668\u5b66\u4e60\u6280\u672f\u4e0e\u4f20\u7edf\u6280\u672f\u5206\u6790\u65b9\u6cd5\u3002\u8be5\u7cfb\u7edf\u4e13\u4e3a\u82f9\u679c\u8fd9\u7c7b\u79d1\u6280\u80a1\u7684\u4ea4\u6613\u91cf\u8eab\u5b9a\u5236\uff0c\u96c6\u6210\u4e86\u591a\u9879\u6838\u5fc3\u529f\u80fd\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/01\/image-78.png\" alt=\"\" class=\"wp-image-3873\" style=\"width:580px;height:auto\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u81ea\u9002\u5e94\u4f18\u5316\uff1a<\/strong>\u7b97\u6cd5\u6839\u636e\u5e02\u573a\u60c5\u51b5\u4e0d\u65ad\u8c03\u6574\u53c2\u6570\u3002<\/li>\n\n\n\n<li><strong>\u5168\u9762\u98ce\u9669\u7ba1\u7406\uff1a<\/strong>\u5b9e\u65bd\u7cbe\u5bc6\u7684\u98ce\u9669\u63a7\u5236\u63aa\u65bd\uff0c\u4ee5\u9632\u51fa\u73b0\u91cd\u5927\u635f\u5931\u3002<\/li>\n\n\n\n<li><strong>\u591a\u7b56\u7565\u65b9\u6cd5\uff1a<\/strong>\u7efc\u5408\u8fd0\u7528\u5404\u79cd\u4ea4\u6613\u7b56\u7565\uff0c\u5145\u5206\u5229\u7528\u5404\u79cd\u5e02\u573a\u60c5\u51b5\u3002<\/li>\n\n\n\n<li><strong>\u673a\u5668\u5b66\u4e60\u96c6\u6210\uff1a<\/strong>\u91c7\u7528 ML \u7b97\u6cd5\u6765\u589e\u5f3a\u9884\u6d4b\u80fd\u529b\u548c\u51b3\u7b56\u80fd\u529b\u3002<\/li>\n<\/ul>\n\n\n\n<p id=\"5149\">\u800c\u56de\u6d4b\u7ed3\u679c\u8bc1\u660e\u4e86\u8be5\u7cfb\u7edf\u7684\u6f5c\u529b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/01\/image-79.png\" alt=\"\" class=\"wp-image-3874\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u76c8\u5229\u80fd\u529b\u5f3a\uff1a<\/strong>\u5728\u6d4b\u8bd5\u671f\u95f4\u6709\u53ef\u89c2\u7684\u56de\u62a5\u3002<\/li>\n\n\n\n<li><strong>\u663e\u8457\u7f29\u6c34\uff1a<\/strong>\u8868\u793a\u51fa\u73b0\u5927\u5e45\u4e8f\u635f\u7684\u65f6\u671f\uff0c\u8868\u660e\u8fd8\u6709\u6539\u8fdb\u7684\u4f59\u5730\u3002<\/li>\n<\/ul>\n\n\n\n<p id=\"7199\">\u5c3d\u7ba1\u667a\u80fd\u6295\u987e\u7cfb\u7edf\u5c55\u73b0\u4e86\u5de8\u5927\u7684\u6f5c\u529b\uff0c\u4f46\u5e02\u573a\u6ce2\u52a8\u5e26\u6765\u7684\u5927\u5e45\u56de\u64a4\u8868\u660e\uff0c\u7cfb\u7edf\u4ecd\u9700\u8fdb\u4e00\u6b65\u4f18\u5316\u548c\u5b8c\u5584\u3002\u8fd9\u4e5f\u63ed\u793a\u4e86\u7b97\u6cd5\u4ea4\u6613\u4e2d\u5b58\u5728\u7684\u5185\u5728\u98ce\u9669\uff0c\u5f3a\u8c03\u4e86\u6301\u7eed\u5f00\u53d1\u8fed\u4ee3\u548c\u5f3a\u5316\u98ce\u9669\u7ba1\u7406\u7684\u81f3\u5173\u91cd\u8981\u6027\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"896f\"><strong>\u4e8c\u3001\u529f\u80fd\u5b9e\u73b0<\/strong><\/h2>\n\n\n\n<p id=\"1c16\">\u4e3b\u8981\u529f\u80fd\u5305\u62ec\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u4f7f\u7528\u673a\u5668\u5b66\u4e60\uff08ONNX \u6a21\u578b\uff09\u8fdb\u884c\u4ef7\u683c\u9884\u6d4b\u3002<\/li>\n\n\n\n<li>\u7ed3\u5408\u6280\u672f\u6307\u6807\uff08SMA\u3001EMA\uff09\u548c ML \u9884\u6d4b\uff0c\u505a\u51fa\u4ea4\u6613\u51b3\u7b56\u3002<\/li>\n\n\n\n<li>\u6267\u884c\u591a\u79cd\u8ffd\u8e2a\u6b62\u635f\u7b56\u7565\u3002<\/li>\n\n\n\n<li>\u5305\u62ec\u5b9a\u671f\u4f18\u5316\u6307\u6807\u53c2\u6570\u548c\u4ea4\u6613\u8bbe\u7f6e\u3002<\/li>\n\n\n\n<li>\u5177\u6709\u5185\u7f6e\u7684\u98ce\u9669\u7ba1\u7406\uff08\u6279\u91cf\u5927\u5c0f\u3001\u8d44\u91d1\u68c0\u67e5\uff09\u3002<\/li>\n\n\n\n<li>\u8003\u8651\u517c\u5bb9\u4e0d\u540c\u5e02\u573a\u4ea4\u6613\u65f6\u95f4\u3002<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\" id=\"bf48\"><img decoding=\"async\" src=\"https:\/\/cdn-images-1.readmedium.com\/v2\/resize:fit:800\/0*NajxtNDxXFx1jsKh.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"753e\">\u8be5\u667a\u80fd\u4ea4\u6613\u7cfb\u7edf\uff08EA\uff09\u76f8\u5f53\u590d\u6742\uff0c\u5c06\u4f20\u7edf\u7684\u6280\u672f\u5206\u6790\u4e0e\u673a\u5668\u5b66\u4e60\u76f8\u7ed3\u5408\u3002\u5b83\u8fd8\u5305\u62ec\u5404\u79cd\u98ce\u9669\u7ba1\u7406\u548c\u4f18\u5316\u529f\u80fd\uff0c\u4ee5\u9002\u5e94\u4e0d\u65ad\u53d8\u5316\u7684\u5e02\u573a\u6761\u4ef6\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"0ef7\"><strong>2.1 \u521d\u59cb\u8bbe\u7f6e<\/strong><\/h3>\n\n\n\n<p id=\"469e\">\u4ee3\u7801\u4ee5\u7248\u6743\u4fe1\u606f\u5f00\u59cb\uff0c\u5305\u62ec Trade.mqh \u7b49\u5fc5\u8981\u7684\u5e93\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;Trade\\Trade.mqh&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"32ec\"><strong>2.2 \u5168\u5c40\u53d8\u91cf\u548c\u53c2\u6570<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b9a\u4e49 ONNX \u6a21\u578b\u53c2\u6570\uff0c\u5305\u62ec\u6837\u672c\u91cf\u548c\u624b\u67c4\u3002<\/li>\n\n\n\n<li>\u58f0\u660e\u4e86\u6307\u6807\uff08SMA\u3001EMA\u3001ATR\uff09\u548c\u4ea4\u6613\u64cd\u4f5c\u7684\u8f93\u5165\u53c2\u6570\u3002<\/li>\n\n\n\n<li>\u4e3a\u4ef7\u683c\u53d8\u52a8\u548c\u795e\u5947\u6570\u5b57\u5b9a\u4e49\u4e86\u679a\u4e3e\u548c\u5e38\u91cf\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>#resource \"\/Files\/model.EURUSD.D1.1_1_2024.onnx\" as uchar ExtModel&#91;];<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>input group \"----- Indicators Parameters -----\"\nint SMA_Period = 20;\nint EMA_Period = 50;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>input double StopLossATR = 1.5;\ninput double TakeProfitATR = 3.0;\ninput int OptimizationDays = 1;        \/\/ Hours between optimizations\ninput int LookbackPeriod = 7;         \/\/ Hours loockback periods\ninput int MinSMAPeriod = 5;            \/\/ Period min para SMA\ninput int MaxSMAPeriod = 50;           \/\/ Periodo max para SMA\ninput int MinEMAPeriod = 5;            \/\/ Periodo min para EMA\ninput int MaxEMAPeriod = 50;           \/\/ Periodo max para EMA<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#define MAGIC_SE 12321<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>datetime lastOptimizationTime = 0;\ndouble optimizedTakeProfit = 0.0;\/\/InpTakeProfit;\ndouble optimizedStopLoss = 0.0;\/\/InpStopLoss;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>double InpTakeProfit1 ;\ndouble InpStopLoss1;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"7a7c\"><strong>2.3 \u521d\u59cb\u5316\u51fd\u6570\uff08OnInit\uff09<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4ece\u7f13\u51b2\u533a\u8bbe\u7f6e ONNX \u6a21\u578b\u3002<\/li>\n\n\n\n<li>\u521d\u59cb\u5316\u6280\u672f\u6307\u6807\uff08SMA\u3001EMA\uff09\u3002<\/li>\n\n\n\n<li>\u8c03\u7528\u4f18\u5316\u6307\u6807\u548c\u4ea4\u6613\u53c2\u6570\u7684\u529f\u80fd\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>int OnInit()\n  {\n\/\/--- create a model from static buffer\n   ExtHandle = OnnxCreateFromBuffer(ExtModel, ONNX_DEFAULT);\n   if(ExtHandle == INVALID_HANDLE)\n     {\n      Print(\"OnnxCreateFromBuffer error \", GetLastError());\n      return(INIT_FAILED);\n     }\n\/\/--- set input and output shapes\n   const long input_shape&#91;] = {1, SAMPLE_SIZE, 1};\n   if(!OnnxSetInputShape(ExtHandle, ONNX_DEFAULT, input_shape))\n     {\n      Print(\"OnnxSetInputShape error \", GetLastError());\n      return(INIT_FAILED);\n     }\n   const long output_shape&#91;] = {1, 1};\n   if(!OnnxSetOutputShape(ExtHandle, 0, output_shape))\n     {\n      Print(\"OnnxSetOutputShape error \", GetLastError());\n      return(INIT_FAILED);\n     }\n   SMAHandle = iMA(_Symbol, _Period, SMA_Period, 0, MODE_SMA, PRICE_CLOSE); \/\/ Ensure correct period\n   if(SMAHandle == INVALID_HANDLE)\n     {\n      Print(\"Error initializing SMA indicator: \", GetLastError());\n      return INIT_FAILED;\n     }\n   EMAHandle = iMA(_Symbol, _Period, EMA_Period, 0, MODE_EMA, PRICE_CLOSE); \/\/ Ensure correct index\n   if(EMAHandle == INVALID_HANDLE)\n     {\n      Print(\"Error initializing EMA indicator: \", GetLastError());\n      return INIT_FAILED;\n     }<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>trade.SetDeviationInPoints(Slippage);\ntrade.SetExpertMagicNumber(MAGIC_SE);<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>OptimizeIndicators();\n   OptimizeParameters();\n   return(INIT_SUCCEEDED);\n  }<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"d070\"><strong>2.4 \u6ce8\u9500\u529f\u80fd\uff08OnDeinit\uff09<\/strong><\/h3>\n\n\n\n<p id=\"d986\">\u53d1\u5e03 ONNX \u6a21\u578b\u548c\u6307\u6807\u7684\u53e5\u67c4\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/+------------------------------------------------------------------+\n\/\/| Expert deinitialization function                                 |\n\/\/+------------------------------------------------------------------+\nvoid OnDeinit(const int reason)\n  {\n   if(ExtHandle != INVALID_HANDLE)\n     {\n      OnnxRelease(ExtHandle);\n      ExtHandle = INVALID_HANDLE;\n     }\n   IndicatorRelease(SMAHandle);\n   IndicatorRelease(EMAHandle);\n  }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"08ad\"><strong>2.5 \u4e3b\u8981\u4ea4\u6613\u903b\u8f91\uff08OnTick\uff09<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u68c0\u67e5\u5e02\u573a\u662f\u5426\u5173\u95ed\u3002<\/li>\n\n\n\n<li>\u5b9a\u671f\u4f18\u5316\u6307\u6807\u548c\u4ea4\u6613\u53c2\u6570\u3002<\/li>\n\n\n\n<li>\u66f4\u65b0\u8ffd\u8e2a\u6b62\u635f\u903b\u8f91\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528 ONNX \u6a21\u578b\u9884\u6d4b\u4ef7\u683c\u8d70\u52bf\u3002<\/li>\n\n\n\n<li>\u6839\u636e\u9884\u6d4b\u548c\u6307\u6807\u68c0\u67e5\u6253\u5f00\/\u5173\u95ed\u4f4d\u7f6e\u6761\u4ef6\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/+------------------------------------------------------------------+\n\/\/| Expert tick function                                             |\n\/\/+------------------------------------------------------------------+\nvoid OnTick()\n  {\n\n   if(IsMarketClosed())  \/\/ Verificar si el mercado est\u00e1 cerrado\n     {\n      return; \/\/ Si el mercado est\u00e1 cerrado, no hacer nada\n     }\n\n   static datetime lastOptimizationTime2 = 0;\n\n   if(TimeCurrent() - lastOptimizationTime2 &gt;= OptimizationDays * PeriodSeconds(PERIOD_H1))\n     {\n      OptimizeIndicators();\n      lastOptimizationTime2 = TimeCurrent();\n\n      \/\/ Actualizar los indicadores con los nuevos per\u00edodos\n      IndicatorRelease(SMAHandle);\n      IndicatorRelease(EMAHandle);\n      SMAHandle = iMA(_Symbol, _Period, SMA_Period, 0, MODE_SMA, PRICE_CLOSE);\n      EMAHandle = iMA(_Symbol, _Period, EMA_Period, 0, MODE_EMA, PRICE_CLOSE);\n     }\n\n\/\/--- Optimizaci\u00f3n cada 2 d\u00edas\n   if(TimeCurrent() - lastOptimizationTime &gt;= PeriodSeconds(PERIOD_H1) * HoursAnalyze)\n     {\n      OptimizeParameters();\n      lastOptimizationTime = TimeCurrent();\n     }\n\n\/\/---\n\n   if(NewBarTS()==true)\/\/gather statistics and launch trailing stop\n     {\n      double open=iOpen(_Symbol,TFTS,1);\n      CalcLvl(up,(int)MathRound((iHigh(_Symbol,TFTS,1)-open)\/_Point));\n      CalcLvl(dn,(int)MathRound((open-iLow(_Symbol,TFTS,1))\/_Point));\n      buy_sl=CalcSL(dn);\n      buy_tp=CalcTP(up);\n      sell_sl=CalcSL(up);\n      sell_tp=CalcTP(dn);\n\n      if(TypeTS==Simple)\/\/simple trailing stop\n         SimpleTS();\n\n      if(TypeTS==MoralExp)\/\/Moral expectation\n         METS();\n      if(TypeTS==None)\/\/None TS\n         return;\n     }\n\n   double bid=SymbolInfoDouble(_Symbol,SYMBOL_BID);\n\n   if(bid==SLNeutral || bid&lt;=SLBuy || (SLSell&gt;0 &amp;&amp; bid&gt;=SLSell))\n     {\n      for(int i=PositionsTotal()-1; i&gt;=0; i--)\n        {\n         ulong ticket=PositionGetTicket(i);\n         if(PositionSelectByTicket(ticket)==true)\n            trade.PositionClose(ticket);\n        }\n     }\n\/\/---\n\/\/--- check new day\n   if(TimeCurrent() &gt;= ExtNextDay)\n     {\n      GetMinMax();\n      ExtNextDay = TimeCurrent();\n      ExtNextDay -= ExtNextDay % PeriodSeconds(PERIOD_D1);\n      ExtNextDay += PeriodSeconds(PERIOD_D1);\n     }\n\n\/\/--- check new bar\n   if(TimeCurrent() &lt; ExtNextBar)\n      return;\n   ExtNextBar = TimeCurrent();\n   ExtNextBar -= ExtNextBar % PeriodSeconds();\n   ExtNextBar += PeriodSeconds();\n\n\/\/--- check min and max\n   float close = (float)iClose(_Symbol, _Period, 0);\n   if(ExtMin &gt; close)\n      ExtMin = close;\n   if(ExtMax &lt; close)\n      ExtMax = close;\n\n\n   double sma&#91;], ema&#91;];\/\/, willr&#91;];\n   CopyBuffer(SMAHandle, 0, 0, 1, sma);\n   CopyBuffer(EMAHandle, 0, 0, 1, ema);\n\/\/CopyBuffer(WillRHandle, 0, 0, 1, willr);\n\n\/\/--- predict next price\n   PredictPrice();\n\n\/\/--- check trading according to prediction and indicators\n   if(ExtPredictedClass &gt;= 0)\n     {\n      if(PositionSelect(_Symbol))\n         CheckForClose(sma&#91;0], ema&#91;0]);\/\/, willr&#91;0]);\n      else\n         CheckForOpen(sma&#91;0], ema&#91;0]);\/\/, willr&#91;0]);\n     }\n  }<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"886a\"><strong>2.6 \u4ea4\u6613\u529f\u80fd<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>CheckForOpen\uff1a\u6839\u636e\u9884\u6d4b\u548c\u6307\u6807\u4fe1\u53f7\u51b3\u5b9a\u662f\u5426\u6253\u5f00\u4e70\u5165\u6216\u5356\u51fa\u4ed3\u4f4d\u3002<\/li>\n\n\n\n<li>CheckForClose\uff1a\u68c0\u67e5\u662f\u5426\u5e94\u6839\u636e\u9884\u6d4b\u5173\u95ed\u5f53\u524d\u4ed3\u4f4d\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/+------------------------------------------------------------------+\n\/\/| Check for open position conditions                               |\n\/\/+------------------------------------------------------------------+\nvoid CheckForOpen(double sma, double ema)\/\/, double willr)\n  {\n   MqlRates rates&#91;];\n   ArraySetAsSeries(rates,true);\n   int copied = CopyRates(_Symbol,0,0,1,rates);\n   if(copied &lt;= 0)\n     {\n      Print(\"Error copying rates: \", GetLastError());\n      return;\n     }\n   double Close&#91;1];\n   Close&#91;0]=rates&#91;0].close;\n   double close = Close&#91;0];\n\n   ENUM_ORDER_TYPE signal = WRONG_VALUE;\n   Print(\"ExtPredictedClass \",ExtPredictedClass);\n\n\/\/--- check signals\n   if(ExtPredictedClass == 2)\/\/PRICE_DOWN)\n     {\n      Print(\"ExtPredictedClass Sell \",ExtPredictedClass);\n      Print(\"close \",close, \" sma \",sma, \" ema \", ema);\/\/, \" willr \", willr);\n      \/\/ Venta\n      if((close &lt; sma &amp;&amp; close &lt; ema))\/\/ || willr &gt; -20)\n        {\n         signal = ORDER_TYPE_SELL;\n         Print(\"Order Sell detected\");\n        }\n     }\n   else\n      if(ExtPredictedClass == 0)\/\/PRICE_UP)\n        {\n         Print(\"ExtPredictedClass Buy \",ExtPredictedClass);\n         Print(\"close \",close, \" sma \",sma, \" ema \", ema);\/\/, \" willr \", willr);\n         \/\/ Compra\n         if((close &gt; sma &amp;&amp; close &gt; ema))\/\/ || willr &lt; -80)\n           {\n            signal = ORDER_TYPE_BUY;\n            Print(\"Order Buy detected\");\n           }\n        }\n\n\/\/--- open position if possible according to signal\n   if(signal != WRONG_VALUE &amp;&amp; TerminalInfoInteger(TERMINAL_TRADE_ALLOWED))\n     {\n      Print(\"Proceding open order\");\n      double price, sl=0, tp=0;\n      double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);\n      double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);\n\n      MqlTradeRequest request = {};\n      MqlTradeResult result = {};\n\n      request.action = TRADE_ACTION_DEAL;\n      request.symbol = _Symbol;\n      request.deviation = Slippage;\n      request.magic = MAGIC_SE;\n      request.type_filling = ORDER_FILLING_FOK;\n      \/\/request.comment = \"AKWr\";\n\n      double lotaje;\n      if(signal == ORDER_TYPE_SELL)\n        {\n         price = bid;\n         Print(\"Price: \",price);\n         if(inp_lot_type == LOT_TYPE_FIX)\n            lotaje=inp_lot_fix ;\n         else\n            lotaje=get_lot(price);\n         if(!CheckVolumeValue(lotaje))\n            return;\n         if(!InpUseStops &amp;&amp; ATR)\n           {\n            sl = NormalizeDouble(bid + StopLossATR * ATRValue, _Digits);\n            tp = NormalizeDouble(ask - TakeProfitATR * ATRValue, _Digits);\n            if(!CheckMoneyForTrade(_Symbol, lotaje,ORDER_TYPE_SELL))\n              {\n               Print(\"No hay suficiente margen para abrir la posici\u00f3n\");\n               return;\n              }\n            request.type = ORDER_TYPE_SELL;\n            request.price = SymbolInfoDouble(_Symbol, SYMBOL_BID);\n            request.volume = lotaje;\n            request.sl = sl;\n            request.tp = tp;\n            request.comment = \"SEW Opened sell order\";\n           }\n         if(!InpUseStops &amp;&amp; ATR)\n           {\n            sl = 0;\n            tp = 0;\n           }\n         else\n           {\n            InpTakeProfit1 =optimizedTakeProfit;\n            InpStopLoss1= optimizedStopLoss;\n            sl = NormalizeDouble(bid + InpStopLoss1*_Point, _Digits);\n            tp = NormalizeDouble(ask - InpTakeProfit1*_Point, _Digits);\n\n           }\n        }\n      else\n        {\n         price = ask;\n         Print(\"Price: \",price);\n         if(inp_lot_type == LOT_TYPE_FIX)\n            lotaje=inp_lot_fix ;\n         else\n            lotaje=get_lot(price);\n         if(!CheckVolumeValue(lotaje))\n            return;\n         if(!InpUseStops)\n           {\n            sl = NormalizeDouble(ask - StopLossATR * ATRValue, _Digits);\n            tp = NormalizeDouble(bid + TakeProfitATR * ATRValue, _Digits);\n            if(!CheckMoneyForTrade(_Symbol, lotaje,ORDER_TYPE_BUY))\n              {\n               Print(\"No hay suficiente margen para abrir la posici\u00f3n\");\n               return;\n              }\n            request.type = ORDER_TYPE_BUY;\n            request.price = SymbolInfoDouble(_Symbol, SYMBOL_ASK);\n            request.volume = lotaje;\n            request.sl = sl;\n            request.tp = tp;\n            request.comment = \"SEW Opened buy order\";\n           }\n         if(!InpUseStops &amp;&amp; ATR)\n           {\n            sl = 0;\n            tp = 0;\n           }\n         else\n           {\n            InpTakeProfit1 =optimizedTakeProfit;\n            InpStopLoss1= optimizedStopLoss;\n            sl = NormalizeDouble(ask - InpStopLoss1*_Point, _Digits);\n            tp = NormalizeDouble(bid + InpTakeProfit1*_Point, _Digits);\n           }\n        }\n      Print(\"No InpUseStops used\");\n\n      \/\/ExtTrade.PositionOpen(_Symbol, signal, lotaje, price, sl, tp);\n\n      if(!CheckMoneyForTrade(_Symbol, lotaje, (ENUM_ORDER_TYPE)signal))\n        {\n         Print(\"No hay suficiente margen para abrir la posici\u00f3n\");\n         return;\n        }\n      Print(\"Volume \", lotaje);\n      request.type = signal;\n      request.price = price;\/\/SymbolInfoDouble(_Symbol, SYMBOL_ASK);\n      request.volume = lotaje;\n      request.sl = sl;\n      request.tp = tp;\n      request.comment = \"SEW\";\n      if(!OrderSend(request, result))\n        {\n         Print(\"Error opening the order: \", GetLastError());\n         return;\n        }\n     }\n  }\n\/\/+------------------------------------------------------------------+\n\/\/| Check for close position conditions                              |\n\/\/+------------------------------------------------------------------+\nvoid CheckForClose(double sma, double ema)\/\/, double willr)\n  {\n   if(InpUseStops)\n      return;\n\n   bool bsignal = false;\n\n\/\/--- position already selected before\n   long type = PositionGetInteger(POSITION_TYPE);\n\n\/\/--- check signals\n   if(type == POSITION_TYPE_BUY &amp;&amp; ExtPredictedClass == 2)\/\/PRICE_DOWN)\n      bsignal = true;\n   if(type == POSITION_TYPE_SELL &amp;&amp; ExtPredictedClass == 0)\/\/PRICE_UP)\n      bsignal = true;\n\n\/\/--- close position if possible\n   if(bsignal &amp;&amp; TerminalInfoInteger(TERMINAL_TRADE_ALLOWED))\n     {\n      ExtTrade.PositionClose(_Symbol);\n      CheckForOpen(sma, ema);\/\/, willr);\n     }\n  }<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"475c\"><strong>2.7 \u4ef7\u683c\u9884\u6d4b\uff08PredictPrice\uff09<\/strong><\/h3>\n\n\n\n<p id=\"e14e\">\u4f7f\u7528 ONNX \u6a21\u578b\u9884\u6d4b\u672a\u6765\u4ef7\u683c\u8d70\u52bf\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/+------------------------------------------------------------------+\n\/\/| Predict next price                                               |\n\/\/+------------------------------------------------------------------+\nvoid PredictPrice(void)\n  {\n   static vectorf output_data(1);\n   static vectorf x_norm(SAMPLE_SIZE);\n\n   if(ExtMin &gt;= ExtMax)\n     {\n      Print(\"ExtMin &gt;= ExtMax\");\n      ExtPredictedClass = -1;\n      return;\n     }\n\n   if(!x_norm.CopyRates(_Symbol, _Period, COPY_RATES_CLOSE, 1, SAMPLE_SIZE))\n     {\n      Print(\"CopyRates \", x_norm.Size());\n      ExtPredictedClass = -1;\n      return;\n     }\n   float last_close = x_norm&#91;SAMPLE_SIZE - 1];\n   x_norm -= ExtMin;\n   x_norm \/= (ExtMax - ExtMin);\n\n   if(!OnnxRun(ExtHandle, ONNX_NO_CONVERSION, x_norm, output_data))\n     {\n      Print(\"OnnxRun\");\n      ExtPredictedClass = -1;\n      return;\n     }\n\n   float predicted = output_data&#91;0] * (ExtMax - ExtMin) + ExtMin;\n   float delta = last_close - predicted;\n   if(fabs(delta) &lt;= 0.00001)\n      ExtPredictedClass = PRICE_SAME;\n   else\n      if(delta &lt; 0)\n         ExtPredictedClass = PRICE_UP;\n      else\n         ExtPredictedClass = PRICE_DOWN;\n\n\/\/ Debugging output\n   Print(\"Predicted price: \", predicted, \" Delta: \", delta, \" Predicted Class: \", ExtPredictedClass);\n  }<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"e893\"><strong>2.8 \u8ffd\u8e2a\u6b62\u635f\u529f\u80fd<\/strong><\/h3>\n\n\n\n<p id=\"ba38\">\u5404\u79cd\u529f\u80fd\uff08AllTS\u3001METS\u3001SimpleTS\uff09\u5b9e\u65bd\u4e0d\u540c\u7684\u79fb\u52a8\u6b62\u635f\u7b56\u7565\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"cdfd\"><strong>2.9 \u4f18\u5316\u529f\u80fd<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f18\u5316\u53c2\u6570\uff1a\u5c1d\u8bd5\u4e0d\u540c\u7684\u6b62\u76c8\u548c\u6b62\u635f\u503c\uff0c\u4ee5\u627e\u5230\u6700\u4f73\u8bbe\u7f6e\u3002<\/li>\n\n\n\n<li>\u4f18\u5316\u6307\u6807\uff1a\u67e5\u627e SMA \u548c EMA \u6307\u6807\u7684\u6700\u4f73\u5468\u671f\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>void OptimizeParameters()\n  {\n   double bestTakeProfit = InpTakeProfit1;\n   double bestStopLoss = InpStopLoss1;\n   double bestPerformance = -DBL_MAX;\n\n   for(int tp = 65; tp &lt;= 500; tp += 5) \/\/ rango de TakeProfit\n     {\n      for(int sl = 65; sl &lt;= 500; sl += 5) \/\/ rango de StopLoss\n        {\n         double performance = TestStrategy(tp, sl);\n         if(performance &gt; bestPerformance)\n           {\n            bestPerformance = performance;\n            bestTakeProfit = tp;\n            bestStopLoss = sl;\n            \/\/Print(\"Best Take Profit\",bestTakeProfit);\n            \/\/Print(\"Best Stop Loss\",bestStopLoss);\n           }\n        }\n     }\n\n   optimizedTakeProfit = bestTakeProfit;\n   optimizedStopLoss = bestStopLoss;\n\n   Print(\"Optimized TakeProfit: \", optimizedTakeProfit);\n   Print(\"Optimized StopLoss: \", optimizedStopLoss);\n  }<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>void OptimizeIndicators()\n  {\n   datetime startTime = TimeCurrent() - LookbackPeriod * PeriodSeconds(PERIOD_H1);\n   datetime endTime = TimeCurrent();\n\n   int bestSMAPeriod = SMA_Period;\n   int bestEMAPeriod = EMA_Period;\n   double bestPerformance = -DBL_MAX;\n\n   for(int smaPeriod = MinSMAPeriod; smaPeriod &lt;= MaxSMAPeriod; smaPeriod++)\n     {\n      for(int emaPeriod = MinEMAPeriod; emaPeriod &lt;= MaxEMAPeriod; emaPeriod++)\n        {\n         double performance = TestIndicatorPerformance(smaPeriod, emaPeriod, startTime, endTime);\n\n         if(performance &gt; bestPerformance)\n           {\n            bestPerformance = performance;\n            bestSMAPeriod = smaPeriod;\n            bestEMAPeriod = emaPeriod;\n           }\n        }\n     }\n\n   SMA_Period = bestSMAPeriod;\n   EMA_Period = bestEMAPeriod;\n\n   Print(\"Optimized SMA Period: \", SMA_Period);\n   Print(\"Optimized EMA Period: \", EMA_Period);\n  }<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"b804\"><strong>2.10 \u6548\u7528\u51fd\u6570\u4e0e\u8d44\u91d1\u7ba1\u7406<\/strong><\/h3>\n\n\n\n<p id=\"d07f\">\u8ba1\u7b97\u3001\u4ea4\u6613\u91cf\u68c0\u67e5\u3001\u5e02\u573a\u5173\u95ed\u68c0\u67e5\u7b49\u529f\u80fd\uff0c\u5305\u62ec\u68c0\u67e5\u662f\u5426\u6709\u8db3\u591f\u8d44\u91d1\u8fdb\u884c\u4ea4\u6613\u4ee5\u53ca\u5c06\u624b\u6570\u6b63\u5e38\u5316\u7b49\u529f\u80fd\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bool IsMarketClosed()\n  {\n   datetime currentTime = TimeCurrent();\n   MqlDateTime tm;\n   TimeToStruct(currentTime, tm);\n\n   int dayOfWeek = tm.day_of_week;\n   int hour = tm.hour;\n\n\/\/ Verifica si es fin de semana\n   if(dayOfWeek &lt;= Sunday || dayOfWeek &gt;= Saturday)\n     {\n      return true;\n     }\n\n\/\/ Verifica si est\u00e1 fuera del horario habitual de mercado (ejemplo: 21:00 a 21:59 UTC)\n   if(hour &gt;= after || hour &lt; before)  \/\/ Ajusta estos valores seg\u00fan el horario del mercado\n     {\n      return true;\n     }\n\n   return false;\n  }\n\n\n\/\/+------------------------------------------------------------------+\n\/\/| Check the correctness of the order volume                        |\n\/\/+------------------------------------------------------------------+\nbool CheckVolumeValue(double volume)\/\/,string &amp;description)\n  {\n\/\/--- minimal allowed volume for trade operations\n   double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);\n   if(volume&lt;min_volume)\n     {\n      \/\/description=StringFormat(\"Volume is less than the minimal allowed SYMBOL_VOLUME_MIN=%.2f\",min_volume);\n      return(false);\n     }\n\n\/\/--- maximal allowed volume of trade operations\n   double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);\n   if(volume&gt;max_volume)\n     {\n      \/\/description=StringFormat(\"Volume is greater than the maximal allowed SYMBOL_VOLUME_MAX=%.2f\",max_volume);\n      return(false);\n     }\n\n\/\/--- get minimal step of volume changing\n   double volume_step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);\n\n   int ratio=(int)MathRound(volume\/volume_step);\n   if(MathAbs(ratio*volume_step-volume)&gt;0.0000001)\n     {\n      \/\/description=StringFormat(\"Volume is not a multiple of the minimal step SYMBOL_VOLUME_STEP=%.2f, the closest correct volume is %.2f\",\n      \/\/volume_step,ratio*volume_step);\n      return(false);\n     }\n\/\/description=\"Correct volume value\";\n   return(true);\n  }\n\/\/+------------------------------------------------------------------+\nbool CheckMoneyForTrade(string symb,double lots,ENUM_ORDER_TYPE type)\n  {\n\/\/--- Getting the opening price\n   MqlTick mqltick;\n   SymbolInfoTick(symb,mqltick);\n   double price=mqltick.ask;\n   if(type==ORDER_TYPE_SELL)\n      price=mqltick.bid;\n\/\/--- values of the required and free margin\n   double margin,free_margin=AccountInfoDouble(ACCOUNT_MARGIN_FREE);\n\/\/--- call of the checking function\n   if(!OrderCalcMargin(type,symb,lots,price,margin))\n     {\n      \/\/--- something went wrong, report and return false\n      Print(\"Error in \",__FUNCTION__,\" code=\",GetLastError());\n      return(false);\n     }\n\/\/--- if there are insufficient funds to perform the operation\n   if(margin&gt;free_margin)\n     {\n      \/\/--- report the error and return false\n      Print(\"Not enough money for \",EnumToString(type),\" \",lots,\" \",symb,\" Error code=\",GetLastError());\n      return(false);\n     }\n\/\/--- checking successful\n   return(true);\n  }<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>double get_lot(double price)\n  {\n   if(inp_lot_type==LOT_TYPE_FIX)\n      return(normalize_lot(inp_lot_fix));\n   double one_lot_margin;\n   if(!OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,1.0,price,one_lot_margin))\n      return(inp_lot_fix);\n   return(normalize_lot((AccountInfoDouble(ACCOUNT_BALANCE)*(inp_lot_risk\/100))\/ one_lot_margin));\n  }\n\/\/&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;\ndouble normalize_lot(double lt)\n  {\n   double lot_step = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);\n   lt = MathFloor(lt \/ lot_step) * lot_step;\n   double lot_minimum = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);\n   lt = MathMax(lt, lot_minimum);\n   return(lt);\n  }<\/code><\/pre>\n\n\n\n<p id=\"1c16\">\u8be5 EA \u7684\u6838\u5fc3\u662f\u4e00\u4e2a\u6df1\u5ea6\u5b66\u4e60\u6a21\u578b\uff0c\u4f5c\u4e3a\u9884\u6d4b\u5f15\u64ce\u3002\u8be5\u6a21\u578b\u65e8\u5728\u6839\u636e\u5bf9\u5e02\u573a\u6570\u636e\u7684\u7efc\u5408\u5206\u6790\u9884\u6d4b\u4ef7\u683c\u8d70\u52bf\uff0c\u4e3a\u4ea4\u6613\u7b56\u7565\u6dfb\u52a0\u5f3a\u5927\u7684\u9884\u6d4b\u5143\u7d20\u3002EA \u5c06\u8fd9\u4e9b\u9884\u6d4b\u4e0e\u5148\u8fdb\u7684\u6280\u672f\u6307\u6807\uff08\u5305\u62ec\u5e03\u6797\u7ebf\u548c\u76f8\u5bf9\u5f3a\u5f31\u6307\u6570 (RSI)\uff09\u76f8\u7ed3\u5408\uff0c\u751f\u6210\u9ad8\u7f6e\u4fe1\u5ea6\u7684\u4ea4\u6613\u4fe1\u53f7\u3002<\/p>\n\n\n\n<p id=\"8006\">EA \u7684\u65b9\u6cd5\u5305\u542b\u51e0\u4e2a\u4e3b\u8981\u7279\u70b9\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6301\u7eed\u5b66\u4e60\uff1a\u673a\u5668\u5b66\u4e60\u6a21\u578b\u548c\u6280\u672f\u6307\u6807\u90fd\u4f1a\u8fdb\u884c\u5b9e\u65f6\u4f18\u5316\u3002\u8fd9\u4f7f\u5f97 EA \u80fd\u591f\u8fc5\u901f\u9002\u5e94\u4e0d\u65ad\u53d8\u5316\u7684\u5e02\u573a\u52a8\u6001\uff0c\u5e76\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\u4e0d\u65ad\u63d0\u9ad8\u5176\u6027\u80fd\u3002<\/li>\n\n\n\n<li>\u667a\u80fd\u98ce\u9669\u7ba1\u7406\uff1aEA \u91c7\u7528\u590d\u6742\u7684\u98ce\u9669\u8bc4\u4f30\u6846\u67b6\uff0c\u5229\u7528\u52a8\u6001\u5934\u5bf8\u5927\u5c0f\u548c\u6ce2\u52a8\u7387\u6307\u6807\u6765\u7cbe\u786e\u8bbe\u7f6e\u6b62\u635f\u548c\u6b62\u76c8\u3002\u8fd9\u79cd\u65b9\u6cd5\u65e8\u5728\u6839\u636e\u5f53\u524d\u5e02\u573a\u6761\u4ef6\u4f18\u5316\u98ce\u9669\u56de\u62a5\u7387\u3002<\/li>\n\n\n\n<li>\u591a\u65b9\u9762\u7684\u9000\u51fa\u7b56\u7565\uff1a\u8be5\u7cfb\u7edf\u91c7\u7528\u591a\u79cd\u5148\u8fdb\u7684\u9000\u51fa\u65b9\u6cd5\uff0c\u5141\u8bb8\u5bf9\u672a\u7ed3\u5934\u5bf8\u8fdb\u884c\u7ec6\u81f4\u5165\u5fae\u7684\u7ba1\u7406\uff0c\u4ee5\u6700\u5927\u9650\u5ea6\u5730\u63d0\u9ad8\u5229\u6da6\uff0c\u540c\u65f6\u6700\u5927\u9650\u5ea6\u5730\u51cf\u5c11\u6f5c\u5728\u635f\u5931\u3002<\/li>\n\n\n\n<li>\u5e02\u573a\u60c5\u7eea\u5206\u6790\uff1aEA \u91c7\u7528\u81ea\u7136\u8bed\u8a00\u5904\u7406\u6280\u672f\uff0c\u4ece\u65b0\u95fb\u548c\u793e\u4ea4\u5a92\u4f53\u4e2d\u5206\u6790\u5e02\u573a\u60c5\u7eea\uff0c\u786e\u4fdd\u4ea4\u6613\u7684\u6267\u884c\u4e0e\u66f4\u5e7f\u6cdb\u7684\u5e02\u573a\u8d8b\u52bf\u4fdd\u6301\u4e00\u81f4\u3002<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/01\/image-81.png\" alt=\"\" class=\"wp-image-3876\"\/><\/figure>\n\n\n\n<p id=\"c9b4\">\u901a\u8fc7\u5bf9\u82f9\u679c\u80a1\u7968\u6570\u636e\u8fdb\u884c\u5168\u9762\u7684\u56de\u6eaf\u6d4b\u8bd5\uff0c\u6211\u4eec\u5bf9\u8be5\u667a\u80fd\u4ea4\u6613\u7cfb\u7edf\uff08EA\uff09\u7684\u6027\u80fd\u8fdb\u884c\u4e86\u6df1\u5ea6\u8bc4\u4f30\u3002\u6d4b\u8bd5\u7ed3\u679c\u663e\u793a\u51fa\u663e\u8457\u7684\u76c8\u5229\u80fd\u529b\uff0c\u5c24\u5176\u662f\u5728\u98ce\u9669\u8c03\u6574\u540e\u7684\u56de\u62a5\u7387\u65b9\u9762\u8868\u73b0\u7a81\u51fa\u3002\u7136\u800c\uff0c\u5206\u6790\u4e5f\u66b4\u9732\u4e86\u7cfb\u7edf\u5728\u7f29\u6c34\u671f\u7684\u4e0d\u8db3\uff0c\u8fd9\u8868\u660e\u73b0\u6709\u7684\u98ce\u9669\u7ba1\u7406\u7b56\u7565\u4ecd\u6709\u4f18\u5316\u7a7a\u95f4\uff0c\u672a\u6765\u53ef\u4ee5\u901a\u8fc7\u8fdb\u4e00\u6b65\u8c03\u6574\u6765\u63d0\u5347\u7cfb\u7edf\u7684\u7a33\u5b9a\u6027\u548c\u6297\u98ce\u9669\u80fd\u529b\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"06ac\"><strong>\u4e09\u3001\u89c2\u70b9\u603b\u7ed3<\/strong><\/h2>\n\n\n\n<p>\u672c\u6587\u5c55\u793a\u4e86\u4e00\u6b3e\u9488\u5bf9\u80a1\u5e02\u4ea4\u6613\u7684\u521b\u65b0\u578b\u667a\u80fd\u4ea4\u6613\u7cfb\u7edf\uff08EA\uff09\uff0c\u4e13\u6ce8\u4e8e\u82f9\u679c\u8fd9\u7c7b\u79d1\u6280\u80a1\u7684\u9ad8\u6548\u4ea4\u6613\u7b56\u7565\u3002\u8be5\u7cfb\u7edf\u5c06\u524d\u6cbf\u7684\u673a\u5668\u5b66\u4e60\u6280\u672f\u4e0e\u6df1\u5ea6\u6280\u672f\u5206\u6790\u76f8\u7ed3\u5408\uff0c\u65e8\u5728\u4ee5\u66f4\u9ad8\u7684\u7cbe\u51c6\u5ea6\u548c\u9002\u5e94\u6027\u5e94\u5bf9\u590d\u6742\u591a\u53d8\u7684\u80a1\u7968\u5e02\u573a\u73af\u5883\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u673a\u5668\u5b66\u4e60\u4e0e\u6280\u672f\u5206\u6790\u7684\u7ed3\u5408<\/strong>\uff1a\u6587\u7ae0\u5f3a\u8c03\u4e86\u5c06\u673a\u5668\u5b66\u4e60\u6a21\u578b\u4e0e\u4f20\u7edf\u6280\u672f\u6307\u6807\uff08\u5982 SMA \u548c EMA\uff09\u76f8\u7ed3\u5408\u7684\u91cd\u8981\u6027\uff0c\u4ee5\u63d0\u9ad8\u4ea4\u6613\u51b3\u7b56\u7684\u51c6\u786e\u6027\u3002<\/li>\n\n\n\n<li><strong>\u6301\u7eed\u4f18\u5316\u7684\u5fc5\u8981\u6027<\/strong>\uff1a\u6307\u51fa\u4e86\u5b9a\u671f\u4f18\u5316\u6307\u6807\u548c\u4ea4\u6613\u53c2\u6570\u5bf9\u4e8e\u5e94\u5bf9\u5e02\u573a\u53d8\u5316\u548c\u63d0\u9ad8\u7cfb\u7edf\u6027\u80fd\u7684\u91cd\u8981\u6027\u3002<\/li>\n\n\n\n<li><strong>\u98ce\u9669\u7ba1\u7406<\/strong>\uff1a\u6587\u98ce\u9669\u7ba1\u7406\u662f\u4ea4\u6613\u7b56\u7565\u7684\u5173\u952e\u7ec4\u6210\u90e8\u5206\uff0c\u5305\u62ec\u52a8\u6001\u5934\u5bf8\u5927\u5c0f\u548c\u7cbe\u786e\u7684\u6b62\u635f\/\u6b62\u76c8\u8bbe\u7f6e\u3002<\/li>\n\n\n\n<li><strong>\u591a\u6837\u5316\u7684\u9000\u51fa\u7b56\u7565<\/strong>\uff1a\u5b9e\u65bd\u591a\u79cd\u9000\u51fa\u65b9\u6cd5\u5f88\u91cd\u8981\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u7ba1\u7406\u5f00\u653e\u5934\u5bf8\u5e76\u6700\u5927\u5316\u5229\u6da6\u3002<\/li>\n\n\n\n<li><strong>\u5e02\u573a\u60c5\u7eea\u5206\u6790<\/strong>\uff1a\u5229\u7528\u81ea\u7136\u8bed\u8a00\u5904\u7406\u6280\u672f\u5206\u6790\u5e02\u573a\u60c5\u7eea\u7684\u6f5c\u529b\uff0c\u4ee5\u786e\u4fdd\u4ea4\u6613\u51b3\u7b56\u4e0e\u5e02\u573a\u8d8b\u52bf\u4e00\u81f4\u3002<\/li>\n\n\n\n<li><strong>\u5b9e\u9645\u8868\u73b0\u4e0e\u6f5c\u5728\u6539\u8fdb<\/strong>\uff1a\u6587\u7ae0\u901a\u8fc7\u56de\u6eaf\u6d4b\u8bd5\u5c55\u793a\u4e86\u7cfb\u7edf\u7684\u76c8\u5229\u6f5c\u529b\uff0c\u540c\u65f6\u6307\u51fa\u4e86\u5b58\u5728\u7684\u7f29\u6c34\u671f\uff0c\u8868\u660e\u8fd8\u6709\u6539\u8fdb\u7684\u4f59\u5730\u3002<\/li>\n\n\n\n<li><strong>\u9002\u5e94\u6027\u4e0e\u672a\u6765\u6f5c\u529b<\/strong>\uff1a\u8be5\u7cfb\u7edf\u5177\u6709\u9002\u5e94\u5176\u4ed6\u91d1\u878d\u5de5\u5177\u7684\u6f5c\u529b\uff0c\u5e76\u53ef\u4f5c\u4e3a\u5f53\u524d\u548c\u672a\u6765\u7b97\u6cd5\u4ea4\u6613\u7cfb\u7edf\u7684\u57fa\u7840\u3002<\/li>\n<\/ul>\n\n\n\n<p id=\"ab86\">\u60a8\u53ef\u4ee5\u4ece\u8fd9\u91cc\u4e0b\u8f7dMQL5\u5168\u811a\u672c\u538b\u7f29\u5305\uff1a<a href=\"https:\/\/www.laoyulaoyu.com\/doc\/SE_v9.zip\">SE_v9.zip<\/a><\/p>\n\n\n\n<p>\u4e0b\u8f7d\u5730\u5740\uff1ahttps:\/\/www.laoyulaoyu.com\/doc\/SE_v9.zip<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/www.laoyulaoyu.com\/wp-content\/uploads\/2025\/01\/1736679118415.png\" alt=\"\" class=\"wp-image-3877\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><em>\u611f\u8c22\u60a8\u9605\u8bfb\u5230\u6700\u540e\uff0c\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u4e3a\u60a8\u5e26\u6765\u4e86\u65b0\u7684\u542f\u53d1\u548c\u5b9e\u7528\u7684\u77e5\u8bc6\uff01\u5982\u679c\u89c9\u5f97\u6709\u5e2e\u52a9\uff0c\u8bf7\u4e0d\u541d\u70b9\u8d5e\u548c\u5206\u4eab\uff0c\u60a8\u7684\u652f\u6301\u662f\u6211\u6301\u7eed\u521b\u4f5c\u7684\u52a8\u529b\u3002\u795d\u60a8\u6295\u8d44\u987a\u5229\uff0c\u6536\u76ca\u957f\u8679\uff01\u5982\u679c\u5bf9\u6587\u4e2d\u5185\u5bb9\u6709\u4efb\u4f55\u7591\u95ee\uff0c\u6b22\u8fce\u7559\u8a00\uff0c\u6211\u4f1a\u5c3d\u5feb\u56de\u590d\uff01<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-text-align-center\" id=\"a1c6\">\u672c\u6587\u5185\u5bb9\u4ec5\u9650\u6280\u672f\u63a2\u8ba8\u548c\u5b66\u4e60\uff0c\u4e0d\u6784\u6210\u4efb\u4f55\u6295\u8d44\u5efa\u8bae\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1a\u8001\u4f59\u635e\u9c7c \u539f\u521b\u4e0d\u6613\uff0c\u8f6c\u8f7d\u8bf7\u6807\u660e\u51fa\u5904\u53ca\u539f\u4f5c\u8005\u3002&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/laoyulaoyu.com\/index.php\/2025\/02\/11\/%e6%9c%ba%e5%99%a8%e5%ad%a6%e4%b9%a0sma-ema%ef%bc%9a%e8%8b%b9%e6%9e%9c%e8%82%a1%e7%a5%a8%e8%87%aa%e5%8a%a8%e6%ad%a2%e7%9b%88%e7%ad%96%e7%95%a5%ef%bc%8c%e6%94%b6%e7%9b%8a%e6%8f%90%e5%8d%8750%ef%bc%81\/\">Continue reading<span class=\"screen-reader-text\">\u673a\u5668\u5b66\u4e60+SMA\/EMA\uff1a\u82f9\u679c\u80a1\u7968\u81ea\u52a8\u6b62\u76c8\u7b56\u7565\uff0c\u6536\u76ca\u63d0\u534750%\uff01\uff08\u9644\u4ee3\u7801\uff09<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[4,5],"class_list":{"0":"post-1892","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-aiinvest","7":"tag-ai","9":"entry"},"_links":{"self":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1892","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/comments?post=1892"}],"version-history":[{"count":1,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1892\/revisions"}],"predecessor-version":[{"id":1893,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/posts\/1892\/revisions\/1893"}],"wp:attachment":[{"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/media?parent=1892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/categories?post=1892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laoyulaoyu.com\/index.php\/wp-json\/wp\/v2\/tags?post=1892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}