Right. And I am using a couple of them... but I need something that basically tells me how many bars it has been since a condition was true. Any condition.

For example:Condition = Close <= 5

bars.since(Condition) = how many bars since Close crossed above 5

Does this clarify my initial question? In other words, take any condition that would evaluate true or false (such as those used in an "if" statement), and tell me how many bars it has been since it evaluated true.

What's the easiest way to find out if the last trade made in your strategy was long or short? I have a different trailing stop level I used based on whether it is long or short, so once I have a position open, I'll adjust the stop each bar, but the distance I'm trailing is dependent on short/long.

Thanks for the code snippet. Still adjusting my code from NinjaTrader over to RightEdge and sorting out the differences. They have an MRO function (Most Recent Occurrence)... that's where I hit the wall.

What's the easiest way to find out if the last trade made in your strategy was long or short? I have a different trailing stop level I used based on whether it is long or short, so once I have a position open, I'll adjust the stop each bar, but the distance I'm trailing is dependent on short/long.

We'll put that on the feature list. We're always very interested in making life a little easier with our class library.

jthorne (8/13/2007)Yeah, it is super handy.

Thanks for the code snippet. Still adjusting my code from NinjaTrader over to RightEdge and sorting out the differences. They have an MRO function (Most Recent Occurrence)... that's where I hit the wall.

It looks like you should have "List<Position> openPositions = ...", though.

Additionally, this looks suspect: "openPositions.PositionType". You need to access a specific index into this collection. openPosistions[0].PositionType would be the first element in the list. Without knowing your itentions, though, it's hard to say what you should have there.