{"id":2698,"date":"2026-11-25T17:16:17","date_gmt":"2026-11-25T23:16:17","guid":{"rendered":"https:\/\/www.patternsmart.com\/cn\/?p=2698"},"modified":"2026-11-25T23:17:21","modified_gmt":"2026-11-25T23:17:21","slug":"pine-script-v6-%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e9%80%80%e5%87%ba%e6%95%b0%e9%87%8f%e9%a2%84%e7%95%99%e9%81%bf%e5%85%8d%e9%83%a8%e5%88%86%e6%8c%81%e4%bb%93%e5%a4%b1%e5%8e%bb%e6%ad%a2%e6%8d%9f","status":"publish","type":"post","link":"https:\/\/www.patternsmart.com\/cn\/pine-script-v6-%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8%e9%80%80%e5%87%ba%e6%95%b0%e9%87%8f%e9%a2%84%e7%95%99%e9%81%bf%e5%85%8d%e9%83%a8%e5%88%86%e6%8c%81%e4%bb%93%e5%a4%b1%e5%8e%bb%e6%ad%a2%e6%8d%9f\/","title":{"rendered":"Pine Script v6 \u5982\u4f55\u5229\u7528\u9000\u51fa\u6570\u91cf\u9884\u7559\u907f\u514d\u90e8\u5206\u6301\u4ed3\u5931\u53bb\u6b62\u635f\u4fdd\u62a4"},"content":{"rendered":"<div class=\"postie-post\">\n<p>\u5206\u6279\u6b62\u76c8\u5e38\u4f7f\u7528\u591a\u6b21 strategy.exit() \u8c03\u7528\u5b9e\u73b0\u3002Pine Script v6 \u6709\u4e00\u4e2a\u5bb9\u6613\u5ffd\u7565\u7684\u673a\u5236\uff1a\u6bcf\u6b21\u9000\u51fa\u8c03\u7528\u4f1a\u9884\u7559\u4e00\u90e8\u5206\u6301\u4ed3\u6570\u91cf\u3002\u540e\u7eed\u9000\u51fa\u8c03\u7528\u4e0d\u80fd\u5e73\u6389\u5148\u524d\u8c03\u7528\u5df2\u9884\u7559\u7684\u90e8\u5206\uff0c\u5373\u4f7f\u8bf7\u6c42\u6570\u91cf\u7b49\u4e8e\u5168\u90e8\u6301\u4ed3\uff0c\u4e5f\u53ef\u80fd\u5bfc\u81f4\u6a21\u62df\u6301\u4ed3\u7f3a\u5c11\u5b8c\u6574\u6b62\u635f\u4fdd\u62a4\u3002<\/p>\n<h2>\u5b9e\u4f8b\uff1a\u5047\u8bbe\u4ee5100\u5165\u573a\u76846\u5355\u4f4d\u591a\u5934<\/h2>\n<p>\u5047\u8bbe\u6301\u4ed36\u5355\u4f4d\uff0c\u5171\u540c\u6b62\u635f\u4ef798\uff0c\u4e24\u4e2a\u6b62\u76c8\u76ee\u6807104\u548c108\u3002\u82e5\u5148\u63d0\u4ea4\u4ec5\u5305\u542b104\u6b62\u76c8\u76843\u5355\u4f4d\u9000\u51fa\u8c03\u7528\uff0c\u4e4b\u540e\u72ec\u7acb\u63d0\u4ea46\u5355\u4f4d\u6b62\u635f\uff0c\u5219\u540e\u8005\u53ea\u80fd\u9884\u7559\u5269\u4f593\u5355\u4f4d\u3002\u82e5\u5148\u89e6\u53d1\u6b62\u635f\uff0c\u6700\u521d3\u5355\u4f4d\u53ef\u80fd\u4ecd\u4fdd\u6301\u6301\u4ed3\u3002\u6b63\u786e\u7684\u8bbe\u8ba1\u662f\u4e3a\u6bcf\u7ec43\u5355\u4f4d\u5206\u522b\u8bbe\u7f6e\u6b62\u76c8\u4e0e\u6b62\u635f\uff0c\u4e24\u7ec4\u603b\u5171\u9884\u75596\u5355\u4f4d\u3002\u76ee\u6807A\u6210\u4ea4\u540e\u5269\u4f593\u5355\u4f4d\uff0cB\u7ec4\u7ee7\u7eed\u4e3a\u8fd93\u5355\u4f4d\u63d0\u4f9b\u6b62\u635f\u3002<\/p>\n<table style=\"border-collapse:collapse;width:100%\" border=\"1\" cellpadding=\"8\">\n<thead>\n<tr>\n<th>\u8bbe\u8ba1<\/th>\n<th>\u76ee\u6807A<\/th>\n<th>\u76ee\u6807B<\/th>\n<th>\u521d\u59cb\u6b62\u635f\u8986\u76d6<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u5148\u63d0\u4ea4\u72ec\u7acb\u6b62\u76c8<\/td>\n<td>3\u5355\u4f4d\uff0c104<\/td>\n<td>\u65e0<\/td>\n<td>\u540e\u7eed\u6b62\u635f\u53ea\u80fd\u9884\u7559\u5269\u4f593\u5355\u4f4d<\/td>\n<\/tr>\n<tr>\n<td>\u4e24\u7ec4\u62ec\u53f7\u8ba2\u5355<\/td>\n<td>3\u5355\u4f4d\uff0c104<\/td>\n<td>3\u5355\u4f4d\uff0c108<\/td>\n<td>98\u5904\u8986\u76d63+3\u5355\u4f4d<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<figure><img decoding=\"async\" src=\"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/11\/PS_TV_ExitReserve_CN_Fig1.png\" alt=\"PS_TV_ExitReserve_CN_Fig1.png\" title=\"\u72ec\u7acb\u6b62\u76c8\u5148\u9884\u75593\u5355\u4f4d\uff0c\u540e\u7eed\u6b62\u635f\u53ea\u80fd\u8986\u76d6\u5269\u4f593\u5355\u4f4d\uff1b\u4e24\u7ec4\u62ec\u53f7\u8ba2\u5355\u521d\u59cb\u8986\u76d6\u5168\u90e86\u5355\u4f4d\u3002\" width=\"920\" height=\"420\" style=\"max-width:100%;height:auto\"><figcaption>\u72ec\u7acb\u6b62\u76c8\u5148\u9884\u75593\u5355\u4f4d\uff0c\u540e\u7eed\u6b62\u635f\u53ea\u80fd\u8986\u76d6\u5269\u4f593\u5355\u4f4d\uff1b\u4e24\u7ec4\u62ec\u53f7\u8ba2\u5355\u521d\u59cb\u8986\u76d6\u5168\u90e86\u5355\u4f4d\u3002<\/figcaption><\/figure>\n<h2>Pine Script v6 \u6559\u5b66\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u6700\u5c0f\u793a\u4f8b\u4f7f\u752810\/30 SMA\u4ea4\u53c9\uff0c\u4ec5\u7528\u4e8e\u6f14\u793a\u4e0b\u5355\u7ed3\u6784\u3002\u56fa\u5b9a\u4ef7\u683c\u662f\u5047\u8bbe\u5e02\u573a\u5728100\u9644\u8fd1\u4ea4\u6613\u7684\u6559\u5b66\u6c34\u5e73\uff0c\u4e0d\u9002\u7528\u4e8e\u4efb\u610f\u54c1\u79cd\u3002\u7a0b\u5e8f\u5728\u63d0\u4ea4\u5165\u573a\u8bf7\u6c42\u7684\u540c\u4e00\u6b21\u8ba1\u7b97\u4e2d\u63d0\u4ea4\u4e24\u4e2a\u9000\u51fa\u62ec\u53f7\uff0c\u5e76\u5173\u8054\u5165\u573aID L\u3002\u4e24\u6b21\u8c03\u7528\u7684\u9000\u51faID\u4e0d\u540c\uff0c\u5404\u81ea\u6570\u91cf\u4e3a3\u3002<\/p>\n<pre style=\"white-space:pre;font-family:Consolas,Monaco,monospace\"><code><a href=\"mailto:\/\/@version=6\">\/\/@version=6<\/a><br>strategy(\"Two bracket example\", overlay = true, pyramiding = 0)<br>fast = ta.sma(close, 10)<br>slow = ta.sma(close, 30)<br>signal = ta.crossover(fast, slow)<br>if signal and strategy.position_size == 0<br>\u00a0\u00a0\u00a0\u00a0strategy.entry(\"L\", strategy.long, qty = 6)<br>\u00a0\u00a0\u00a0\u00a0strategy.exit(\"A\", \"L\", qty = 3, stop = 98, limit = 104)<br>\u00a0\u00a0\u00a0\u00a0strategy.exit(\"B\", \"L\", qty = 3, stop = 98, limit = 108)<\/code><\/pre>\n<p>strategy.exit() \u5728\u7ecf\u7eaa\u5546\u6a21\u62df\u5668\u4e2d\u521b\u5efa\u4ef7\u683c\u578b\u8ba2\u5355\u3002\u4e00\u7ec4\u62ec\u53f7\u8ba2\u5355\u7684\u6b62\u76c8\u6216\u6b62\u635f\u6210\u4ea4\u540e\uff0c\u540c\u7ec4\u53e6\u4e00\u8ba2\u5355\u4f1a\u88ab\u53d6\u6d88\uff0c\u9000\u51fa\u8ba2\u5355\u53c2\u4e0e\u9ed8\u8ba4\u7684\u6570\u91cf\u7f29\u51cf\u673a\u5236\u3002\u4e24\u6b21\u8c03\u7528\u5206\u522b\u9884\u7559\u4e0d\u540c\u6301\u4ed3\u90e8\u5206\u3002\u82e5\u6ca1\u6709\u660e\u786e\u7684\u91cd\u65b0\u6fc0\u6d3b\u89c4\u5219\uff0c\u4e0d\u5e94\u53cd\u590d\u63d0\u4ea4\u5df2\u6210\u4ea4\u7684\u5206\u6279\u9000\u51fa\u8ba2\u5355\u3002\u8bbe\u8ba1\u52a8\u6001\u4ef7\u683c\u65f6\uff0c\u5e94\u4e3a\u6bcf\u7b14\u4ea4\u6613\u8ba1\u7b97\u5e76\u56fa\u5b9a\u9884\u671f\u6c34\u5e73\uff0c\u540c\u65f6\u9a8c\u8bc1\u57fa\u51c6\u662f\u4fe1\u53f7\u4ef7\u683c\u8fd8\u662f\u771f\u5b9e\u6210\u4ea4\u4ef7\u3002<\/p>\n<h2>\u4f9d\u8d56\u56de\u6d4b\u7ed3\u679c\u524d\u7684\u9a8c\u8bc1\u7528\u4f8b<\/h2>\n<ol>\n<li>\u5148\u6b62\u635f\uff1a\u57286\u5355\u4f4d\u6301\u4ed3\u4e14\u672a\u53d1\u751f\u6b62\u76c8\u7684\u60c5\u51b5\u4e0b\uff0c\u68c0\u67e5\u4e24\u7ec43\u5355\u4f4d\u5747\u5e73\u4ed3\uff0c\u5269\u4f59\u4e3a\u96f6\u3002<\/li>\n<li>\u76ee\u6807A\u540e\u6b62\u635f\uff1a\u786e\u8ba4\u9996\u4e2a\u76ee\u6807\u9000\u51fa3\u5355\u4f4d\uff0c\u5269\u4f593\u5355\u4f4d\u7531\u6b62\u635f\u9000\u51fa\u3002<\/li>\n<li>\u4e24\u4e2a\u76ee\u6807\u5747\u6210\u4ea4\uff1a\u9a8c\u8bc1\u9000\u51fa\u603b\u91cf\u4e3a6\uff0c\u4e14\u7b56\u7565\u4e0d\u4f1a\u610f\u5916\u53cd\u5411\u5f00\u4ed3\u3002<\/li>\n<li>\u540c\u6839K\u7ebf\u540c\u65f6\u89e6\u53ca\u6b62\u76c8\u6b62\u635f\uff1a\u68c0\u67e5\u6a21\u62df\u5668\u5047\u8bbe\uff0c\u6709\u6761\u4ef6\u65f6\u4f7f\u7528Bar Magnifier\u6bd4\u8f83\uff1b\u4e24\u8005\u5747\u4e0d\u4fdd\u8bc1\u771f\u5b9e\u6210\u4ea4\u987a\u5e8f\u3002<\/li>\n<li>\u8df3\u7a7a\u3001\u8d39\u7528\u3001\u6ed1\u70b9\u4e0e\u6700\u5c0f\u4ea4\u6613\u5355\u4f4d\uff1a\u68c0\u67e5\u5b9e\u9645\u6570\u91cf\u53ca\u6210\u4ea4\u4ef7\uff0c\u4e0d\u8981\u5047\u8bbe\u6240\u6709\u7406\u8bba\u8ba2\u5355\u90fd\u80fd\u6210\u4ea4\u3002<\/li>\n<\/ol>\n<h2>\u533a\u5206\u7ecf\u7eaa\u5546\u6a21\u62df\u5668\u4e0e\u5b9e\u76d8\u8ba2\u5355<\/h2>\n<p>Pine \u7b56\u7565\u6a21\u62df\u8ba2\u5355\uff0c\u8ba2\u5355\u6210\u4ea4\u63d0\u9192\u53ef\u901a\u8fc7Webhook\u6216\u96c6\u6210\u8f6c\u53d1\uff0c\u4f46\u4e0d\u4ee3\u8868\u771f\u5b9e\u7ecf\u7eaa\u5546\u786e\u8ba4\u6210\u4ea4\u3002\u6865\u63a5\u7a0b\u5e8f\u5e94\u6838\u5bf9\u771f\u5b9e\u6210\u4ea4\uff0c\u6839\u636e\u5269\u4f59\u6301\u4ed3\u63d0\u4ea4\u6216\u8c03\u6574\u5b9e\u9645\u4fdd\u62a4\u8ba2\u5355\uff0c\u53bb\u91cd\u63d0\u9192\uff0c\u5e76\u5904\u7406\u90e8\u5206\u6210\u4ea4\u3001\u62d2\u5355\u548c\u65ad\u7ebf\u91cd\u8fde\u3002\u4e0d\u80fd\u5047\u8bbe\u6a21\u62df\u5668\u7684OCA\u884c\u4e3a\u81ea\u52a8\u5b58\u5728\u4e8e\u5b9e\u76d8\u7ecf\u7eaa\u5546\u3002<\/p>\n<p>\u5b98\u65b9\u53c2\u8003\uff1a<a href=\"https:\/\/www.tradingview.com\/pine-script-docs\/concepts\/strategies\/\">Pine Script \u7b56\u7565<\/a>\u3001<a href=\"https:\/\/www.tradingview.com\/pine-script-docs\/faq\/strategies\/\">\u7b56\u7565\u5e38\u89c1\u95ee\u9898<\/a>\u3002<\/p>\n<p>\u4ee5\u4e0a\u4e3a\u5047\u8bbe\u6027\u6559\u5b66\u793a\u4f8b\uff0c\u672c\u6b21\u672a\u7f16\u8bd1\u6216\u56de\u6d4b\u3002\u4ea4\u6613\u5b58\u5728\u4e8f\u635f\u98ce\u9669\uff0c\u5047\u8bbe\u8868\u73b0\u4e0d\u80fd\u9884\u6d4b\u672a\u6765\u6536\u76ca\u3002<\/p>\n<p>\u5982\u679c\u60a8\u5e0c\u671b\u5c06\u6b64\u793a\u4f8b\u6269\u5c55\u4e3a\u9002\u5408\u81ea\u8eab\u4ea4\u6613\u89c4\u5219\u7684\u7a0b\u5e8f\uff0c\u6b22\u8fce\u8054\u7cfb\u6211\u4eec\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>\u5206\u6279\u6b62\u76c8\u5e38\u4f7f\u7528\u591a\u6b21 strategy.exit() \u8c03\u7528\u5b9e\u73b0\u3002Pine Script v6 \u6709\u4e00\u4e2a\u5bb9\u6613\u5ffd\u7565\u7684\u673a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2699,"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],"tags":[434,145,141,340,615,472,614],"class_list":["post-2698","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tradingview","category-520","tag-pine-script","tag-sma","tag-tradingview","tag-340","tag-615","tag-472","tag-614"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/11\/PS_TV_ExitReserve_CN_Fig1.png","_links":{"self":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/2698","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=2698"}],"version-history":[{"count":0,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/2698\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media\/2699"}],"wp:attachment":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media?parent=2698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/categories?post=2698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/tags?post=2698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}