{"id":2709,"date":"2026-11-26T11:16:23","date_gmt":"2026-11-26T17:16:23","guid":{"rendered":"https:\/\/www.patternsmart.com\/cn\/?p=2709"},"modified":"2026-11-26T17:17:21","modified_gmt":"2026-11-26T17:17:21","slug":"ctrader-cbot-%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8%e5%ae%9e%e6%97%b6%e7%82%b9%e5%b7%ae%e8%bf%87%e6%bb%a4%e5%85%a5%e5%9c%ba","status":"publish","type":"post","link":"https:\/\/www.patternsmart.com\/cn\/ctrader-cbot-%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8%e5%ae%9e%e6%97%b6%e7%82%b9%e5%b7%ae%e8%bf%87%e6%bb%a4%e5%85%a5%e5%9c%ba\/","title":{"rendered":"cTrader cBot \u5982\u4f55\u4f7f\u7528\u5b9e\u65f6\u70b9\u5dee\u8fc7\u6ee4\u5165\u573a"},"content":{"rendered":"<div class=\"postie-post\">\n<p>K\u7ebf\u4fe1\u53f7\u770b\u4f3c\u6709\u5229\uff0c\u4f46\u4e70\u5356\u70b9\u5dee\u6269\u5927\u65f6\uff0c\u5b9e\u76d8\u5165\u573a\u53ef\u80fd\u4ee3\u4ef7\u8fc7\u9ad8\u3002\u5e94\u5c06\u4fe1\u53f7\u751f\u6210\u548c\u6267\u884c\u8d44\u683c\u5206\u5f00\uff0c\u800c\u4e0d\u662f\u901a\u8fc7\u4fee\u6539\u6307\u6807\u63a9\u76d6\u9ad8\u6210\u672c\u4ea4\u6613\u3002\u70b9\u5dee\u8fc7\u6ee4\u5c5e\u4e8e\u4e0b\u5355\u524d\u63a7\u5236\uff0c\u4e0d\u662f\u9000\u51fa\u89c4\u5219\uff0c\u4e5f\u4e0d\u80fd\u4fdd\u8bc1\u6210\u4ea4\u8d28\u91cf\u3002<\/p>\n<h2>\u5b9e\u4f8b\uff1a\u5c06\u62a5\u4ef7\u5dee\u6362\u7b97\u4e3apip<\/h2>\n<p>\u5047\u8bbeEURUSD\u7684PipSize\u4e3a0.0001\uff0cBid\u4e3a1.10000\uff0cAsk\u4e3a1.10008\uff0c\u5219\u70b9\u5dee0.8 pip\u3002\u540c\u4e00Bid\u4e0bAsk\u4e3a1.10015\uff0c\u70b9\u5dee1.5 pip\uff0c\u7b26\u5408\u6700\u59271.5\u7684\u9650\u5236\uff1bAsk\u4e3a1.10032\u65f6\u70b9\u5dee3.2 pip\uff0c\u5e94\u8df3\u8fc7\u5165\u573a\u3002\u4e94\u4f4d\u62a5\u4ef7\u7684\u6700\u540e\u4e00\u4f4d\u5c0f\u6570\u4e0d\u4e00\u5b9a\u7b49\u4e8e1 pip\u3002<\/p>\n<figure><img decoding=\"async\" src=\"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/11\/PS_SpreadGate_CN_Fig1.png\" alt=\"PS_SpreadGate_CN_Fig1.png\" title=\"\u6700\u5927\u5141\u8bb8\u5165\u573a\u70b9\u5dee1.5 pip\uff0c0.8\u53ca1.5\u901a\u8fc7\uff0c3.2\u62d2\u7edd\u3002\" width=\"960\" height=\"420\" style=\"max-width:100%;height:auto\"><figcaption>\u6700\u5927\u5141\u8bb8\u5165\u573a\u70b9\u5dee1.5 pip\uff0c0.8\u53ca1.5\u901a\u8fc7\uff0c3.2\u62d2\u7edd\u3002<\/figcaption><\/figure>\n<h2>\u5728\u63d0\u4ea4\u5165\u573a\u524d\u6267\u884c\u8fc7\u6ee4<\/h2>\n<p>\u4f7f\u7528OnBarClosed()\u5904\u7406\u5df2\u6536\u76d8K\u7ebf\u4fe1\u53f7\uff0c\u4f46\u51c6\u5907\u4e0b\u5355\u65f6\u8bfb\u53d6\u5f53\u524dBid\u548cAsk\u3002\u8be5\u56de\u8c03\u5728\u65b0tick\u5f00\u542f\u4e0b\u4e00\u6839K\u7ebf\u65f6\u6267\u884c\uff0c\u4f11\u5e02\u540e\u53ef\u80fd\u5ef6\u8fdf\u3002\u4ee5\u4e0b\u7247\u6bb5\u5e94\u7f6e\u4e8e\u73b0\u6709\u5165\u573a\u5206\u652f\u4e2d\uff0c\u5e76\u975e\u5b8c\u6574cBot\u3002<\/p>\n<pre style=\"white-space:pre;font-family:Consolas,Monaco,monospace\"><code>\/\/ Inside the entry path of OnBarClosed()<br>\/\/ after signal and position checks<br>double spreadPips = (Symbol.Ask - Symbol.Bid) \/ Symbol.PipSize;<br>if (spreadPips &gt; 1.5)<br>{<br>\u00a0\u00a0\u00a0\u00a0Print(&quot;Entry skipped: spread {0:F2} pips&quot;, spreadPips);<br>\u00a0\u00a0\u00a0\u00a0return;<br>}<br>\/\/ Submit the planned entry and check TradeResult.<\/code><\/pre>\n<p>\u5b9e\u7528\u7a0b\u5e8f\u5e94\u4f7f\u7528\u53ef\u914d\u7f6e\u7684\u6b63\u6570\u9608\u503c\uff1b\u8fb9\u754c\u53ef\u8003\u8651\u5fae\u5c0f\u6570\u503c\u5bb9\u5dee\u6216\u6574\u6570Tick\u6bd4\u8f83\u3002\u4e0d\u8981\u8ba9\u63d0\u524dreturn\u8df3\u8fc7\u6301\u4ed3\u4fdd\u62a4\u548c\u9000\u51fa\u7ba1\u7406\u3002\u68c0\u67e5TradeResult\u5e76\u6838\u5bf9\u5b9e\u9645\u6210\u4ea4\u3002\u88ab\u62d2\u7edd\u7684\u4fe1\u53f7\u5e94\u5931\u6548\uff0c\u9664\u975e\u53e6\u884c\u8bbe\u8ba1\u660e\u786e\u7684\u5ef6\u8fdf\u91cd\u8bd5\u89c4\u5219\u3002<\/p>\n<h2>\u9a8c\u8bc1\u4e0e\u5f02\u5e38\u573a\u666f<\/h2>\n<ul>\n<li>\u6d4b\u8bd5\u4f4e\u4e8e\u3001\u7b49\u4e8e\u53ca\u9ad8\u4e8e\u9608\u503c\u7684\u70b9\u5dee\uff0c\u6838\u5bf9\u65e5\u5fd7\u4e2d\u7684\u901a\u8fc7\u548c\u62d2\u7edd\u8bb0\u5f55\u3002<\/li>\n<li>\u6d4b\u8bd5\u65e5\u5143\u8d27\u5e01\u5bf9\u53ca\u975e\u5916\u6c47\u54c1\u79cd\uff0c\u8bfb\u53d6\u5404\u81eaPipSize\uff0c\u4e0d\u8981\u56fa\u5b9a\u5047\u8bbe0.0001\u3002<\/li>\n<li>\u6bd4\u8f83\u56fa\u5b9a\u70b9\u5dee\u4e0e\u66f4\u771f\u5b9e\u7684\u5386\u53f2\u4e70\u5356\u4ef7\u6a21\u578b\uff0c\u5728\u6a21\u62df\u8d26\u6237\u4e2d\u6d4b\u8bd5\u6d41\u52a8\u6027\u4e0d\u8db3\u65f6\u7684\u62a5\u4ef7\u3002<\/li>\n<li>\u8bb0\u5f55\u4fe1\u53f7\u65f6\u95f4\u3001Bid\u3001Ask\u3001\u70b9\u5dee\u3001\u5b9e\u9645\u6210\u4ea4\u4ef7\u53ca\u6ed1\u70b9\u3002\u68c0\u67e5\u540e\u7684\u62a5\u4ef7\u53ef\u80fd\u5728\u6210\u4ea4\u524d\u53d8\u5316\u3002<\/li>\n<\/ul>\n<p>\u82e5\u6bdb\u76ee\u6807\u4e3a5 pip\uff0c3.2 pip\u70b9\u5dee\u76f8\u5bf9\u76ee\u6807\u5f88\u5927\u3002\u8fd9\u4ec5\u662f\u6210\u672c\u8bca\u65ad\uff0c\u5e76\u975e\u7cbe\u786e\u51c0\u6536\u76ca\u8ba1\u7b97\uff1b\u624b\u7eed\u8d39\u3001\u6210\u4ea4\u4ef7\u548c\u9000\u51fa\u70b9\u5dee\u4e5f\u6709\u5f71\u54cd\u3002<\/p>\n<p>\u5b98\u65b9\u53c2\u8003\uff1a<a href=\"https:\/\/help.ctrader.com\/ctrader-algo\/references\/MarketData\/Symbols\/Symbol\/\">Symbol API<\/a>\u3002<\/p>\n<p>\u4ee5\u4e0a\u4e3a\u5047\u8bbe\u6027\u6559\u5b66\u793a\u4f8b\uff0c\u672a\u8fdb\u884c\u7f16\u8bd1\u6216\u56de\u6d4b\u3002\u4ea4\u6613\u5b58\u5728\u4e8f\u635f\u98ce\u9669\uff0c\u6a21\u62df\u8868\u73b0\u4e0d\u4ee3\u8868\u672a\u6765\u7ed3\u679c\u3002<\/p>\n<p>\u5982\u9700\u5c06\u6b64\u514d\u8d39\u7b56\u7565\u601d\u8def\u6269\u5c55\u4e3a\u81ea\u5df1\u7684\u4ea4\u6613\u7a0b\u5e8f\uff0c\u6b22\u8fce\u8054\u7cfb\u6211\u4eec\u4e86\u89e3<a href=\"https:\/\/www.patternsmart.com\/cn\/custom\/\">cTrader\u4ea4\u6613\u7b56\u7565\u5b9a\u5236\u5f00\u53d1\u670d\u52a1<\/a>\u3002<\/p>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>K\u7ebf\u4fe1\u53f7\u770b\u4f3c\u6709\u5229\uff0c\u4f46\u4e70\u5356\u70b9\u5dee\u6269\u5927\u65f6\uff0c\u5b9e\u76d8\u5165\u573a\u53ef\u80fd\u4ee3\u4ef7\u8fc7\u9ad8\u3002\u5e94\u5c06\u4fe1\u53f7\u751f\u6210\u548c\u6267\u884c\u8d44\u683c\u5206\u5f00\uff0c\u800c\u4e0d\u662f\u901a\u8fc7\u4fee\u6539\u6307\u6807\u63a9\u76d6\u9ad8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2710,"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":[171,520],"tags":[172,340,622,621,614],"class_list":["post-2709","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ctrader","category-520","tag-ctrader","tag-340","tag-622","tag-621","tag-614"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/11\/PS_SpreadGate_CN_Fig1.png","_links":{"self":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/2709","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=2709"}],"version-history":[{"count":0,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/2709\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media\/2710"}],"wp:attachment":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media?parent=2709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/categories?post=2709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/tags?post=2709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}