{"id":496,"date":"2017-02-22T02:45:31","date_gmt":"2017-02-22T02:45:31","guid":{"rendered":"http:\/\/www.patternsmart.com\/cn\/?p=496"},"modified":"2017-02-22T02:45:31","modified_gmt":"2017-02-22T02:45:31","slug":"secondary-aggregation-period-cannot-be-less-than-the-primary-aggregation-period-in-thinkscript","status":"publish","type":"post","link":"https:\/\/www.patternsmart.com\/cn\/secondary-aggregation-period-cannot-be-less-than-the-primary-aggregation-period-in-thinkscript\/","title":{"rendered":"secondary aggregation period cannot be less than the primary aggregation period in thinkscript"},"content":{"rendered":"<div class=\"codeblock\">\n<div class=\"title\">Code:<\/div>\n<div class=\"body\" dir=\"ltr\"><code>plot weeklyClose = close(\"IBM\", period = AggregationPeriod.WEEK);<\/code><\/div>\n<\/div>\n<p>This code plots weekly Close price for IBM. Interesting thing is that the IBM chart does not have to be opened to plot the Close price: it will be plotted on chart of any symbol you specified in chart settings. There is, however, a restriction in terms of time aggregation: secondary aggregation period cannot be less than the primary aggregation period defined by chart settings:<\/p>\n<div class=\"codeblock\">\n<div class=\"title\">Code:<\/div>\n<div class=\"body\" dir=\"ltr\"><code>plot yesterdayHigh = High(period = AggregationPeriod.DAY)[1];<\/code><\/div>\n<\/div>\n<p>Designed to plot the High price reached on the previous day, this script will not work on weekly charts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Code: plot weeklyClose = close(&#8220;IBM&#8221;, period = Aggregat [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[71],"tags":[177],"class_list":["post-496","post","type-post","status-publish","format-standard","hentry","category-thinkorswim","tag-thinkscript"],"_links":{"self":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/496","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=496"}],"version-history":[{"count":1,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/496\/revisions"}],"predecessor-version":[{"id":497,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/496\/revisions\/497"}],"wp:attachment":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media?parent=496"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/categories?post=496"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/tags?post=496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}