{"id":500,"date":"2017-02-22T02:49:19","date_gmt":"2017-02-22T02:49:19","guid":{"rendered":"http:\/\/www.patternsmart.com\/cn\/?p=500"},"modified":"2017-02-22T02:49:19","modified_gmt":"2017-02-22T02:49:19","slug":"the-parameter-barsago-may-not-work-in-some-function-in-ninjatrader-ninjascript","status":"publish","type":"post","link":"https:\/\/www.patternsmart.com\/cn\/the-parameter-barsago-may-not-work-in-some-function-in-ninjatrader-ninjascript\/","title":{"rendered":"The parameter barsAgo may not work in some function in Ninjatrader Ninjascript"},"content":{"rendered":"<p>For example:<br \/>\nDrawText(string tag, string text, int barsAgo, double y, Color color)<\/p>\n<p>protected\u00a0override\u00a0void\u00a0OnBarUpdate()<\/p>\n<p>{<\/p>\n<div>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0DrawText(&#8220;tag1&#8221;, &#8220;Text to draw&#8221;, 10, 1000, Color.Black);<\/div>\n<p>}<\/p>\n<p>The code above will get nothing to show, unless we check first.<\/p>\n<p>protected\u00a0override\u00a0void\u00a0OnBarUpdate()<\/p>\n<div>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {<\/div>\n<p>if(CurrentBar &lt;=\u00a010)\u00a0return\u00a0;<br \/>\nDrawText(&#8220;tag1&#8221;, &#8220;Text to draw&#8221;, 10, 1000, Color.Black);<br \/>\n}<\/p>\n<p>The code above is correct.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For example: DrawText(string tag, string text, int bars [&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":[89],"tags":[174,68],"class_list":["post-500","post","type-post","status-publish","format-standard","hentry","category-ninjatrader","tag-ninjascript","tag-ninjatrader"],"_links":{"self":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/500","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=500"}],"version-history":[{"count":1,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/500\/revisions"}],"predecessor-version":[{"id":501,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/posts\/500\/revisions\/501"}],"wp:attachment":[{"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/media?parent=500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/categories?post=500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.patternsmart.com\/cn\/wp-json\/wp\/v2\/tags?post=500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}