{"id":2757,"date":"2026-11-26T21:17:25","date_gmt":"2026-11-27T03:17:25","guid":{"rendered":"https:\/\/www.patternsmart.com\/cn\/?p=2757"},"modified":"2026-11-27T03:27:10","modified_gmt":"2026-11-27T03:27:10","slug":"pine-script-v6-%e5%a6%82%e4%bd%95%e5%ae%a1%e8%ae%a1%e6%94%b6%e7%9b%98%e6%88%90%e4%ba%a4%e4%b8%8e%e4%b8%8b%e4%b8%80%e6%a0%b9%e5%bc%80%e7%9b%98%e6%88%90%e4%ba%a4%e7%9a%84%e5%9b%9e%e6%b5%8b%e5%b7%ae","status":"publish","type":"post","link":"https:\/\/www.patternsmart.com\/cn\/pine-script-v6-%e5%a6%82%e4%bd%95%e5%ae%a1%e8%ae%a1%e6%94%b6%e7%9b%98%e6%88%90%e4%ba%a4%e4%b8%8e%e4%b8%8b%e4%b8%80%e6%a0%b9%e5%bc%80%e7%9b%98%e6%88%90%e4%ba%a4%e7%9a%84%e5%9b%9e%e6%b5%8b%e5%b7%ae\/","title":{"rendered":"Pine Script v6 \u5982\u4f55\u5ba1\u8ba1\u6536\u76d8\u6210\u4ea4\u4e0e\u4e0b\u4e00\u6839\u5f00\u76d8\u6210\u4ea4\u7684\u56de\u6d4b\u5dee\u5f02"},"content":{"rendered":"<div class=\"postie-post\">\n<p>\u4ec5\u4ec5\u5141\u8bb8\u7ecf\u7eaa\u5546\u6a21\u62df\u5668\u5728\u4fe1\u53f7K\u7ebf\u6536\u76d8Tick\u6210\u4ea4\uff0c\u5c31\u53ef\u80fd\u4f7f\u7b56\u7565\u8868\u73b0\u660e\u663e\u6539\u5584\u3002\u8be5\u8bbe\u7f6e\u6539\u53d8\u7684\u662f\u8ba2\u5355\u5904\u7406\u65f6\u673a\uff0c\u800c\u975e\u539f\u59cb\u4fe1\u53f7\u8d28\u91cf\u3002\u6267\u884c\u5ba1\u8ba1\u5e94\u5355\u72ec\u63a7\u5236\u8fd9\u4e00\u53d8\u91cf\uff0c\u8861\u91cf\u62a5\u544a\u8868\u73b0\u5bf9\u6210\u4ea4\u5047\u8bbe\u7684\u4f9d\u8d56\u7a0b\u5ea6\u3002<\/p>\n<h2>\u5b9e\u4f8b\uff1a\u8df3\u7a7a\u6539\u53d8\u6536\u76ca<\/h2>\n<p>\u5047\u8bbe\u4e00\u5355\u4f4d\u591a\u5934\u4fe1\u53f7\u5728\u6536\u76d8100\u4ea7\u751f\uff0c\u4e0b\u4e00\u6839K\u7ebf\u5f00\u76d8104\u3002\u4e3a\u4e86\u63a7\u5236\u53d8\u91cf\uff0c\u5047\u8bbe\u4e24\u79cd\u6a21\u578b\u5747\u5728108\u9000\u51fa\u3002\u6536\u76d8\u6210\u4ea4\u6a21\u578b\u7684\u6bdb\u6536\u76ca\u4e3a8\u4e2a\u4ef7\u683c\u5355\u4f4d\uff0c\u4e0b\u4e00\u6839\u5f00\u76d8\u6a21\u578b\u4e3a4\uff0c\u76f8\u5dee4\u5b8c\u5168\u6765\u81ea\u5165\u573a\u6210\u4ea4\u5047\u8bbe\u3002\u6b64\u5904\u56fa\u5b9a\u9000\u51fa\u4ef7\u683c\u4ee5\u9694\u79bb\u5f71\u54cd\uff1b\u771f\u5b9e\u7b56\u7565\u4e2d\u6539\u53d8\u8bbe\u7f6e\u4e5f\u53ef\u80fd\u5f71\u54cd\u9000\u51fa\u53ca\u540e\u7eed\u4ea4\u6613\u5e8f\u5217\u3002<\/p>\n<figure><img decoding=\"async\" src=\"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/11\/PS_TV_CloseFill_CN_Fig1.png\" alt=\"PS_TV_CloseFill_CN_Fig1.png\" title=\"\u540c\u6837\u5728108\u9000\u51fa\uff0c\u5047\u8bbe\u6536\u76d8100\u5165\u573a\u6bdb\u6536\u76ca8\u4e2a\u4ef7\u683c\u5355\u4f4d\uff0c\u4e0b\u4e00\u6839\u5f00\u76d8104\u5165\u573a\u5219\u4e3a4\uff0c\u5747\u672a\u6263\u9664\u6210\u672c\u3002\" width=\"960\" height=\"420\" style=\"max-width:100%;height:auto\"><figcaption>\u540c\u6837\u5728108\u9000\u51fa\uff0c\u5047\u8bbe\u6536\u76d8100\u5165\u573a\u6bdb\u6536\u76ca8\u4e2a\u4ef7\u683c\u5355\u4f4d\uff0c\u4e0b\u4e00\u6839\u5f00\u76d8104\u5165\u573a\u5219\u4e3a4\uff0c\u5747\u672a\u6263\u9664\u6210\u672c\u3002<\/figcaption><\/figure>\n<table border=\"1\" cellpadding=\"8\" style=\"border-collapse:collapse;width:100%\">\n<tr>\n<th>\u6a21\u578b<\/th>\n<th>\u5165\u573a<\/th>\n<th>\u9000\u51fa<\/th>\n<th>\u6bcf\u5355\u4f4d\u6bdb\u6536\u76ca<\/th>\n<\/tr>\n<tr>\n<td>\u4fe1\u53f7\u6536\u76d8<\/td>\n<td>100<\/td>\n<td>108<\/td>\n<td>8<\/td>\n<\/tr>\n<tr>\n<td>\u4e0b\u4e00\u6839\u5f00\u76d8<\/td>\n<td>104<\/td>\n<td>108<\/td>\n<td>4<\/td>\n<\/tr>\n<\/table>\n<h2>Pine v6\u63a7\u5236\u53d8\u91cf\u5bf9\u6bd4<\/h2>\n<p>\u4e24\u6b21\u8fd0\u884c\u5e94\u4f7f\u7528\u76f8\u540c\u54c1\u79cd\u3001\u5468\u671f\u3001\u6d4b\u8bd5\u65e5\u671f\u3001\u624b\u7eed\u8d39\u3001\u6ed1\u70b9\u3001\u6570\u91cf\u53ca\u4fe1\u53f7\u903b\u8f91\u3002\u6b64\u5904SMA\u4ea4\u53c9\u4ec5\u7528\u4e8e\u53ef\u590d\u73b0\u4fe1\u53f7\u793a\u4f8b\uff0c\u5e76\u975e\u4ea4\u6613\u63a8\u8350\u3002\u58f0\u660e\u53c2\u6570\u63a7\u5236\u8ba1\u7b97\u4e0e\u8ba2\u5355\u5904\u7406\u3002\u5e38\u89c4\u6536\u76d8\u8ba1\u7b97\u4e14process_orders_on_close=false\u65f6\uff0c\u751f\u6210\u7684\u5e02\u4ef7\u5355\u901a\u5e38\u5728\u4e0b\u4e00\u53ef\u7528Tick\u6210\u4ea4\uff0c\u5386\u53f2\u56de\u6d4b\u4e2d\u901a\u5e38\u4e3a\u4e0b\u4e00\u6839\u5f00\u76d8\u3002\u542f\u7528\u8be5\u8bbe\u7f6e\u5141\u8bb8\u5728\u6536\u76d8Tick\u589e\u52a0\u4e00\u6b21\u8ba2\u5355\u5904\u7406\u673a\u4f1a\u3002<\/p>\n<pre style=\"white-space:pre;font-family:Consolas,Monaco,monospace\"><code><a href=\"mailto:\/\/@version=6\">\/\/@version=6<\/a><br>strategy(&quot;Fill timing audit&quot;, overlay = true,<br>\u00a0\u00a0\u00a0\u00a0pyramiding = 0, process_orders_on_close = false,<br>\u00a0\u00a0\u00a0\u00a0calc_on_every_tick = false,<br>\u00a0\u00a0\u00a0\u00a0calc_on_order_fills = false)<br>fast = ta.sma(close, 10)<br>slow = ta.sma(close, 30)<br>enterLong = ta.crossover(fast, slow)<br>exitLong = ta.crossunder(fast, slow)<br>if enterLong and strategy.position_size == 0<br>\u00a0\u00a0\u00a0\u00a0strategy.entry(&quot;L&quot;, strategy.long, qty = 1)<br>if exitLong and strategy.position_size &gt; 0<br>\u00a0\u00a0\u00a0\u00a0strategy.close(&quot;L&quot;)<br>\/\/ For comparison, change process_orders_on_close to true.<br>\/\/ Keep other settings constant.<\/code><\/pre>\n<h2>\u5ba1\u8ba1\u4ea4\u6613\u5217\u8868\uff0c\u800c\u975e\u4ec5\u770b\u51c0\u5229\u6da6<\/h2>\n<ol>\n<li>\u5bfc\u51fa\u4e24\u6b21\u4ea4\u6613\u5217\u8868\uff0c\u4f7f\u7528\u4fe1\u53f7\u65f6\u95f4\u6216\u72ec\u7acb\u4fe1\u53f7\u65e5\u5fd7\u5339\u914d\u4ea4\u6613\uff0c\u4e0d\u8981\u5047\u8bbe\u4ea4\u6613\u5e8f\u53f7\u59cb\u7ec8\u5bf9\u9f50\u3002<\/li>\n<li>\u6bd4\u8f83\u5165\u573a\u53ca\u9000\u51fa\u6210\u4ea4\u65f6\u95f4\u3001\u4ef7\u683c\u3001\u6570\u91cf\u3001\u8df3\u7a7a\u5e45\u5ea6\u4e0e\u4ea4\u6613\u6210\u672c\u3002<\/li>\n<li>\u8ba1\u7b97\u6536\u76ca\u5dee\u5f02\u4e2d\u7531\u6210\u4ea4\u65f6\u673a\u4ea7\u751f\u7684\u90e8\u5206\uff0c\u4ee5\u53ca\u7531\u4ea4\u6613\u5e8f\u5217\u53d8\u5316\u4ea7\u751f\u7684\u90e8\u5206\u3002<\/li>\n<li>\u5728\u5b58\u5728\u5f00\u76d8\u8df3\u7a7a\u3001\u591a\u65f6\u6bb5\u53ca\u4f4e\u6d41\u52a8\u6027\u7684\u5e02\u573a\u91cd\u590d\u6d4b\u8bd5\uff0c\u68c0\u67e5\u6bcf\u4e2a\u65f6\u6bb5\u7684\u6700\u540e\u4e00\u6839K\u7ebf\u3002<\/li>\n<li>\u4f7f\u7528\u5408\u7406\u624b\u7eed\u8d39\u53ca\u6ed1\u70b9\u8fdb\u884c\u538b\u529b\u6d4b\u8bd5\uff0c\u4e0d\u8981\u5728\u7f3a\u5c11\u53ef\u89e3\u91ca\u6267\u884c\u4f9d\u636e\u7684\u60c5\u51b5\u4e0b\u4ec5\u9009\u62e9\u6536\u76ca\u66f4\u9ad8\u7684\u6a21\u578b\u3002<\/li>\n<\/ol>\n<h2>\u7ecf\u7eaa\u5546\u6a21\u62df\u5668\u4e0e\u771f\u5b9e\u6267\u884c<\/h2>\n<p>TradingView\u8ba2\u5355\u6210\u4ea4\u63d0\u9192\u4ee3\u8868\u6a21\u62df\u5668\u6210\u4ea4\uff0c\u800c\u975e\u7ecf\u7eaa\u5546\u786e\u8ba4\u3002\u82e5\u5728\u6700\u540e\u4e00\u4e2a\u6536\u76d8Tick\u4ea7\u751f\u63d0\u9192\uff0cWebhook\u62b5\u8fbe\u6267\u884c\u6865\u63a5\u7a0b\u5e8f\u65f6\u5e02\u573a\u53ef\u80fd\u5df2\u5173\u95ed\u3002\u771f\u5b9e\u8ba2\u5355\u53ef\u80fd\u5ef6\u8fdf\u3001\u90e8\u5206\u6210\u4ea4\u3001\u88ab\u62d2\u6216\u4ea7\u751f\u6ed1\u70b9\u3002\u5e94\u72ec\u7acb\u6838\u5bf9\u7ecf\u7eaa\u5546\u8ba2\u5355ID\u53ca\u5b9e\u9645\u6210\u4ea4\u4ef7\u683c\u3002\u63d0\u9192\u53bb\u91cd\u3001\u4ea4\u6613\u65f6\u6bb5\u8d44\u683c\u53ca\u7ecf\u7eaa\u5546\u7aef\u98ce\u9669\u63a7\u5236\u9700\u4e0ePine\u4fe1\u53f7\u5206\u5f00\u3002\u4e24\u79cd\u6210\u4ea4\u6a21\u578b\u5747\u4e0d\u80fd\u4fdd\u8bc1\u5b9e\u76d8\u53d6\u5f97\u6a21\u62df\u4ef7\u683c\u3002<\/p>\n<p>\u5b98\u65b9\u53c2\u8003\uff1a<a href=\"https:\/\/www.tradingview.com\/pine-script-docs\/concepts\/strategies\/\">\u5e73\u53f0\u5f00\u53d1\u6587\u6863<\/a>\u3002<\/p>\n<p>\u4ee5\u4e0a\u4e3a\u5047\u8bbe\u6027\u6559\u5b66\u793a\u4f8b\uff0c\u672a\u5b9e\u9645\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\u7b26\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>\u4ec5\u4ec5\u5141\u8bb8\u7ecf\u7eaa\u5546\u6a21\u62df\u5668\u5728\u4fe1\u53f7K\u7ebf\u6536\u76d8Tick\u6210\u4ea4\uff0c\u5c31\u53ef\u80fd\u4f7f\u7b56\u7565\u8868\u73b0\u660e\u663e\u6539\u5584\u3002\u8be5\u8bbe\u7f6e\u6539\u53d8\u7684\u662f\u8ba2\u5355\u5904\u7406\u65f6\u673a\uff0c\u800c\u975e\u539f\u59cb [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2758,"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,553,622,639],"class_list":["post-2757","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-553","tag-622","tag-639"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/11\/PS_TV_CloseFill_CN_Fig1.png","_links":{"self":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/2757","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=2757"}],"version-history":[{"count":0,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/2757\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media\/2758"}],"wp:attachment":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media?parent=2757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/categories?post=2757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/tags?post=2757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}