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 Taddypole, 04-26-2024, 02:47 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Eduardo  
    Started by futtrader, 04-21-2024, 01:50 AM
    6 responses
    58 views
    0 likes
    Last Post futtrader  
    Started by sgordet, Today, 11:48 AM
    0 responses
    4 views
    0 likes
    Last Post sgordet
    by sgordet
     
    Started by Trader146, Today, 11:41 AM
    0 responses
    5 views
    0 likes
    Last Post Trader146  
    Started by jpapa, 04-23-2024, 07:22 AM
    2 responses
    19 views
    0 likes
    Last Post rene69851  
    Working...
    X