Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NTb7 FirstTickOfBar

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

    #16
    Originally posted by NinjaTrader_Josh View Post
    Workaround = check CurrentBar # and the first time it changes, have your own bool that switches to false.
    Josh: Thanks ...

    In fact, much earlier I used to check for CurrentBar to change, and then do my "first tick of bar" code and re-save the current value of CurrentBar, etc. (before I found that Ninja had a built-in FirstTickOfBar function.)

    So, of course that would work.

    I was just hoping I wouldn't have to go de-simplify my indicators that use this.

    Oh, well.

    Comment


      #17
      Unfortunately that would be the way to proceed as this is currently a bug. Sorry for the inconvenience.
      Josh P.NinjaTrader Customer Service

      Comment


        #18
        Hello,

        Has this bug been fixed in the new beta8 ?

        Thanks

        Comment


          #19
          Yes, indeed.

          Comment


            #20
            Hello,

            Do I do something wrong or this bug is not fixed in NT7 beta14.

            I aded 3 data series (M1(last, primary), Tick(Ask), Tick(Bid).
            I use this code:

            protectedoverridevoid OnBarUpdate()
            {


            if (BarsInProgress ==0 && FirstTickOfBar) {
            Print(
            "New bar "+CurrentBar);
            }

            This code prints the same bar number everytime a new tick(bid) comes in.

            Thank you for your efforts

            Povilas

            Comment


              #21
              The code snippet below works for a MultiSeries strategy for me here, please ensure you call FirstTickOfBar in proper context -

              Code:
                protected override void OnBarUpdate()
                      {
              			if (Historical)
              				return;
              			
              			if (BarsInProgress == 0)
              				if (FirstTickOfBar)
              					Print("BIP0");
              			
              			if (BarsInProgress == 1)
              				if (FirstTickOfBar)
              					Print("BIP1");
                      }

              Comment


                #22
                I'm sorry, but the code below in indicator does not work.

                here is my code:
                protectedoverridevoid Initialize()
                {
                Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Tr0"));
                Overlay = false;
                CalculateOnBarClose = false;
                Add(Instrument.FullName, PeriodType.Tick, 1,MarketDataType.Ask);
                Add(Instrument.FullName, PeriodType.Tick, 1,MarketDataType.Bid);
                }
                protectedoverridevoid OnBarUpdate()
                {
                if (Historical)
                return;

                if (BarsInProgress == 0)
                if (FirstTickOfBar)
                Print("BIP0");

                }

                Do you see any issues in the code?

                Thanks,
                Povilas

                Comment


                  #23
                  Povilas,

                  Let us take a step back and first check if you actually had historical bid/ask data. What data provider are you using? Do you see such a historical series to exist in your Historical Data Manager's Edit tab?
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #24
                    Hello, Josh,

                    We are using MBT data feed. Yes, we do have few days of data in ask/bid/last historical data.

                    But same thing is happening while running on historical and realtime data feed.

                    Povilas

                    Comment


                      #25
                      I just double checked and let me correct my statment. This problem exists only on real time data feed. Using historical data the code works as expected.

                      MBT API version is 11.5.0.5

                      Regards, Povilas

                      Comment


                        #26
                        This is a bug related to multiple data series connected to indicator.

                        FirstTickOfBar works without a problem If I remove both dataseries from indicator.

                        Comment


                          #27
                          Thanks, I was able to reproduce here, we'll check into.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          596 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          343 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          103 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          556 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          554 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X