Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    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.

        JesseNinjaTrader Customer Service

        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.
            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by frslvr, 04-11-2024, 07:26 AM
            9 responses
            123 views
            1 like
            Last Post caryc123  
            Started by rocketman7, Today, 09:41 AM
            4 responses
            16 views
            0 likes
            Last Post rocketman7  
            Started by selu72, Today, 02:01 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by WHICKED, Today, 02:02 PM
            2 responses
            18 views
            0 likes
            Last Post WHICKED
            by WHICKED
             
            Started by f.saeidi, Today, 12:14 PM
            8 responses
            21 views
            0 likes
            Last Post f.saeidi  
            Working...
            X