Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 dward123, 01-02-2024, 09:59 PM
            3 responses
            159 views
            0 likes
            Last Post bjunaid
            by bjunaid
             
            Started by ETFVoyageur, Today, 04:00 PM
            1 response
            7 views
            0 likes
            Last Post ETFVoyageur  
            Started by AaronKTradingForum, Today, 03:44 PM
            1 response
            8 views
            0 likes
            Last Post AaronKTradingForum  
            Started by Felix Reichert, 04-26-2024, 02:12 PM
            11 responses
            77 views
            0 likes
            Last Post Felix Reichert  
            Started by junkone, 04-28-2024, 02:19 PM
            7 responses
            83 views
            1 like
            Last Post junkone
            by junkone
             
            Working...
            X