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 Mindset, 04-21-2026, 06:46 AM
                0 responses
                64 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by M4ndoo, 04-20-2026, 05:21 PM
                0 responses
                94 views
                0 likes
                Last Post M4ndoo
                by M4ndoo
                 
                Started by M4ndoo, 04-19-2026, 05:54 PM
                0 responses
                51 views
                0 likes
                Last Post M4ndoo
                by M4ndoo
                 
                Started by cmoran13, 04-16-2026, 01:02 PM
                0 responses
                108 views
                0 likes
                Last Post cmoran13  
                Started by PaulMohn, 04-10-2026, 11:11 AM
                0 responses
                63 views
                0 likes
                Last Post PaulMohn  
                Working...
                X