Most Recent Occurrence (MRO) returns the numbers of bars back that the condition was true.

 

If the condition was not true during search back of the previous bars, the function will return a value = -1 = (FALSE).

 

Syntax:

MRO( conditionseries, bars, instance )

 

Parameter:

Description:

conditionseries

Name of the condition series.

 

The Condition series should use 1 for TRUE, and 0 for FALSE.

bars

The number of bars over which to find the instance of the condition.

instance

Which occurrence the condition to search for; for example, 1 = most recent, 2 = 2nd most recent.

 

Returns:

The number of bars ago that the condition was true or -1 if not found.

 

Example:

'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'  Update Indicators Script
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'  HighPivot = IPV Series - Auto-Index - Default = False
'  PlotHighPivot = IPV Series - Auto-Index - Default = Zero
'                  Plot Dot on Pivot High
'  Bar_Count = 21
'  Instance = 1 = Most Recent
 
'  Test for a simple High Pivot Bar Pattern
If instrument.high[2] < instrument.high[1] AND
  instrument.high[1] > instrument.high[0] THEN
  '  Assign this element a True State
  HighPivot = TRUE
ENDIF  
 
'  Show High Pivot Locations
If MRO( HighPivot, Bar_Count, 1 ) = 1 THEN
  '  Plot Dot over Pivot High
  PlotHighPivot[2] = instrument.high[2] + (instrument.minimumTick * 4)
Else
  PlotHighPivot = Undefined
ENDIF  
 
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Chart Display:

Click to Enlarge; Click to Reduce.

Most Recent Indicator where a condtion was True

 

Links:

 

 

See Also:

 

 


Edit Time: 9/26/2020 1:26:46 PM


Topic ID#: 430

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software