Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsInProgress - Question

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

    BarsInProgress - Question

    I have this at the very beginning of OnBarUpdate(). It's a strategy.

    if (BarsInProgress != 0)
    {
    return;
    }

    //Only process if bar being updated is our 1st bar.
    if (BarsInProgress == 1)
    {
    Print("This should not be seen");
    }


    ------------------
    How come I can see the print statement above? I thought my first if() was going to return if true?

    What am I missing ??

    [UPDATE]
    Something was flaky. I just shutdown Ninja, re-opened, and it seems to be processing correctly. Weird.


    Thank you,


    r2kTrader
    Last edited by r2kTrader; 02-28-2009, 06:19 PM.

    #2
    Have you read this?



    OnBarUpdate is called for each indicator you have added to a strategy.

    Try this...

    // Process if OnBarUpdate is called for one indicator.
    if (BarsInProgress == 0)
    {
    Print("BarsInProgress == 0");
    }

    // Process if OnBarUpdate is called for another indicator.
    if (BarsInProgress == 1)
    {
    Print("BarsInProgress == 1");
    }

    Comment


      #3
      Originally posted by mgbloomfield View Post
      Have you read this?



      OnBarUpdate is called for each indicator you have added to a strategy.

      Try this...

      // Process if OnBarUpdate is called for one indicator.
      if (BarsInProgress == 0)
      {
      Print("BarsInProgress == 0");
      }

      // Process if OnBarUpdate is called for another indicator.
      if (BarsInProgress == 1)
      {
      Print("BarsInProgress == 1");
      }
      Ok, now I am completely confused. And I am still having issues.

      Yes, I read that post you gave me like 20 times. It's slowly seeping in. A lot to digest.

      So onBarUpdate() is called as per the indicator in the strategy and not as per the added instruments? So if I have additional instruments on different time frames, I don't get an OnBarUpdate for each added time/instrument?

      It would be nice if there was some visuals for a lot of the NT concepts. It's very difficult to wrap one's mind around some of the concepts. For example, when do you need to sync a DataSeries and when not? Confusing. I am sure it will all come to me sooner or later, but grasping this is a bear at the moment.

      By the way, thank you for helping. I am going to re-read the BarInProgress thread again.

      Comment


        #4
        Originally posted by r2kTrader View Post
        So onBarUpdate() is called as per the indicator in the strategy and not as per the added instruments? So if I have additional instruments on different time frames, I don't get an OnBarUpdate for each added time/instrument?
        Let me rephrase what I said... I misquoted...

        Instead of saying, "OnBarUpdate is called for each indicator you have added to a strategy", I should've said, "OnBarUpdate is called for each instrument you have added to a strategy".

        Another helpful article is... http://www.ninjatrader-support.com/H...ameInstruments

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X