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 NullPointStrategies, Today, 05:17 AM
            0 responses
            52 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            130 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            70 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            44 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            49 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X