Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Skip processing until current bar

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

    Skip processing until current bar

    How can I skip processing until the actual current bar on the chart?

    I need my indicator to do nothing until the chart is fully loaded and it's reached the last bar on the right side of chart (current open bar).

    The problem is, it starts processing bars as realtime as soon as the first bar in the data series loads...
    So in my indicator, I want it to only do something based on right now. But when it is initialized/loads, even if i do an early return when state is historical, it's processing bars from days ago since I have chart data series set to load 3 days... It's processing those as realtime.

    I really hope I"m explaining this properly.

    #2
    Hello iantriestrading,

    See the heading 'Ensuring a strategy has a flat position at State.Realtime' in the Start behavior article.


    You could use

    if (State != State.Realtime)
    return;

    or

    if (State != State.Realtime || (State == State.Historical && CurrentBar != Count - 2))
    return;​​
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks - that wasn't working for me. I didn't explain properly. I had do compare the bar's time against the current time (in playback connection or in live), and if it wasn't within 1 min, skip processing.

      Comment


        #4
        Hello iantriestrading,

        I'm not certain that would be necessary.

        If the State is State.Realtime, the bar processing in OnBarUpdate() is the last bar on the chart.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hey Chelsea, that's what I had assumed. However, in testing, as soon as it switched to State.Realtime, it started processing bars from days ago.
          I must have done something wrong somewhere. But at least my current solution works for me.

          Comment


            #6
            Hello iantriestrading,

            Good to hear.

            Do you have TickReplay enabled?

            That might be the cause.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Yes I have TickReplay enabled. Why woud that cause the symptom? Thanks!

              Comment


                #8
                Hello iantriestrading,

                I don't think it should, however I'm suspect I might have seen this.

                I am not currently reproducing on my end.

                Can you test a test script and provide the output saved to a text file? This would confirm the issue.
                IsRealTimeTickReplayExample_NT8.zip
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                648 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                369 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                108 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                572 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                574 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X