| 
 PureBytes Links 
Trading Reference Links 
 | 
> Is there a function that says any of the last x bars? Meaning, I`m
> trying to get my system to recognize that the rsi of any of the
> last x bars was under 30. 
The MRO function (Most Recent Occurence) is useful for applications 
like this.  For your specific example, you could use something like 
this:
if MRO(RSI(Price, Len) < 30, X, 1) >= 0 then begin
  { RSI was less than 30 in the last X bars }
  end;
MRO looks to see when the condition in its first argument (RSI<30 in 
this case) was true in the last X bars.  The third argument (1) says 
you're looking for the first occurence.  If it occurs in the last X 
bars, MRO returns an offset to the bar.  If not, it returns -1.  So 
if RSI<30 happened anytime in the last X bars, MRO will return a 
value > -1.
If you pass a larger number in the 3rd parameter, you can require 
that the condition has to happen more than once.  E.g. if you passed 
4 in the 3rd parameter, the test would be true only if RSI<30 on FOUR 
bars (not necessarily consecutive) out of the last X bars.
Try charting the value of MRO and you'll see how it works.
Gary
 |