{"id":3165,"date":"2026-12-04T18:05:16","date_gmt":"2026-12-05T00:05:16","guid":{"rendered":"https:\/\/www.patternsmart.com\/cn\/?p=3165"},"modified":"2026-12-05T00:08:32","modified_gmt":"2026-12-05T00:08:32","slug":"pine-script-v6%e5%9b%9e%e8%b0%83%e9%99%90%e4%bb%b7%e5%85%a5%e5%9c%ba%e5%8d%95%e6%9c%89%e6%95%88%e6%9c%9f%e4%b8%8e%e6%92%a4%e5%8d%95%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.patternsmart.com\/cn\/pine-script-v6%e5%9b%9e%e8%b0%83%e9%99%90%e4%bb%b7%e5%85%a5%e5%9c%ba%e5%8d%95%e6%9c%89%e6%95%88%e6%9c%9f%e4%b8%8e%e6%92%a4%e5%8d%95%e7%ae%a1%e7%90%86\/","title":{"rendered":"Pine Script v6\u56de\u8c03\u9650\u4ef7\u5165\u573a\u5355\u6709\u6548\u671f\u4e0e\u64a4\u5355\u7ba1\u7406"},"content":{"rendered":"<div class=\"postie-post\">\n<p>\u5747\u7ebf\u91d1\u53c9\u53ef\u80fd\u63d0\u793a\u8d8b\u52bf\u673a\u4f1a\uff0c\u4f46\u56de\u8c03\u9650\u4ef7\u5355\u4e5f\u53ef\u80fd\u4e00\u76f4\u6302\u5230\u8d8b\u52bf\u5df2\u7ecf\u6539\u53d8\u624d\u6210\u4ea4\u3002\u5982\u4f55\u8ba9Pine\u7b56\u7565\u53ca\u65f6\u53d6\u6d88\u8fc7\u671f\u4fe1\u53f7\uff0c\u53c8\u907f\u514d\u7b49\u5f85\u8fc7\u7a0b\u4e2d\u4e0d\u65ad\u79fb\u52a8\u539f\u6765\u7684\u9650\u4ef7\uff1f<\/p>\n<h2>\u8bfb\u5b8c\u672c\u6587\uff0c\u4f60\u5c06\u638c\u63e1<\/h2>\n<ul>\n<li>\u5982\u4f55\u5728\u4fe1\u53f7\u51fa\u73b0\u65f6\u51bb\u7ed3\u56de\u8c03\u5165\u573a\u4ef7\u3002<\/li>\n<li>\u5982\u4f55\u5728\u89c4\u5b9aK\u7ebf\u7a97\u53e3\u7ed3\u675f\u540e\u53d6\u6d88\u672a\u6210\u4ea4\u8ba2\u5355\u3002<\/li>\n<li>\u5982\u4f55\u8bbe\u7f6e\u57fa\u4e8etick\u7684\u4fdd\u62a4\u6027\u9000\u51fa\uff0c\u5e76\u7406\u89e3\u6a21\u62df\u6210\u4ea4\u65f6\u5e8f\u3002<\/li>\n<li>\u5982\u4f55\u6d4b\u8bd5\u64a4\u5355\u8fb9\u754c\u53ca\u540c\u6839K\u7ebf\u6210\u4ea4\u6b67\u4e49\u3002<\/li>\n<\/ul>\n<h2>\u5165\u573a\u8ba2\u5355\u751f\u547d\u5468\u671f<\/h2>\n<p>\u7a7a\u4ed3\u65f620\u5468\u671fEMA\u4e0a\u7a7f50\u5468\u671fEMA\uff0c\u5728\u4fe1\u53f7\u6536\u76d8\u4ef7\u4e0b\u65b94\u4e2atick\u63d0\u4ea4\u505a\u591a\u9650\u4ef7\u5355\u3002\u8bb0\u5f55\u63d0\u4ea4K\u7ebf\u7d22\u5f15\uff0c\u7b49\u5f85\u671f\u95f4\u4e0d\u66f4\u65b0\u9650\u4ef7\u3002\u5728\u6807\u51c6\u6536\u76d8\u8ba1\u7b97\u4e14process_orders_on_close\u5173\u95ed\u65f6\uff0c\u8ba2\u5355\u4ece\u540e\u7eed\u53ef\u7528tick\u5f00\u59cb\u5177\u5907\u6210\u4ea4\u8d44\u683c\u3002\u7b2c\u4e8c\u6839\u540e\u7eedK\u7ebf\u6536\u76d8\u65f6\uff0c\u5982\u679c\u4ecd\u4e3a\u7a7a\u4ed3\uff0c\u5219\u53d6\u6d88\u6302\u5355\u3002\u56e0\u6b64\u968f\u540e\u4e24\u6839K\u7ebf\u5747\u53ef\u6210\u4ea4\uff0c\u6210\u529f\u64a4\u5355\u540e\u7b2c\u4e09\u6839\u4e0d\u518d\u5177\u5907\u6210\u4ea4\u8d44\u683c\u3002\u82e5\u8ba2\u5355\u5df2\u7ecf\u6210\u4ea4\uff0c\u5219\u8fdb\u5165\u6301\u4ed3\u7ba1\u7406\uff0c\u800c\u975e\u53d6\u6d88\u539f\u5165\u573a\u3002<\/p>\n<h2>\u6570\u503c\u793a\u4f8b<\/h2>\n<p>\u5047\u8bbe\u6700\u5c0f\u4ef7\u683c\u8df3\u52a8\u4e3a1\uff0c\u4fe1\u53f7\u6536\u76d8105\uff0c\u5219\u9650\u4ef7\u4e3a101\u3002\u968f\u540e\u4e24\u6839K\u7ebf\u6700\u4f4e\u4ef7\u5747\u9ad8\u4e8e101\uff0c\u6536\u76d8\u5206\u522b\u4e3a104\u548c103\uff0c\u7b2c\u4e8c\u6839\u6536\u76d8\u65f6\u64a4\u5355\u3002\u66f4\u665a\u7684\u6536\u76d8102\u548c100\u4e0d\u518d\u89e6\u53d1\u5df2\u53d6\u6d88\u8ba2\u5355\u3002\u56fe\u4e2d\u5c55\u793a\u6536\u76d8\u5e8f\u5217\uff0c\u6700\u4f4e\u4ef7\u5047\u8bbe\u662f\u672a\u6210\u4ea4\u793a\u4f8b\u6210\u7acb\u7684\u91cd\u8981\u6761\u4ef6\u3002\u5982\u679c\u6709\u6548\u7a97\u53e3\u5185\u4efb\u4e00K\u7ebf\u89e6\u53ca101\uff0c\u6a21\u62df\u5668\u53ef\u80fd\u6839\u636e\u6210\u4ea4\u5047\u8bbe\u5728\u64a4\u5355\u524d\u5b8c\u6210\u6210\u4ea4\u3002<\/p>\n<p> <img decoding=\"async\" alt=\"pine-limit-lifetime.png\" src=\"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/12\/pine-limit-lifetime.png\" width=\"720\"><\/p>\n<p><em>\u5047\u8bbe\u65f6\u95f4\u8f74\uff1a\u9650\u4ef7\u56fa\u5b9a\u4e3a101\uff0c\u5728\u5e74\u9f842\u65f6\u53d6\u6d88\u8ba2\u5355\uff0c\u907f\u514d\u968f\u540e\u89e6\u4ef7\u5bfc\u81f4\u8fc7\u671f\u5165\u573a\u3002<\/em><\/p>\n<h2>Pine Script v6\u5b9e\u73b0<\/h2>\n<pre style=\"white-space:pre;font-family:Consolas,Monaco,monospace\"><code><a href=\"mailto:\/\/@version=6\">\/\/@version=6<\/a><br>strategy(&quot;Expiring pullback limit&quot;, overlay=true,<br>\u00a0\u00a0\u00a0\u00a0\u00a0pyramiding=0, process_orders_on_close=false,<br>\u00a0\u00a0\u00a0\u00a0\u00a0calc_on_order_fills=false)<br>fast = ta.ema(close, 20)<br>slow = ta.ema(close, 50)<br>signal = ta.crossover(fast, slow)<br>var int submitted = na<br>var float limitPrice = na<br>if strategy.position_size != 0<br>\u00a0\u00a0\u00a0\u00a0submitted := na<br>else<br>\u00a0\u00a0\u00a0\u00a0if not na(submitted)<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if bar_index - submitted &gt;= 2<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0strategy.cancel(&quot;LE&quot;)<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0submitted := na<br>\u00a0\u00a0\u00a0\u00a0else if signal<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0limitPrice := close - 4 * syminfo.mintick<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0submitted := bar_index<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0strategy.entry(&quot;LE&quot;, strategy.long, qty=1,<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0limit=limitPrice)<br>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0strategy.exit(&quot;LX&quot;, &quot;LE&quot;, loss=12, profit=24)<br>plot(not na(submitted) ? limitPrice : na,<br>\u00a0\u00a0\u00a0\u00a0\u00a0&quot;Pending limit&quot;, color=color.blue,<br>\u00a0\u00a0\u00a0\u00a0\u00a0style=plot.style_linebr)<\/code><\/pre>\n<p>strategy.entry\u521b\u5efa\u9650\u4ef7\u5165\u573a\u5355\uff0cstrategy.cancel\u6309\u8ba2\u5355ID\u64a4\u5355\uff0c\u4e0d\u4f1a\u5e73\u6389\u5df2\u6709\u6301\u4ed3\u3002strategy.exit\u91c7\u7528\u76f8\u5bf9tick\u8ddd\u79bb\uff1a\u4ee5\u5b9e\u9645\u6a21\u62df\u6210\u4ea4\u4ef7\u4e3a\u57fa\u51c6\uff0c\u6b62\u635f12\u4e2atick\u3001\u6b62\u76c824\u4e2atick\uff0c\u4e0d\u662f\u8d44\u91d1\u91d1\u989d\u6216\u7edd\u5bf9\u4ef7\u683c\u3002\u793a\u4f8b\u5047\u8bbe\u5355\u6b21\u6301\u4ed3\u3001\u4e0d\u52a0\u4ed3\u53ca\u6807\u51c6\u6536\u76d8\u8ba1\u7b97\u3002submitted\u8bb0\u5f55\u811a\u672c\u8ba1\u5212\u6302\u5355\u72b6\u6001\uff0c\u4e0d\u662f\u72ec\u7acb\u7ecf\u7eaa\u5546\u786e\u8ba4\u3002\u64a4\u5355\u5206\u652f\u523b\u610f\u7981\u6b62\u540c\u6b21\u8ba1\u7b97\u91cd\u65b0\u5165\u573a\u3002\u5b8c\u6574\u5b9e\u76d8\u96c6\u6210\u8fd8\u5e94\u7531\u5916\u90e8\u6267\u884c\u670d\u52a1\u5904\u7406\u8ba2\u5355\u6807\u8bc6\u3001\u786e\u8ba4\u56de\u62a5\u3001\u64a4\u5355\u62d2\u7edd\u3001\u90e8\u5206\u6210\u4ea4\u4e0e\u72b6\u6001\u540c\u6b65\u3002\u53c2\u8003<a href=\"https:\/\/www.tradingview.com\/pine-script-docs\/concepts\/strategies\/\">Pine\u7b56\u7565\u5b98\u65b9\u6587\u6863<\/a>\u3002<\/p>\n<h2>\u8fb9\u754c\u6d4b\u8bd5\u4e0e\u5c40\u9650<\/h2>\n<p>\u4fdd\u6301\u5165\u573a\u504f\u79fb\u3001\u6b62\u635f\u3001\u6b62\u76c8\u53ca\u6210\u672c\u4e00\u81f4\uff0c\u5bf9\u6bd41\u30012\u30014\u6839K\u7ebf\u6709\u6548\u671f\u4e0e\u4e0d\u64a4\u5355\u57fa\u51c6\u3002\u6d4b\u8bd5\u6700\u540e\u6709\u6548K\u7ebf\u89e6\u4ef7\u3001\u8df3\u7a7a\u8d8a\u8fc7\u9650\u4ef7\u3001\u8fc7\u671f\u540e\u89e6\u4ef7\u53ca\u540c\u6839\u5386\u53f2K\u7ebf\u5185\u5b8c\u6210\u5165\u573a\u548c\u9000\u51fa\u3002\u540c\u6839K\u7ebf\u5f80\u8fd4\u4ea4\u6613\u53ef\u80fd\u4f7f\u4e0b\u6b21\u8ba1\u7b97\u65f6\u89c2\u5bdf\u5230\u7a7a\u4ed3\uff0c\u56e0\u6b64\u6b63\u5f0f\u72b6\u6001\u7ba1\u7406\u8fd8\u5e94\u6838\u5bf9\u5df2\u5e73\u4ed3\u4ea4\u6613\u53d8\u5316\u3002\u68c0\u67e5\u4f63\u91d1\u3001\u6ed1\u70b9\u548c\u9650\u4ef7\u6210\u4ea4\u9a8c\u8bc1\u8bbe\u7f6e\uff0c\u5728\u53ef\u7528\u65f6\u5bf9\u6bd4\u666e\u901aOHLC\u6a21\u62df\u4e0eBar Magnifier\u3002\u5386\u53f2\u6a21\u62df\u6210\u4ea4\u4e0d\u7b49\u4e8e\u5b9e\u76d8\u6210\u4ea4\uff0c\u4e5f\u4e0d\u4fdd\u8bc1\u6d41\u52a8\u6027\u3002\u793a\u4f8b\u672a\u7ecf\u5b9e\u9645\u7f16\u8bd1\u6216\u56de\u6d4b\uff0c\u4ea4\u6613\u53ef\u80fd\u9020\u6210\u91cd\u5927\u4e8f\u635f\u3002<\/p>\n<p>\u5982\u9700\u5b9a\u5236\u4fe1\u53f7\u53ca\u6267\u884c\u903b\u8f91\uff0c\u8bf7\u4e86\u89e3<a href=\"https:\/\/www.patternsmart.com\/cn\/custom\/\">TradingView\u4ea4\u6613\u7b56\u7565\u5b9a\u5236\u5f00\u53d1\u670d\u52a1<\/a>\u3002<\/p>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5747\u7ebf\u91d1\u53c9\u53ef\u80fd\u63d0\u793a\u8d8b\u52bf\u673a\u4f1a\uff0c\u4f46\u56de\u8c03\u9650\u4ef7\u5355\u4e5f\u53ef\u80fd\u4e00\u76f4\u6302\u5230\u8d8b\u52bf\u5df2\u7ecf\u6539\u53d8\u624d\u6210\u4ea4\u3002\u5982\u4f55\u8ba9Pine\u7b56\u7565\u53ca\u65f6\u53d6\u6d88\u8fc7\u671f\u4fe1\u53f7\uff0c\u53c8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3166,"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":[142,520,233],"tags":[146,434,141,777,640,342,639],"class_list":["post-3165","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tradingview","category-520","category-233","tag-ema","tag-pine-script","tag-tradingview","tag-777","tag-640","tag-342","tag-639"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/12\/pine-limit-lifetime.png","_links":{"self":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/3165","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=3165"}],"version-history":[{"count":0,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/3165\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media\/3166"}],"wp:attachment":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media?parent=3165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/categories?post=3165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/tags?post=3165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}