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 AaronKoRn, Today, 09:49 PM
    0 responses
    1 view
    0 likes
    Last Post AaronKoRn  
    Started by carnitron, Today, 08:42 PM
    0 responses
    6 views
    0 likes
    Last Post carnitron  
    Started by strategist007, Today, 07:51 PM
    0 responses
    8 views
    0 likes
    Last Post strategist007  
    Started by StockTrader88, 03-06-2021, 08:58 AM
    44 responses
    3,975 views
    3 likes
    Last Post jhudas88  
    Started by rbeckmann05, Today, 06:48 PM
    0 responses
    9 views
    0 likes
    Last Post rbeckmann05  
    Working...
    X