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 argusthome, 03-08-2026, 10:06 AM
    0 responses
    77 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    45 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    27 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    32 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    62 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X