|
Most Recent Occurrence Function
Hi, is there any MT search function returns like the MRO (Most Recent Occurrence) function in the EasyLanguage TradeStation?
I want the function to return when i search, for example the indicator RSI is > 70. And it is the most recent result within the number of trailing bars to serach.
If there isn't any MRO MT function, could anyone help to convert the function in the EasyLanguage TradeStation to MT4?
// Description: Most Recent Occurrence
Inputs: Expression(TrueFalseSeries), Length(NumericSimple), Occur(NumericSimple);
Variables: TrueCount(0), Counter(0);
Counter = 0;
TrueCount = 0;
While Counter < Length AND TrueCount < Occur Begin
If Expression[Counter] Then
TrueCount = TrueCount + 1;
Counter = Counter + 1;
End;
If TrueCount >= Occur AND TrueCount > 0 Then
MRO = Counter - 1 + CurrentBar - BarNumber
Else
MRO = -1;
// End
Appreciate anyone can help me..thanks.
Fonz
|