{"id":3163,"date":"2026-12-04T18:05:11","date_gmt":"2026-12-05T00:05:11","guid":{"rendered":"https:\/\/www.patternsmart.com\/cn\/?p=3163"},"modified":"2026-12-05T00:08:31","modified_gmt":"2026-12-05T00:08:31","slug":"thinkscript%e5%b8%a6%e6%9c%89%e6%95%88%e6%9c%9f%e7%9a%84rsi%e5%9b%9e%e8%b0%83%e6%81%a2%e5%a4%8d%e6%a8%a1%e6%8b%9f%e7%ad%96%e7%95%a5","status":"publish","type":"post","link":"https:\/\/www.patternsmart.com\/cn\/thinkscript%e5%b8%a6%e6%9c%89%e6%95%88%e6%9c%9f%e7%9a%84rsi%e5%9b%9e%e8%b0%83%e6%81%a2%e5%a4%8d%e6%a8%a1%e6%8b%9f%e7%ad%96%e7%95%a5\/","title":{"rendered":"thinkScript\u5e26\u6709\u6548\u671f\u7684RSI\u56de\u8c03\u6062\u590d\u6a21\u62df\u7b56\u7565"},"content":{"rendered":"<div class=\"postie-post\">\n<p>RSI\u91cd\u65b0\u7ad9\u4e0a\u67d0\u4e2a\u9608\u503c\u65f6\uff0c\u5b83\u8fd8\u662f\u4f60\u539f\u672c\u7b49\u5f85\u7684\u56de\u8c03\u673a\u4f1a\uff0c\u8fd8\u662f\u5df2\u7ecf\u8fc7\u671f\u7684\u4fe1\u53f7\uff1f\u4e3a\u56de\u8c03\u6062\u590d\u8bbe\u7f6e\u6709\u6548\u671f\uff0c\u53ef\u4ee5\u907f\u514d\u628a\u5f88\u4e45\u4ee5\u540e\u51fa\u73b0\u7684\u9608\u503c\u4e0a\u7a7f\u8bef\u5f53\u4f5c\u539f\u6765\u7684\u4ea4\u6613\u673a\u4f1a\u3002<\/p>\n<h2>\u672c\u6587\u5c06\u89e3\u51b3\u54ea\u4e9b\u95ee\u9898<\/h2>\n<ul>\n<li>\u5982\u4f55\u533a\u5206\u53ca\u65f6\u6062\u590d\u7684RSI\u4fe1\u53f7\u4e0e\u8fc7\u671f\u4fe1\u53f7\u3002<\/li>\n<li>\u5982\u4f55\u7ed3\u5408\u6709\u9650\u5165\u573a\u7a97\u53e3\u3001\u8d8b\u52bf\u8fc7\u6ee4\u548c\u660e\u786e\u9000\u51fa\u6761\u4ef6\u3002<\/li>\n<li>\u5982\u4f55\u5728thinkScript\u4e2d\u6a21\u62df\u4e0b\u4e00\u6839K\u7ebf\u6210\u4ea4\u4e0e\u6301\u4ed3\u72b6\u6001\uff0c\u5e76\u533a\u5206\u6a21\u62df\u548c\u5b9e\u76d8\u3002<\/li>\n<li>\u5982\u4f55\u6d4b\u8bd5\u6709\u6548\u671f\u8fb9\u754c\u3001\u8df3\u7a7a\u53ca\u4ea4\u6613\u6210\u672c\u5f71\u54cd\u3002<\/li>\n<\/ul>\n<h2>\u4fe1\u53f7\u4e0e\u9000\u51fa\u89c4\u5219<\/h2>\n<p>\u91c7\u752814\u5468\u671fRSI\u548c50\u5468\u671fEMA\u3002RSI\u4e0b\u7a7f40\u65f6\u6fc0\u6d3b\u4fe1\u53f7\uff0c\u5e74\u9f84\u4ece\u96f6\u5f00\u59cb\uff0c\u4e0d\u8981\u6c42\u6b64\u65f6\u8d8b\u52bf\u901a\u8fc7\u3002\u968f\u540eRSI\u4e0a\u7a7f40\u65f6\uff0c\u53ea\u6709\u4fe1\u53f7\u5e74\u9f84\u4e3a1\u81f33\u6839K\u7ebf\u4e14\u6536\u76d8\u9ad8\u4e8eEMA\u624d\u5141\u8bb8\u5165\u573a\u3002\u6a21\u62df\u591a\u5934\u6301\u4ed3\u671f\u95f4\uff0c\u6536\u76d8\u4f4e\u4e8eEMA\u6216RSI\u4e0b\u7a7f50\u65f6\u9000\u51fa\u3002\u8fd9\u4e9b\u5c5e\u4e8e\u6536\u76d8\u786e\u8ba4\u540e\u7684\u5e02\u4ef7\u9000\u51fa\u6761\u4ef6\uff0c\u5e76\u975e\u4fdd\u62a4\u6027\u6b62\u635f\u6302\u5355\u3002\u6a21\u62df\u4ed3\u4f4d\u5e94\u4fdd\u5b88\u8bbe\u7f6e\uff1b\u72ec\u7acb\u5b9e\u76d8\u98ce\u9669\u7cfb\u7edf\u8fd8\u9700\u8981\u7ecf\u7eaa\u5546\u7aef\u4fdd\u62a4\u53ca\u8d44\u91d1\u4e8f\u635f\u9884\u7b97\u3002<\/p>\n<h2>\u6570\u503c\u793a\u4f8b<\/h2>\n<p>\u5047\u8bbeRSI\u4f9d\u6b21\u4e3a44\u300135\u300138\u300143\u300147\u3002\u964d\u81f335\u6fc0\u6d3b\u4fe1\u53f7\uff0c38\u5bf9\u5e94\u5e74\u9f841\uff0c43\u5bf9\u5e94\u5e74\u9f842\uff0c\u82e5EMA\u8fc7\u6ee4\u901a\u8fc7\u5219\u786e\u8ba4\u5165\u573a\u3002\u82e5\u76f4\u5230\u5e74\u9f844\u624d\u4e0a\u7a7f40\uff0c\u5219\u62d2\u7edd\u3002\u6a21\u62df\u6210\u4ea4\u91c7\u7528\u4e0b\u4e00\u6839K\u7ebf\u5f00\u76d8\u4ef7\uff0c\u800c\u975e\u4e0b\u4e00\u6839RSI\u6570\u503c\u3002<\/p>\n<p> <img decoding=\"async\" alt=\"rsi-recovery-window.png\" src=\"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/12\/rsi-recovery-window.png\" width=\"720\"><\/p>\n<p><em>\u5047\u8bbeRSI\u5e8f\u5217\uff1a\u5e74\u9f842\u65f6\u786e\u8ba4\u6062\u590d\uff0c\u6700\u540e\u4e00\u6b21\u89c2\u5bdf\u6807\u8bb0\u4e0b\u4e00\u6839\u6210\u4ea4K\u7ebf\uff0c\u5e76\u975e\u7b2c\u4e8c\u6b21\u5165\u573a\u3002<\/em><\/p>\n<h2>thinkScript\u7b56\u7565\u5b9e\u73b0<\/h2>\n<pre style=\"white-space:pre;font-family:Consolas,Monaco,monospace\"><code>input length = 14;<br>input recovery = 40;<br>input maxAge = 3;<br>def r = RSI(length = length);<br>def trend = close &gt; ExpAverage(close, 50);<br>def arm = r crosses below recovery;<br>def age = CompoundValue(1,<br>\u00a0\u00a0\u00a0\u00a0if arm then 0 else Min(age[1] + 1, maxAge + 1),<br>\u00a0\u00a0\u00a0\u00a0maxAge + 1);<br>def enter = trend and (r crosses above recovery)<br>\u00a0\u00a0\u00a0\u00a0and age &gt;= 1 and age &lt;= maxAge;<br>def leave = close &lt; ExpAverage(close, 50)<br>\u00a0\u00a0\u00a0\u00a0or (r crosses below 50);<br>def holding = CompoundValue(1,<br>\u00a0\u00a0\u00a0\u00a0if holding[1] and leave then 0<br>\u00a0\u00a0\u00a0\u00a0else if !holding[1] and enter then 1<br>\u00a0\u00a0\u00a0\u00a0else holding[1], 0);<br>AddOrder(OrderType.BUY_TO_OPEN,<br>\u00a0\u00a0\u00a0\u00a0!holding[1] and enter, open[-1], 1,<br>\u00a0\u00a0\u00a0\u00a0Color.GREEN, Color.GREEN, &quot;Recovery&quot;);<br>AddOrder(OrderType.SELL_TO_CLOSE,<br>\u00a0\u00a0\u00a0\u00a0holding[1] and leave, open[-1], 1,<br>\u00a0\u00a0\u00a0\u00a0Color.RED, Color.RED, &quot;Exit&quot;);<\/code><\/pre>\n<p>\u5c06\u4ee3\u7801\u6dfb\u52a0\u4e3a\u7b56\u7565\u800c\u975e\u666e\u901a\u6307\u6807\u3002CompoundValue\u521d\u59cb\u5316\u9012\u5f52\u8ba1\u6570\u5668\uff0cholding\u53d8\u91cf\u5728\u4fe1\u53f7K\u7ebf\u8bb0\u5f55\u8ba1\u5212\u6301\u4ed3\u8f6c\u6362\u3002AddOrder\u901a\u8fc7open[-1]\u6a21\u62df\u4e0b\u4e00\u6839K\u7ebf\u5f00\u76d8\u6210\u4ea4\uff1b\u8be5\u524d\u5411\u5f15\u7528\u53ea\u7528\u4e8e\u6a21\u62df\u6210\u4ea4\u4ef7\u683c\uff0c\u4e0d\u53c2\u4e0e\u51b3\u7b56\u6761\u4ef6\u3002holding\u4e0d\u662f\u7ecf\u7eaa\u5546\u771f\u5b9e\u6301\u4ed3\u6216\u6210\u4ea4\u56de\u62a5\u3002\u793a\u4f8b\u5047\u8bbe\u6a21\u62df\u6307\u4ee4\u5747\u80fd\u6210\u4ea4\uff0c\u6bcf\u6b21\u4ea4\u6613\u4e00\u4e2a\u5355\u4f4d\uff0c\u672a\u5b9e\u73b0\u76d8\u4e2d\u6b62\u635f\u3001\u90e8\u5206\u6210\u4ea4\u6216\u5b9e\u76d8\u62d2\u5355\u5904\u7406\u3002\u53c2\u8003<a href=\"https:\/\/toslc.thinkorswim.com\/center\/reference\/thinkScript\/Functions\/Others\/AddOrder\">AddOrder\u5b98\u65b9\u6587\u6863<\/a>\u3002<\/p>\n<h2>\u6d4b\u8bd5\u5e02\u573a\u5047\u8bbe\uff0c\u800c\u975e\u8ffd\u6c42\u5386\u53f2\u6700\u4f18\u53c2\u6570<\/h2>\n<p>\u4fdd\u6301EMA\u3001\u9000\u51fa\u548c\u6570\u91cf\u4e00\u81f4\uff0c\u5bf9\u6bd42\u30013\u30015\u6839K\u7ebf\u6062\u590d\u7a97\u53e3\u53ca\u4e0d\u9650\u5236\u6709\u6548\u671f\u7684\u57fa\u51c6\u3002\u68c0\u67e5\u89e6\u53ca\u9608\u503c\u4f46\u672a\u4e0a\u7a7f\u3001\u518d\u6b21\u4e0b\u7a7f\u3001\u4fe1\u53f7\u8fc7\u671f\u3001\u4f4e\u4e8eEMA\u65f6\u6062\u590d\u4ee5\u53ca\u4e0b\u4e00\u5f00\u76d8\u8df3\u7a7a\u3002\u8ba1\u5165\u5408\u7406\u4ea4\u6613\u6210\u672c\uff0c\u5728\u6837\u672c\u5916\u89c2\u5bdf\u51c0\u6536\u76ca\u3001\u4ea4\u6613\u6b21\u6570\u3001\u56de\u64a4\u548c\u6700\u5927\u4e0d\u5229\u6ce2\u52a8\u3002\u6536\u76d8\u9000\u51fa\u53ef\u80fd\u627f\u53d7\u8f83\u5927\u76d8\u4e2d\u4e8f\u635f\u3002AddOrder\u4ec5\u7528\u4e8e\u7b56\u7565\u6a21\u62df\uff0c\u4e0d\u80fd\u5b9e\u73b0\u65e0\u4eba\u503c\u5b88\u5b9e\u76d8\u4ea4\u6613\u3002\u4ee3\u7801\u672a\u7ecf\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\/\">Thinkorswim\u4ea4\u6613\u7b56\u7565\u5b9a\u5236\u5f00\u53d1\u670d\u52a1<\/a>\u3002<\/p>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>RSI\u91cd\u65b0\u7ad9\u4e0a\u67d0\u4e2a\u9608\u503c\u65f6\uff0c\u5b83\u8fd8\u662f\u4f60\u539f\u672c\u7b49\u5f85\u7684\u56de\u8c03\u673a\u4f1a\uff0c\u8fd8\u662f\u5df2\u7ecf\u8fc7\u671f\u7684\u4fe1\u53f7\uff1f\u4e3a\u56de\u8c03\u6062\u590d\u8bbe\u7f6e\u6709\u6548\u671f\uff0c\u53ef\u4ee5\u907f\u514d\u628a\u5f88\u4e45 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3164,"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,520,233],"tags":[146,97,152,177,784,746,639],"class_list":["post-3163","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thinkorswim","category-520","category-233","tag-ema","tag-rsi","tag-thinkorswim","tag-thinkscript","tag-784","tag-746","tag-639"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/www.patternsmart.com\/cn\/wp-content\/uploads\/2026\/12\/rsi-recovery-window.png","_links":{"self":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/3163","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=3163"}],"version-history":[{"count":0,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/3163\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media\/3164"}],"wp:attachment":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media?parent=3163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/categories?post=3163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/tags?post=3163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}