{"id":2833,"date":"2026-11-28T16:04:52","date_gmt":"2026-11-28T22:04:52","guid":{"rendered":"https:\/\/www.patternsmart.com\/cn\/?p=2833"},"modified":"2026-11-28T22:07:17","modified_gmt":"2026-11-28T22:07:17","slug":"thinkscript-%e6%8c%af%e5%b9%85%e5%8a%a0%e6%9d%83%e6%94%b6%e7%9b%98%e4%bd%8d%e7%bd%ae%e6%8c%87%e6%a0%87","status":"publish","type":"post","link":"https:\/\/www.patternsmart.com\/cn\/thinkscript-%e6%8c%af%e5%b9%85%e5%8a%a0%e6%9d%83%e6%94%b6%e7%9b%98%e4%bd%8d%e7%bd%ae%e6%8c%87%e6%a0%87\/","title":{"rendered":"thinkScript \u632f\u5e45\u52a0\u6743\u6536\u76d8\u4f4d\u7f6e\u6307\u6807"},"content":{"rendered":"<div class=\"postie-post\">\n<div>\n<p><em>\u9ad8\u7ea7\u4ea4\u6613\u6559\u7a0b\uff5cthinkScript\uff5c\u632f\u5e45\u52a0\u6743\u6536\u76d8\u4f4d\u7f6e\u6307\u6807<\/em><\/p>\n<p>\u6536\u76d8\u4ef7\u63a5\u8fd1\u6700\u9ad8\u4ef7\u901a\u5e38\u88ab\u89c6\u4e3a\u4ef7\u683c\u504f\u5f3a\u7684\u8868\u73b0\uff0c\u4f46\u7a84\u5e45K\u7ebf\u4e0e\u5bbd\u5e45K\u7ebf\u662f\u5426\u5e94\u5177\u6709\u76f8\u540c\u7684\u7edf\u8ba1\u6743\u91cd\uff0c\u53d6\u51b3\u4e8e\u5206\u6790\u76ee\u7684\u3002\u672c\u6559\u7a0b\u4e3a Thinkorswim \u5f00\u53d1\u4e00\u4e2a\u632f\u5e45\u52a0\u6743\u6536\u76d8\u4f4d\u7f6e\u6307\u6807\uff0c\u5229\u7528\u5df2\u6536\u76d8K\u7ebf\u7684\u6536\u76d8\u4ef7\u4e0e\u6700\u4f4e\u4ef7\u4e4b\u95f4\u7684\u8ddd\u79bb\uff0c\u8861\u91cf\u8fd1\u671f\u6536\u76d8\u4f4d\u7f6e\u7684\u6574\u4f53\u5206\u5e03\u3002<\/p>\n<h2>\u8ba1\u7b97\u539f\u7406<\/h2>\n<p>\u5bf9\u6bcf\u6839\u5df2\u6536\u76d8K\u7ebf\uff0c\u5b9a\u4e49\u632f\u5e45 R = \u6700\u9ad8\u4ef7 \u2212 \u6700\u4f4e\u4ef7\uff0c\u6536\u76d8\u504f\u79fb O = \u6536\u76d8\u4ef7 \u2212 \u6700\u4f4e\u4ef7\u3002\u6307\u6807\u503c\u4e3a 100 \u00d7 Sum(O,N) \/ Sum(R,N)\u3002\u6b63\u5e38OHLC\u6570\u636e\u4e0b\uff0c\u53d6\u503c\u8303\u56f4\u4e3a0\u81f3100\u3002\u8be5\u516c\u5f0f\u7b49\u4ef7\u4e8e\u4f7f\u7528\u6bcf\u6839K\u7ebf\u7684\u632f\u5e45\u5bf9\u5176\u6536\u76d8\u4f4d\u7f6e\u767e\u5206\u6bd4\u8fdb\u884c\u52a0\u6743\u3002\u5bbd\u5e45K\u7ebf\u8d21\u732e\u66f4\u5927\uff0c\u96f6\u632f\u5e45K\u7ebf\u5bf9\u5206\u5b50\u548c\u5206\u6bcd\u7684\u8d21\u732e\u5747\u4e3a\u96f6\uff1b\u6574\u4e2a\u7a97\u53e3\u632f\u5e45\u4e3a\u96f6\u65f6\u4e0d\u663e\u793a\u6570\u503c\u300250\u4e3a\u4e2d\u6027\u53c2\u7167\uff0c\u8d85\u8fc750\u610f\u5473\u7740\u7d2f\u8ba1\u6536\u76d8\u504f\u79fb\u8d85\u8fc7\u7d2f\u8ba1\u632f\u5e45\u7684\u4e00\u534a\uff0c\u800c\u4e0d\u662f\u5fc5\u7136\u6709\u8d85\u8fc7\u534a\u6570K\u7ebf\u6536\u5728\u5404\u81ea\u4e2d\u70b9\u4e0a\u65b9\u3002<\/p>\n<h2>\u5047\u8bbe\u793a\u4f8b<\/h2>\n<p>\u4e09\u6839\u5df2\u6536\u76d8K\u7ebf\u7684\u632f\u5e45\u5206\u522b\u4e3a10\u30014\u548c6\u70b9\uff0c\u6536\u76d8\u4ef7\u51cf\u6700\u4f4e\u4ef7\u5206\u522b\u4e3a8\u30011\u548c3\u70b9\u3002\u5404\u81ea\u6536\u76d8\u4f4d\u7f6e\u4e3a80%\u300125%\u548c50%\uff0c\u7b49\u6743\u5e73\u5747\u7ea651.67%\u3002\u632f\u5e45\u52a0\u6743\u7ed3\u679c\u5219\u4e3a100 \u00d7 (8 + 1 + 3)\/(10 + 4 + 6) = 60%\u3002<\/p>\n<figure><img decoding=\"async\" src=\"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/11\/PS_TOS_RangeLocation_CN_Fig1.png\" alt=\"PS_TOS_RangeLocation_CN_Fig1.png\" style=\"max-width:100%;height:auto\"><figcaption>\u84dd\u8272\u8868\u793a\u6700\u4f4e\u4ef7\u81f3\u6536\u76d8\u4ef7\u7684\u8ddd\u79bb\uff0c\u5b8c\u6574\u6761\u5f62\u8868\u793a\u632f\u5e45\u3002\u7d2f\u8ba1\u504f\u79fb12\u70b9\uff0c\u7d2f\u8ba1\u632f\u5e4520\u70b9\u3002<\/figcaption><\/figure>\n<p>\u7b2c\u4e00\u6839K\u7ebf\u5360\u603b\u632f\u5e45\u7684\u4e00\u534a\uff0c\u56e0\u6b64\u5177\u6709\u4e00\u534a\u6743\u91cd\u3002\u4e24\u79cd\u7edf\u8ba1\u65b9\u5f0f\u6ca1\u6709\u7edd\u5bf9\u4f18\u52a3\uff1a\u52a0\u6743\u65b9\u6cd5\u7a81\u51fa\u8f83\u5927\u7684\u4ef7\u683c\u6ce2\u52a8\uff0c\u7b49\u6743\u65b9\u6cd5\u5219\u63cf\u8ff0\u4e0d\u8003\u8651\u632f\u5e45\u5927\u5c0f\u7684\u5178\u578bK\u7ebf\u3002<\/p>\n<h2>\u5b8c\u6574 thinkScript \u6e90\u7801<\/h2>\n<pre style=\"white-space:pre;font-family:Consolas,Monaco,monospace\"><code>declare lower;<br>input length = 20;<br># Use completed bars only.<br>def span = high[1] - low[1];<br>def offset = close[1] - low[1];<br>def totalRange = Sum(span, length);<br>def totalOffset = Sum(offset, length);<br>plot Location = if totalRange &gt; 0 then<br>\u00a0\u00a0\u00a0\u00a0100 * totalOffset \/ totalRange<br>\u00a0\u00a0\u00a0\u00a0else Double.NaN;<br>Location.SetDefaultColor(Color.CYAN);<br>plot Neutral = 50;<br>Neutral.SetDefaultColor(Color.GRAY);<\/code><\/pre>\n<h2>\u5b89\u88c5\u53ca\u53c2\u6570<\/h2>\n<p>\u5728 Thinkorswim \u7684 Charts \u4e2d\u9009\u62e9 Studies\uff0c\u518d\u8fdb\u5165 Edit Studies\uff0c\u65b0\u5efa\u81ea\u5b9a\u4e49\u6307\u6807\uff0c\u7c98\u8d34\u5b8c\u6574\u4ee3\u7801\uff0c\u547d\u540d\u4fdd\u5b58\u5e76\u6dfb\u52a0\u81f3\u56fe\u8868\u3002\u6307\u6807\u663e\u793a\u5728\u526f\u56fe\u4e2d\uff0c\u5e76\u7ed8\u523650\u4e2d\u6027\u7ebf\u3002length \u5e94\u8bbe\u4e3a\u6b63\u6574\u6570\uff0c\u9ed8\u8ba420\u6839\u5df2\u6536\u76d8K\u7ebf\u3002\u8f83\u77ed\u5468\u671f\u59825\u5bf9\u5355\u6839\u5bbd\u5e45K\u7ebf\u66f4\u654f\u611f\uff0c\u8f83\u957f\u5468\u671f\u598250\u5219\u5c06\u5f71\u54cd\u5206\u6563\u5230\u66f4\u591a\u89c2\u5bdf\u6837\u672c\u3002\u5efa\u8bae\u5728\u540c\u4e00\u54c1\u79cd\u548c\u5468\u671f\u4e0a\u6bd4\u8f83\u4e0d\u540c\u53c2\u6570\uff0c\u4e0d\u8981\u4ec5\u51ed\u5386\u53f2\u8d70\u52bf\u62df\u5408\u9009\u62e9\u53c2\u6570\u3002\u672c\u7a0b\u5e8f\u4e3a\u56fe\u8868\u6307\u6807\u800c\u975e Stock Hacker \u626b\u63cf\u5668\uff0c\u5c1a\u672a\u5728\u5b9e\u9645 Thinkorswim \u73af\u5883\u4e2d\u7f16\u8bd1\u9a8c\u8bc1\u3002<\/p>\n<h2>\u6536\u76d8\u786e\u8ba4\u4e0e\u91cd\u7ed8<\/h2>\n<p>\u6240\u6709OHLC\u5f15\u7528\u5747\u4f7f\u7528\u504f\u79fb1\uff0c\u7edf\u8ba1\u4ece\u5f53\u524dK\u7ebf\u4e4b\u524d\u6700\u8fd1\u4e00\u6839\u5df2\u6536\u76d8K\u7ebf\u5f00\u59cb\u3002\u56e0\u6b64\u5f53\u524d\u5f62\u6210\u4e2d\u7684\u6700\u9ad8\u4ef7\u3001\u6700\u4f4e\u4ef7\u548c\u6536\u76d8\u4ef7\u53d8\u5316\u4e0d\u4f1a\u8fdb\u5165\u8ba1\u7b97\uff0c\u7ed3\u679c\u5728\u4e0b\u4e00\u6839K\u7ebf\u53ef\u7528\uff0c\u4e0d\u5f15\u7528\u672a\u6765\u6570\u636e\u3002\u5386\u53f2\u884c\u60c5\u4fee\u8ba2\u6216\u4ea4\u6613\u65f6\u6bb5\u8bbe\u7f6e\u53d8\u5316\u4ecd\u53ef\u80fd\u6539\u53d8\u8f93\u5165\u3002\u89e3\u8bfb\u6307\u6807\u521d\u59cb\u503c\u524d\u5e94\u786e\u4fdd\u8db3\u591f\u7684\u5386\u53f2\u6570\u636e\u3002<\/p>\n<h2>\u5b9e\u9645\u5206\u6790\u65b9\u6cd5<\/h2>\n<p>\u4e0a\u6da8\u8fc7\u7a0b\u4e2d\u6301\u7eed\u8f83\u9ad8\u7684\u6307\u6807\u503c\u53ef\u80fd\u53cd\u6620\u8fd1\u671f\u6536\u76d8\u4ef7\u96c6\u4e2d\u5728\u632f\u5e45\u4e0a\u90e8\u3002\u4ef7\u683c\u4e0a\u6da8\u4f46\u6307\u6807\u4e0b\u964d\u53ef\u80fd\u8bf4\u660e\u6536\u76d8\u884c\u4e3a\u53d1\u751f\u53d8\u5316\uff0c\u5374\u4e0d\u80fd\u8bc1\u660e\u8d8b\u52bf\u5373\u5c06\u53cd\u8f6c\u3002\u65b0\u95fb\u4e8b\u4ef6\u5f62\u6210\u7684\u5355\u6839\u5bbd\u5e45K\u7ebf\u53ef\u80fd\u5728\u591a\u4e2a\u5468\u671f\u5185\u5360\u636e\u8f83\u5927\u6743\u91cd\uff0c\u9000\u51fa\u7a97\u53e3\u65f6\u9020\u6210\u6307\u6807\u8df3\u53d8\u3002\u8fd9\u662f\u52a0\u6743\u65b9\u5f0f\u7684\u81ea\u7136\u7ed3\u679c\uff0c\u800c\u975e\u7a0b\u5e8f\u9519\u8bef\u3002\u672c\u6307\u6807\u4e0d\u4f7f\u7528\u6210\u4ea4\u91cf\uff0c\u4e0d\u533a\u5206\u5b9e\u9645\u4e70\u5356\u8ba2\u5355\uff0c\u4e5f\u4e0d\u8861\u91cf\u771f\u5b9e\u8d44\u91d1\u6d41\u3002\u53ef\u540c\u65f6\u89c2\u5bdf\u7b49\u6743\u6536\u76d8\u4f4d\u7f6e\u6307\u6807\uff0c\u4ee5\u5206\u6790\u5f02\u5e38\u632f\u5e45\u5bf9\u7ed3\u679c\u7684\u5f71\u54cd\u3002<\/p>\n<h2>\u9a8c\u8bc1\u6e05\u5355<\/h2>\n<ul>\n<li>\u5c06\u957f\u5ea6\u8bbe\u4e3a3\uff0c\u7528\u624b\u5de5\u8ba1\u7b97\u7684OHLC\u6570\u636e\u6838\u5bf9\u7ed3\u679c\u3002<\/li>\n<li>\u68c0\u67e5\u6240\u6709\u6709\u6548\u6837\u672c\u5747\u6536\u4e8e\u6700\u9ad8\u4ef7\u6216\u6700\u4f4e\u4ef7\u65f6\uff0c\u6307\u6807\u662f\u5426\u5206\u522b\u4e3a100\u62160\u3002<\/li>\n<li>\u68c0\u67e5\u5b8c\u5168\u65e0\u632f\u5e45\u7684\u7a97\u53e3\u662f\u5426\u4e0d\u663e\u793a\u6570\u503c\u3002<\/li>\n<li>\u89c2\u5bdf\u5b9e\u65f6\u5f62\u6210\u4e2d\u7684K\u7ebf\uff0c\u786e\u8ba4\u5176\u81ea\u8eab\u4ef7\u683c\u53d8\u5316\u4e0d\u53c2\u4e0e\u8ba1\u7b97\u3002<\/li>\n<li>\u6bd4\u8f83\u5e38\u89c4\u4e0e\u5ef6\u957f\u4ea4\u6613\u65f6\u6bb5\uff0c\u5e76\u68c0\u67e5\u5bbd\u5e45K\u7ebf\u9000\u51fa\u7a97\u53e3\u65f6\u7684\u5f71\u54cd\u3002<\/li>\n<\/ul>\n<h2>\u5c40\u9650\u4e0e\u5b9a\u5236<\/h2>\n<p>\u6700\u9ad8\u4ef7\u4e0e\u6700\u4f4e\u4ef7\u4e4b\u5dee\u4e0d\u5305\u542bK\u7ebf\u4e4b\u95f4\u7684\u8df3\u7a7a\u3002\u8f83\u5927\u7684\u9694\u591c\u8df3\u7a7a\u4e4b\u540e\u82e5\u51fa\u73b0\u7a84\u5e45K\u7ebf\uff0c\u5373\u4f7f\u6574\u4f53\u4ef7\u683c\u4f4d\u79fb\u5f88\u5927\uff0c\u8be5K\u7ebf\u7684\u7edf\u8ba1\u6743\u91cd\u4e5f\u53ef\u80fd\u5f88\u5c0f\u3002\u975e\u6807\u51c6\u56fe\u8868\u4e5f\u53ef\u80fd\u6539\u53d8\u8f93\u5165\u6570\u636e\u7684\u542b\u4e49\u3002\u672c\u6307\u6807\u4e0d\u662f\u6ce2\u52a8\u7387\u8c03\u6574\u6536\u76ca\u7387\u3001\u6982\u7387\u4f30\u8ba1\u6216\u72ec\u7acb\u4ea4\u6613\u4fe1\u53f7\u3002\u5982\u679c\u60a8\u5e0c\u671b\u589e\u52a0\u4ea4\u6613\u65f6\u6bb5\u8fc7\u6ee4\u6216\u4e0e\u73b0\u6709\u6307\u6807\u6574\u5408\uff0c\u6b22\u8fce\u8054\u7cfb\u6211\u4eec\u7684<a href=\"https:\/\/www.patternsmart.com\/cn\/custom\/\">Thinkorswim\u6307\u6807\u5b9a\u5236\u5f00\u53d1\u670d\u52a1<\/a>\u3002<\/p>\n<p><strong>\u98ce\u9669\u63d0\u793a\uff1a<\/strong>\u793a\u4f8b\u4e3a\u5047\u8bbe\u6570\u636e\uff0c\u4ec5\u4f9b\u6280\u672f\u6559\u80b2\uff0c\u4e0d\u4ee3\u8868\u76c8\u5229\u80fd\u529b\u6216\u672a\u6765\u8868\u73b0\u3002\u5b9e\u9645\u5e94\u7528\u524d\u5e94\u72ec\u7acb\u9a8c\u8bc1\u5e76\u8003\u8651\u4ea4\u6613\u6210\u672c\u53ca\u6267\u884c\u98ce\u9669\u3002<\/p>\n<\/p><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u9ad8\u7ea7\u4ea4\u6613\u6559\u7a0b\uff5cthinkScript\uff5c\u632f\u5e45\u52a0\u6743\u6536\u76d8\u4f4d\u7f6e\u6307\u6807 \u6536\u76d8\u4ef7\u63a5\u8fd1\u6700\u9ad8\u4ef7\u901a\u5e38\u88ab\u89c6\u4e3a\u4ef7\u683c\u504f\u5f3a\u7684\u8868\u73b0\uff0c\u4f46\u7a84\u5e45K [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2834,"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":[71,233,217],"tags":[424,464],"class_list":["post-2833","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thinkorswim","category-233","category-217","tag-thinkorswim","tag-464"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/11\/PS_TOS_RangeLocation_CN_Fig1.png","_links":{"self":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/2833","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=2833"}],"version-history":[{"count":0,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/2833\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media\/2834"}],"wp:attachment":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media?parent=2833"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/categories?post=2833"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/tags?post=2833"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}