MRO (Function)
The MRO (Most Recent Occurrence) function returns the number of bars ago the specified expression was True. Or, if the specified expression did not occur within the last x number of bars, the function informs you of such.
Syntax
MRO(Test, Length, Instance)
Returns (Integer)
A numeric value containing the number of bars ago that the specified Expression was True; -1 if Expression was not found to be True within the last Length bars.
Parameters
Name |
Type |
Description |
Test |
TrueFalse |
Sets the true/false expression to check for (that is, Close > Open). |
Length |
Numeric |
Sets the number of bars to check. |
Instance |
Numeric |
Sets which occurrence, for example, 1 = most recent, 2 = 2nd most recent, and so on. |
Remarks
The MRO function is specifically designed to identify when a certain condition occurred. It checks from the current bar and works away from it.
The function returns a number representing how many bars ago the true/false expression was fulfilled (0 = current bar, 1 = one bar ago, 2 = 2 bars ago …). If the function does not find a bar within the specified Length, which meets the criteria, it will return a -1.
When using the MRO function in an analysis technique, always check the result of the MRO function before using the value in another calculation or function. If Test is not true within Length number of bars, a -1 value will be returned.
Example
Value1 = MRO(Close>Open, 5, 1);