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 mintos, 04-02-2024, 08:22 PM
            9 responses
            42 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by cmtjoancolmenero, Yesterday, 02:31 PM
            7 responses
            22 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by hdge4u, 04-29-2024, 12:23 PM
            3 responses
            19 views
            0 likes
            Last Post MisterTee  
            Started by PaulMohn, 04-24-2024, 03:49 AM
            5 responses
            39 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by claxxical, 05-30-2017, 12:30 PM
            38 responses
            4,482 views
            0 likes
            Last Post alancurry  
            Working...
            X