PDA

View Full Version : MRO not working


nybangali
08-17-2007, 01:11 AM
Trying to get an MRO function to work.
My logic is complicated and was not firing.. so tried the basic example from the help site. That didn't work as well.

Here is the section of the code.. only writes to Output window, no buy/sell signals:
protected override void OnBarUpdate()
{
int barsAgo = MRO(delegate {return Close[0] > Open[0];}, 100, 1);
if (barsAgo > -1)
Print("The Value of the Pivot was " + High[barsAgo]);
Print(Time[0].ToString() + " : New Bar. barsAgo value is: " + barsAgo.ToString());

}
This was run on e-mini S&P over a 1 min & 5 min period with same results

Output window shows:
08/01/07 11:30:00 AM : New Bar. barsAgo value is: -1
08/01/07 11:40:00 AM : New Bar. barsAgo value is: -1
08/01/07 11:50:00 AM : New Bar. barsAgo value is: -1
08/01/07 12:00:00 PM : New Bar. barsAgo value is: -1
08/01/07 12:10:00 PM : New Bar. barsAgo value is: -1
08/01/07 12:20:00 PM : New Bar. barsAgo value is: -1
08/01/07 12:30:00 PM : New Bar. barsAgo value is: -1
08/01/07 12:40:00 PM : New Bar. barsAgo value is: -1
08/01/07 12:50:00 PM : New Bar. barsAgo value is: -1 etc etc

NinjaTrader_Dierk
08-17-2007, 01:18 AM
Sorry, the doc sample is incorrect. We'll fix shortly. Please swap parameter 2 and 3:

MRO(delegate {return Close[0] > Open[0];}, 1, 100);

nybangali
08-17-2007, 09:17 AM
Works like a charm. Thanks.

Will I get a discount for finding "bugs" in the Help file when I sign up ? :)
I'm moving over an awful lot of code over from Metastock!

Sorry, the doc sample is incorrect. We'll fix shortly. Please swap parameter 2 and 3:

MRO(delegate {return Close[0] > Open[0];}, 1, 100);

NinjaTrader_Dierk
08-17-2007, 09:20 AM
You will get a discount as you bring in tons of new licensed users :D
Seriously: Please contact "sales AT ninjatrader DOT com" if you feel yourself entitled for a discount.