{"id":504,"date":"2017-02-22T02:52:17","date_gmt":"2017-02-22T02:52:17","guid":{"rendered":"http:\/\/patternsmart.com\/wp\/?p=504"},"modified":"2017-02-22T02:52:17","modified_gmt":"2017-02-22T02:52:17","slug":"least-recent-occurence-lro-very-useful-function-in-ninjatrader","status":"publish","type":"post","link":"https:\/\/patternsmart.com\/wp\/least-recent-occurence-lro-very-useful-function-in-ninjatrader\/","title":{"rendered":"Least Recent Occurence (LRO), very useful function in NinjaTrader"},"content":{"rendered":"<p>Definition<br \/>\nReturns the number of bars ago that the test condition evaluated to true within the specified look back period expressed in bars. It checks from the furthest bar away and works toward the current bar. This method will NOT work on multi-instrument or multi-time frame strategies.<\/p>\n<p>Method Return Value<br \/>\nAn int value representing the number of bars ago. Returns a value of -1 if the specified test condition did not evaluate to true within the look back period.<\/p>\n<p>Syntax<br \/>\nLRO(Condition condition, int instance, int lookBackPeriod)<\/p>\n<p>The syntax for condition must be written in the following manner:<\/p>\n<p>delegate { return your true\/false condition;}<\/p>\n<p>Parameters<\/p>\n<div>condition<br \/>\nA true\/false expression<br \/>\ninstance<br \/>\nThe occurrence to check for (1 is the least recent, 2 is the 2nd least recent, etc&#8230;)<br \/>\nlookBackPeriod<br \/>\nNumber of bars to look back to check for the test condition. Test is evaluated on the current bar and the bars in the look back period.<\/div>\n<p>Examples<\/p>\n<div>\/\/ Prints the high price of the least recent up bar over the last 10 bars (current bar + look back period&#8217;s 9 bars before that)<br \/>\nint barsAgo = LRO(delegate {return Close[0] &gt; Open[0];}, 1, 9);<br \/>\nif (barsAgo &gt; -1)<br \/>\nPrint(&#8220;The bar high was &#8221; + High[barsAgo]);<\/div>\n<p>See Also<br \/>\n<a href=\"http:\/\/ninjatrader.com\/support\/helpGuides\/nt7\/most_recent_occurence_mro.htm\" target=\"_blank\">Most Recent Occurence(MRO)<\/a><\/p>\n<p>Just mark it here.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Definition Returns the number of bars ago that the test condition evaluated to true within the specified look back period expressed in bars. It checks from the furthest bar away and works toward the current bar. This method will NOT work on multi-instrument or multi-time frame strategies. Method Return Value An int value representing the [&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":[],"class_list":["post-504","post","type-post","status-publish","format-standard","hentry","category-ninjatrader"],"_links":{"self":[{"href":"https:\/\/patternsmart.com\/wp\/wp-json\/wp\/v2\/posts\/504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/patternsmart.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/patternsmart.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/patternsmart.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/patternsmart.com\/wp\/wp-json\/wp\/v2\/comments?post=504"}],"version-history":[{"count":1,"href":"https:\/\/patternsmart.com\/wp\/wp-json\/wp\/v2\/posts\/504\/revisions"}],"predecessor-version":[{"id":505,"href":"https:\/\/patternsmart.com\/wp\/wp-json\/wp\/v2\/posts\/504\/revisions\/505"}],"wp:attachment":[{"href":"https:\/\/patternsmart.com\/wp\/wp-json\/wp\/v2\/media?parent=504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/patternsmart.com\/wp\/wp-json\/wp\/v2\/categories?post=504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/patternsmart.com\/wp\/wp-json\/wp\/v2\/tags?post=504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}