Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to make sure indicator is calculated until last (existing) bar

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

    How to make sure indicator is calculated until last (existing) bar

    I would like to create a list until last bar. What is the best way I should do it in a indicator?

    Should I create a list in "OnBarUpdate()" or on region "Miscellaneous"?

    Please help. thanks

    #2
    Hello LadGta2018,

    When you say a list until last bar, do you mean a series of data that gets updates similar to the Close series?

    Your title implies that you want to call update on the indicator to make sure its updated, can you provide a little more detail about what you want to do or if you are seeing a problem what problem you are having?


    I look forward to being of further assistance.

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello LadGta2018,

      When you say a list until last bar, do you mean a series of data that gets updates similar to the Close series?

      Your title implies that you want to call update on the indicator to make sure its updated, can you provide a little more detail about what you want to do or if you are seeing a problem what problem you are having?


      I look forward to being of further assistance.
      Thanks for your quick response.

      What I would like to do is: When the last bar is closed, the indicator will create a list (points).

      If I put it in "OnBarUpdate()", it will be check every time when the bar got updated. Is there any section in NT indicator, the code got executed when the last bar is closed? what is the best way I should do?

      Thanks

      Comment


        #4
        Hello LadGta2018,

        OnBarUpdate would be what is called for the bar close events, I am not certain I understand the question as it is worded. Are you asking to do something once per bar, not necessarily once per OnBarUpdate assuming you were using OnEachTick calculation.

        I look forward to being of further assistance.

        Comment


          #5
          Originally posted by NinjaTrader_Jesse View Post
          Hello LadGta2018,

          OnBarUpdate would be what is called for the bar close events, I am not certain I understand the question as it is worded. Are you asking to do something once per bar, not necessarily once per OnBarUpdate assuming you were using OnEachTick calculation.

          I look forward to being of further assistance.
          Thanks for response.

          No, I am not do something once per bar. I only want to do it once when the last bar is closed.

          for example, there are 100 bars in the chart. I only want to do something when the 100th bar is closed. only do it once.

          Comment


            #6
            Hello LadGta2018,

            Thanks for the example, You can use the State for this:
            if(State == State.Realtime)

            You could do your calculation the first time the state is seen which would be after the 100th bar is closed assuming that was the last historical bar.



            Please let me know if I may be of additional assistance.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            80 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            40 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            63 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            63 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            54 views
            0 likes
            Last Post CarlTrading  
            Working...
            X