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 CarlTrading, Yesterday, 09:41 PM
    1 response
    21 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, Today, 02:41 AM
    0 responses
    8 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, Yesterday, 11:44 PM
    0 responses
    20 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    36 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    34 views
    0 likes
    Last Post CarlTrading  
    Working...
    X