Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MRO conflict?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    MRO conflict?

    Deleting "+50" works, otherwise give none results, what I'm missing here?

    Thanks in advance

    protectedoverridevoid OnBarUpdate()
    {
    int barsAgo = MRO(delegate {return Close[0] > SMA(20)[0] ;}, 1, 9);
    if (Close[0] > Close[barsAgo])
    EnterLong(
    100000, "Long");


    double Variable = Math.Abs(Close[BarsSinceEntry()+50]-MAX(High,49)[BarsSinceEntry()]);

    if(SMA(10)[0] > Variable)
    ExitLong(
    "Exit","Long");
    }

    #2
    Hello fercho,

    If you check log tab of control center, you'll likely see index out of range or object reference errors.This item is described here:


    If you try to access this value in the first 0-50 bars you will get an error, as it's not available.

    To resolve you could add the following to your strategy so that it returns out before the first entry, first 51 bars, or before the first occurrence of your test condition in MRO. You index using all three of the values below.

    if (BarsSinceEntry() < 0 || CurrentBar < 50 || barsAgo < 0 ) return;
    Last edited by NinjaTrader_RyanM1; 10-10-2011, 02:14 PM.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by alifarahani, Today, 09:40 AM
    6 responses
    36 views
    0 likes
    Last Post alifarahani  
    Started by Waxavi, Today, 02:10 AM
    1 response
    17 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by Kaledus, Today, 01:29 PM
    5 responses
    14 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Waxavi, Today, 02:00 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by gentlebenthebear, Today, 01:30 AM
    3 responses
    17 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X