{"id":2413,"date":"2026-11-21T07:03:41","date_gmt":"2026-11-21T13:03:41","guid":{"rendered":"https:\/\/www.patternsmart.com\/cn\/?p=2413"},"modified":"2026-11-21T13:04:14","modified_gmt":"2026-11-21T13:04:14","slug":"multicharts-net-%e6%95%88%e7%8e%87%e6%af%94%e7%8e%87%e6%8c%87%e6%a0%87%ef%bc%9a%e7%94%a8-c-%e5%8c%ba%e5%88%86%e8%b6%8b%e5%8a%bf%e4%b8%8e%e9%9c%87%e8%8d%a1","status":"publish","type":"post","link":"https:\/\/www.patternsmart.com\/cn\/multicharts-net-%e6%95%88%e7%8e%87%e6%af%94%e7%8e%87%e6%8c%87%e6%a0%87%ef%bc%9a%e7%94%a8-c-%e5%8c%ba%e5%88%86%e8%b6%8b%e5%8a%bf%e4%b8%8e%e9%9c%87%e8%8d%a1\/","title":{"rendered":"MultiCharts .NET \u6548\u7387\u6bd4\u7387\u6307\u6807\uff1a\u7528 C# \u533a\u5206\u8d8b\u52bf\u4e0e\u9707\u8361"},"content":{"rendered":"<div class=\"postie-post\">\n<div>\n<h1>MultiCharts .NET \u6548\u7387\u6bd4\u7387\u6307\u6807\uff1a\u7528 C# \u533a\u5206\u8d8b\u52bf\u4e0e\u9707\u8361<\/h1>\n<p style=\"color:#56718c\">\u9ad8\u7ea7\u6559\u7a0b\uff5c\u5229\u7528\u65e0\u91cf\u7eb2\u6548\u7387\u6bd4\u7387\u8bc6\u522b\u8d8b\u52bf\u4e0e\u9707\u8361\uff0c\u9644\u5b8c\u6574 PowerLanguage .NET C# \u6e90\u7801\u3002<\/p>\n<h2 style=\"color:#164e88\">\u95ee\u9898\uff1a\u6ce2\u52a8\u4e0d\u7b49\u4e8e\u8d8b\u52bf<\/h2>\n<p>\u4ef7\u683c\u53ef\u4ee5\u5267\u70c8\u6ce2\u52a8\uff0c\u5374\u51e0\u4e4e\u6ca1\u6709\u51c0\u65b9\u5411\u4f4d\u79fb\u3002ATR \u6216\u6807\u51c6\u5dee\u63cf\u8ff0\u6ce2\u52a8\u7a0b\u5ea6\uff0c\u5374\u4e0d\u80fd\u76f4\u63a5\u56de\u7b54\u4ef7\u683c\u6cbf\u9014\u6709\u591a\u5c11\u6298\u8fd4\u3002\u82e5\u628a\u6d3b\u8dc3\u5e02\u573a\u76f4\u63a5\u5f53\u4f5c\u8d8b\u52bf\u5e02\u573a\uff0c\u5bb9\u6613\u5728\u9707\u8361\u4e2d\u53cd\u590d\u4ea7\u751f\u9519\u8bef\u4fe1\u53f7\u3002<\/p>\n<h2 style=\"color:#164e88\">\u6838\u5fc3\u516c\u5f0f<\/h2>\n<p>\u6548\u7387\u6bd4\u7387 ER(N)=|Close[t]-Close[t-N]| \/ \u03a3(i=0 \u81f3 N-1)|Close[t-i]-Close[t-i-1]|\u3002\u5206\u5b50\u662f\u8d77\u70b9\u5230\u7ec8\u70b9\u7684\u51c0\u4f4d\u79fb\uff0c\u5206\u6bcd\u662f\u9010\u6839\u6536\u76d8\u4ef7\u53d8\u5316\u7edd\u5bf9\u503c\u4e4b\u548c\u3002\u7406\u8bba\u8303\u56f4\u4e3a 0 \u5230 1\uff1b\u82e5\u8def\u5f84\u957f\u5ea6\u4e3a\u96f6\uff0c\u4ee3\u7801\u5c06 ER \u5b9a\u4e49\u4e3a\u96f6\u3002<\/p>\n<h2 style=\"color:#164e88\">\u53ef\u590d\u73b0\u7684\u6570\u5b57\u793a\u4f8b<\/h2>\n<p>\u5047\u8bbe\u516d\u4e2a\u6536\u76d8\u4ef7\u4e3a 100\u3001102\u3001101\u3001104\u3001103\u3001106\u3002\u4e94\u6bb5\u8def\u5f84\u7edd\u5bf9\u53d8\u5316\u4e3a 2+1+3+1+3=10\uff0c\u51c0\u53d8\u5316\u4e3a 6\uff0c\u56e0\u6b64 ER=0.60\u3002\u82e5\u4ef7\u683c\u8def\u5f84\u4e3a 100\u3001103\u300199\u3001104\u300198\u3001106\uff0c\u7ec8\u70b9\u4ecd\u4e3a 106\uff0c\u4f46\u8def\u5f84\u957f\u5ea6\u4e3a 3+4+5+6+8=26\uff0cER \u7ea6\u4e3a 0.231\u3002\u76f8\u540c\u6da8\u5e45\u53ef\u80fd\u5bf9\u5e94\u622a\u7136\u4e0d\u540c\u7684\u8d70\u52bf\u6548\u7387\u3002<\/p>\n<figure><img decoding=\"async\" alt=\"Efficiency ratio regime classification schematic\" style=\"max-width:100%\" src=\"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/11\/6b0196cba2ea8.png\"><figcaption>\u793a\u610f\u56fe\uff1a\u6548\u7387\u5206\u7c7b\u6d41\u7a0b\uff0c\u5e76\u975e\u771f\u5b9e\u5e02\u573a\u6570\u636e\u3002<\/figcaption><\/figure>\n<h2 style=\"color:#164e88\">\u53c2\u6570\u4e0e\u4fe1\u53f7\u89e3\u91ca<\/h2>\n<p>\u9ed8\u8ba4 Lookback=20\uff0cTrendThreshold=0.45\u3002\u9ad8\u4e8e\u9608\u503c\u610f\u5473\u7740\u8fc7\u53bb\u4e00\u6bb5\u65f6\u95f4\u7684\u4ef7\u683c\u8fd0\u884c\u66f4\u5177\u65b9\u5411\u6027\uff1b\u4f4e\u4e8e\u9608\u503c\u5219\u8868\u793a\u6298\u8fd4\u8f83\u591a\u30020.45 \u53ea\u662f\u7814\u7a76\u8d77\u70b9\uff0c\u4e0d\u5e94\u5f53\u4f5c\u9002\u7528\u4e8e\u6240\u6709\u54c1\u79cd\u7684\u56fa\u5b9a\u6700\u4f18\u53c2\u6570\u3002ER \u672c\u8eab\u4e0d\u533a\u5206\u4e0a\u6da8\u6216\u4e0b\u8dcc\uff0c\u82e5\u9700\u8981\u65b9\u5411\uff0c\u53ef\u53e6\u884c\u68c0\u67e5\u8d77\u6b62\u6536\u76d8\u4ef7\u4e4b\u5dee\u3002<\/p>\n<h2 style=\"color:#164e88\">\u6e90\u7801\u8bbe\u8ba1\u7ec6\u8282<\/h2>\n<p>CalcBar \u9010\u6839\u8ba1\u7b97\uff0c\u4e0d\u8bfb\u53d6\u672a\u6765\u6570\u636e\uff1b\u5faa\u73af\u7d2f\u8ba1\u76f8\u90bb\u6536\u76d8\u4ef7\u5dee\u503c\u7684\u7edd\u5bf9\u503c\uff0c\u5e76\u5c06\u51c0\u4f4d\u79fb\u9664\u4ee5\u7d2f\u8ba1\u8def\u5f84\u3002\u4e24\u4e2a Plot \u5206\u522b\u663e\u793a\u6548\u7387\u6bd4\u7387\u4e0e\u9608\u503c\u7ebf\u3002\u5386\u53f2\u6570\u636e\u4e0d\u8db3\u65f6\u8f93\u51fa\u7a7a\u503c\uff0c\u907f\u514d\u628a\u4e0d\u5b8c\u6574\u7a97\u53e3\u8bef\u5224\u4e3a\u6709\u6548\u4fe1\u53f7\u3002<\/p>\n<h2>\u5b8c\u6574 PowerLanguage .NET C# \u6e90\u7801<\/h2>\n<pre style=\"white-space:pre;font-family:Consolas,Monaco,monospace;background:#f6f8fb;padding:16px\"><code>using System;<br>using System.Drawing;<br>using PowerLanguage;<br>using PowerLanguage.Function;<br><br>namespace PowerLanguage.Indicator<br>{<br>\u00a0\u00a0\u00a0\u00a0\/\/ Bar-close efficiency ratio: directional movement \/ total movement.<br>\u00a0\u00a0\u00a0\u00a0\/\/ A high ratio means directional price action; a low ratio means choppy action.<br>\u00a0\u00a0\u00a0\u00a0public class EfficiencyRegime : IndicatorObject<br>\u00a0\u00a0\u00a0\u00a0{<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private IPlotObject efficiencyPlot;<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0private IPlotObject thresholdPlot;<br><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[Input]<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public int Lookback { get; set; } = 20;<br><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[Input]<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public double TrendThreshold { get; set; } = 0.45;<br><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public EfficiencyRegime(object ctx) : base(ctx) { }<br><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0protected override void Create()<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0efficiencyPlot = AddPlot(new PlotAttributes(\"Efficiency\", EPlotShapes.Line, Color.RoyalBlue));<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0thresholdPlot = AddPlot(new PlotAttributes(\"Threshold\", EPlotShapes.Line, Color.DarkRed));<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0protected override void CalcBar()<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (Lookback &lt; 2 || Bars.CurrentBar &lt; Lookback)<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0{<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0efficiencyPlot.Set(double.NaN);<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0thresholdPlot.Set(TrendThreshold);<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return;<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0double movement = Math.Abs(Bars.Close[0] - Bars.Close[Lookback]);<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0double path = 0.0;<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (int i = 0; i &lt; Lookback; i++)<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0path += Math.Abs(Bars.Close[i] - Bars.Close[i + 1]);<br><br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0double ratio = path &gt; 0 ? movement \/ path : 0.0;<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0efficiencyPlot.Set(ratio);<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0thresholdPlot.Set(TrendThreshold);<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}<br>\u00a0\u00a0\u00a0\u00a0}<br>}<br><\/code><\/pre>\n<h2 style=\"color:#164e88\">\u5b89\u88c5\u4e0e\u9a8c\u8bc1<\/h2>\n<p>\u5728 PowerLanguage .NET Editor \u4e2d\u65b0\u5efa Indicator\uff0c\u66ff\u6362\u751f\u6210\u7684\u7c7b\uff0c\u4f7f\u7528\u672c\u673a MultiCharts .NET \u7f16\u8bd1\u540e\u52a0\u8f7d\u5230\u56fe\u8868\u3002\u8bbe\u7f6e Lookback=5\uff0c\u4f7f\u7528\u4e0a\u8ff0\u516d\u4e2a\u6536\u76d8\u4ef7\u624b\u7b97\u5bf9\u7167\u3002\u8fd8\u5e94\u68c0\u67e5\u8fde\u7eed\u76f8\u540c\u6536\u76d8\u4ef7\u3001\u5355\u8fb9\u884c\u60c5\u3001\u53cd\u590d\u9707\u8361\u3001\u8df3\u7a7a\u4ee5\u53ca\u5386\u53f2\u6570\u636e\u4e0d\u8db3\u7b49\u60c5\u51b5\u3002\u672c\u73af\u5883\u672a\u5b9e\u9645\u7f16\u8bd1\u6216\u8fd0\u884c\u8be5\u4ee3\u7801\uff0c\u9700\u5728\u76ee\u6807\u5e73\u53f0\u590d\u6838\u3002<\/p>\n<h2 style=\"color:#164e88\">\u98ce\u9669\u4e0e\u5c40\u9650<\/h2>\n<p>\u6700\u65b0\u5c1a\u672a\u6536\u76d8\u7684 K \u7ebf\u4f1a\u6301\u7eed\u53d8\u5316\uff0c\u7b56\u7565\u4fe1\u53f7\u5e94\u4f18\u5148\u4ee5\u6536\u76d8\u786e\u8ba4\u6570\u636e\u8bc4\u4f30\u3002\u8df3\u7a7a\u53ef\u80fd\u663e\u8457\u6539\u53d8 ER\uff0c\u7a97\u53e3\u8fc7\u77ed\u4e5f\u4f1a\u5bfc\u81f4\u6307\u6807\u4e0d\u7a33\u5b9a\u3002\u6548\u7387\u6bd4\u7387\u4e0d\u662f\u72ec\u7acb\u4e70\u5356\u4fe1\u53f7\uff0c\u66f4\u4e0d\u80fd\u4fdd\u8bc1\u6536\u76ca\uff1b\u5b9e\u9645\u7814\u7a76\u5e94\u8003\u8651\u624b\u7eed\u8d39\u3001\u6ed1\u70b9\u3001\u4ea4\u6613\u65f6\u6bb5\u548c\u6837\u672c\u5916\u68c0\u9a8c\u3002<\/p>\n<p>\u5982\u679c\u5e0c\u671b\u6269\u5c55\u514d\u8d39\u6e90\u7801\u3001\u589e\u52a0\u63d0\u9192\u6216\u6574\u5408\u4ea4\u6613\u7b56\u7565\uff0c\u53ef\u4e86\u89e3 <a href=\"https:\/\/www.patternsmart.com\/cn\/custom\/\">\u4ea4\u6613\u8f6f\u4ef6\u5b9a\u5236\u5f00\u53d1\u670d\u52a1<\/a>.<\/p>\n<\/p><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>MultiCharts .NET \u6548\u7387\u6bd4\u7387\u6307\u6807\uff1a\u7528 C# \u533a\u5206\u8d8b\u52bf\u4e0e\u9707\u8361 \u9ad8\u7ea7\u6559\u7a0b\uff5c\u5229\u7528\u65e0\u91cf\u7eb2\u6548\u7387\u6bd4\u7387\u8bc6\u522b\u8d8b\u52bf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2414,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_seo_schema_type":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"fifu_image_url":"","fifu_image_alt":"","_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[363,233,217],"tags":[453,466,464],"class_list":["post-2413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-multicharts-net","category-233","category-217","tag-multicharts-net","tag-466","tag-464"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/11\/6b0196cba2ea8.png","_links":{"self":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/2413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/comments?post=2413"}],"version-history":[{"count":0,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/2413\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media\/2414"}],"wp:attachment":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media?parent=2413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/categories?post=2413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/tags?post=2413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}