Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IsFirstTickOfBar - Once and for all

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

    IsFirstTickOfBar - Once and for all

    Hello,

    I'm currently fiddling around with an indicator that calculates on each tick and has an additional 1 Tick Series added.

    The idea of the indicator is to collect all the 1 tick data and add them to a data object for each bar of the main series.

    In OnBarUpdate() I try to catch the first tick of a new bar of the main series.
    This seems to work as long as the indicator is in a historical state and once the indicator has gone from historical state to realtime.

    But IsFirstTickOfBar also fires on the actual transition between historical and realtime state when there is in fact no new bar created.
    Is there a recommended way to deal with this behavior?

    Thank you,
    Mike


    #2
    Hello, thanks for writing in. For the primary series tick updates, you would need to enable Tick Replay from the data series menu (after enabling "Show Market Replay" from Tools>Options>Market Data).

    Comment


      #3
      Hey Chris,

      thank you for your reply.
      I don't want to use Tick-Replay for this indicator. It would be much faster by using an additional 1 Tick Series.

      Thank you,
      Mike

      Comment


        #4
        Hi, Sorry for the oversight. The script will need to keep track of the active bar in the 1 tick series. I have an example of how to do this here:

        Hi, I'm currently working on a strategy that is utilizing OnTickChange data using the linked method. I am using a Tick Chart. The strategy uses onTickChange to make intrabar entry, and does so fine with the Set1 and Set2, but if/when profit target is hit, it will submit another order after the profit target if the


        You can also see this done in the "BuySellVolume" indicator.

        Comment


          #5
          Thank you for your answer but the CurrentBar also seems to change when the state transitions from historical to realtime. even when i use CurrentBars[0].

          Mike

          Comment


            #6
            What is your Calculate setting?

            Do you have a small script that illustrates what you're seeing?

            Comment


              #7
              Hello bltdavid, Hello NinjaTrader_ChrisL,

              thank you for your answer.
              The Calcuclate Method is OnEachTick as mentioned above.

              The actual question can be broken down to: "why does IsFirstTickOfBar fire on the transition between Historical and Realtime Ticks processed in OnBarUpdate while the bar is still developing? And why does CurrentBar increase by 1. at the same point when in fact there isn't a new bar?"

              I've attached you a file which adds volume to a custom series.
              If you attach it along side with the NT8 VOL indicator (on each tick) to a 5 minute chart, you can see that it's displaced by 1 bar because NT8 goes through the whole "new bar" routine when the state changes from historical to realtime.

              Thank you,
              Mike
              Attached Files
              Last edited by mk77ch; 06-15-2023, 08:34 AM.

              Comment

              Latest Posts

              Collapse

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