Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsInProgress == 0 does execute in live, 1 does

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

    BarsInProgress == 0 does execute in live, 1 does

    In my strategy analyzer, i'm able to separate actions across barsinprogress 0 (5min) and 1 (1min). When I run the strategy live, this doesn't work. In fact, BarsInProgress == 0 seems to not execute at all. This attachments contains my onbarupdate code, it's not usable as standalone but this section should execute every 5 min but it doesnt

    Code:
      if(BarsInProgress == 0)
                {
                DebugPrint(debugSection.OnBarUpdate,"OnBarUpdate getSignalPackage 1");
                thisSignalPackage = getSignalPackage();
                }
                ​​
    stranger yet, index 0 seems to not exist?
    Attached Files

    #2
    note: This is using Rithmic for live and NT historical data

    Comment


      #3
      Hello Skifree,

      Try the adding the following to the very top of OnBarUpdate() (as the first line), exactly as shown here with no modifications.

      Code:
      Print(string.Format("{0} | BarsInProgress: {1}, State: {2}, {3} {4} {5}  -- BIP 0: {6} {7} {8}", Time[0], BarsInProgress, State, Instrument.FullName, BarsArray[BarsInProgress].BarsPeriod.Value, BarsArray[BarsInProgress].BarsPeriod.BarsPeriodType, Instruments[0].FullName, BarsArray[0].BarsPeriod.Value, BarsArray[0].BarsPeriod.BarsPeriodType));
      Temporarily comment out all other comments.

      Reload the script, save the output from the output window to a text file (right-click the output window > select Save as), and attach the text file to your reply.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        I had to trim a few days to meet the file size req, but it looks like both bars are here?
        Attached Files

        Comment


          #5
          Hello Skifree,

          The output is showing BarsInProgress 0 is definitely updating OnBarUpdate() every 5 minutes.

          4/18/2024 8:45:00 PM | BarsInProgress: 0, State: Historical, MGC JUN24 5 Minute -- BIP 0: MGC JUN24 5 Minute
          4/18/2024 8:50:00 PM | BarsInProgress: 0, State: Historical, MGC JUN24 5 Minute -- BIP 0: MGC JUN24 5 Minute

          Now that this is confirmed, and we know the script is processing the data, you can comment out this print and focus on the conditions of your logic.
          Start at the first condition you don't think BarsInProgress 0 is making it past. Print the time of the bar and all values used in the condition.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Ok, I figured this out - There was an original filter to skip some bars that wasn't working with multi-time series, and at the same time there was not enough bars to continue the entire loading of the strategy. Thank you for the help - that's a useful output to have on hand.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            47 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            23 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            33 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            50 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            42 views
            0 likes
            Last Post CarlTrading  
            Working...
            X