 |
|
|
|
|
|
|
 |
|
|
|
|
|
|
 |
|
Most Recent Occurrence
Last Post 12-07-2009 12:48 PM by Dale Holmes. 4 Replies.
|
Sort:
|
|
Prev Next |
You are not authorized to post a reply. |
|
Dale Holmes
 New Member Posts:6
 |
| 12-03-2009 03:47 PM |
|
Currently, TradersStudio offers a MRO function that identifies if a "value" has occurred in the past. Does TradersStudio offer a function to identify when a "condition" has occurred?
For example, if I wanted to identify the occurrence of a Doji in the recent past, I might be inclined to write:
If MRO(Abs(Close - Open)/(High - Low) < .08, 5, 1) <> -1 Then . . .
If there is no such function, could you suggest an approach to test for a condition and identify the number of bars back it occurred?
Thank you.
|
|
|
|
|
mur ang
 Advanced Member Posts:525
 |
| 12-03-2009 05:42 PM |
|
Most Recent Occurrence (MRO) -- Function
The MRO function finds the most recent occurence of
a value on the previous bar.
MostRecent = MRO(Val,
Length[, Occur]) |
Syntax
Val Value on
the current bar; function finds same values on the previous
bars.
Length Number of bars back to look for the same
value.
Occur Number of occurence. 1 to find most recent
one, 2 to find second occurence, etc.
Remarks
- The MRO function returns number of bars back it
received same Val. If Val was not passed within last
Length bars, then it returns -1.
- Occur argument is optional. If you don't pass it,
then MRO function finds first occurence (assumes Occur = 1).
- The following sample finds bars with the same
price:
Sub test_MRO() Dim MostRecentOccur As Integer
MostRecentOccur = MRO(Close, 10) If
MostRecentOccur <> -1 Then Print Close, " ", MostRecentOccur, " bars ago" Else Print Close, " ", "never" End If End Sub
| |
|
|
|
|
Dale Holmes
 New Member Posts:6
 |
| 12-04-2009 12:56 PM |
|
Thank you for your reply.
However, this did not answer my question. I had read the page description for the MRO function which you entered in your reply. This DOES discuss the fact that MRO looks for prior "values" having occurred.
That prompted my original question which was whether TradersStudio had an MRO-like function which could find a past occurrence of an event (such as a mathematical condition, an example of which I gave).
I asked the question because such a event or condition based MRO function is available in Trade Station, I have used it, and it would be great if I could find it in TradersStudio!
Thank you.
|
|
|
|
|
mur ang
 Advanced Member Posts:525
 |
| 12-04-2009 01:18 PM |
|
I am not 100% sure if I am now answering your question but The last argument is optional, so MRO(Close>Open, 10,1)
returns the most recent occurence
and
MRO(Close>Open,50,2)
returns the bar when it happen on the one before the most recent.
|
|
|
|
|
Dale Holmes
 New Member Posts:6
 |
| 12-07-2009 12:48 PM |
|
That answers my question nicely. MRO can be used to identify a prior value as well as a conditional event or occurrence using a logic statement.
Thank you.
|
|
|
|
|
| You are not authorized to post a reply. |
|
|
|
 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| TradersStudio, Inc. ® Copyright 2004-2012 All Rights Reserved
Terms Of Use
Privacy Statement
|