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

Data series access

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

    Data series access

    I want my indicator to stop calculating when it reaches the highest bar in the final N periods of the chart (i.e. from Count-N onward).

    Is there a way that I can find out what that bar would be when CurrentBar == 0? IOW: can I access the entire data array at that time?

    I realize I can go to the final bar (Count - 1 or 2) and then retrospectivley clean up. It would be easier to generate the correct values to begin with, though.

    --EV

    #2
    Hello EV,

    Thank you for your post.

    Unfortunately, you would not be able to access the entire data at CurrentBar == 0. Calculations will be done left to right until reaching the last bar, but there is no method to pull from the entire set of data until the calculation from left to right is finished.

    What are you attempting to achieve here by calculating the highest bar within the last N of bars, and then prevent further calculations once that bar is reached? If we have a better idea of what you are attempting we can provide possible work arounds.

    Comment


      #3
      I have a momentum indicator I use in Market Analyzer. After reading some research, I want it to calculate momentum as of the highest bar in the final N bars, and not get lowered by a subsequent pullback, which may actually just be a buying opportunity (oversold).

      As far as I can see the only way to do it is the slightly messy one of waiting for the last bar, finding which bar was indeed the highest high, and then correcting values after that. At least in my case that could work, though a little ugly as compared to knowing ahead of time which bar is the peak. For one thing, doing so requires me to keep 3 extra DataSeries objects.

      --EV

      Comment


        #4
        I just realized I cannot wait for the last bar and then clean up -- the problem is that if the chart is scrolled at all I will not get the last bar, so I won't do the cleanup. That means data to the right of the high point will be wrong. I really do need a way to find the bar # for the highest high in the last N values without having to wait for the last bar to get sent to OnBarUpdate().

        --EV

        Comment


          #5
          Originally posted by ETFVoyageur View Post
          I just realized I cannot wait for the last bar and then clean up -- the problem is that if the chart is scrolled at all I will not get the last bar, so I won't do the cleanup. That means data to the right of the high point will be wrong. I really do need a way to find the bar # for the highest high in the last N values without having to wait for the last bar to get sent to OnBarUpdate().

          --EV
          I should think that would be impossible. How can you know that it is the highest bar until all subsequent bars are lower. Sounds like an attempt to peek into the future?

          Comment


            #6
            Thanks for the comment. I am not trying to peer beyond bars that already exist, but your comment did make me re-think what I am doing and I think I may have a solution now.

            Thanks,
            --EV
            Last edited by ETFVoyageur; 03-09-2014, 11:02 PM.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by bortz, 11-06-2023, 08:04 AM
            47 responses
            1,602 views
            0 likes
            Last Post aligator  
            Started by jaybedreamin, Today, 05:56 PM
            0 responses
            8 views
            0 likes
            Last Post jaybedreamin  
            Started by DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            4 views
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            12 views
            0 likes
            Last Post Javierw.ok  
            Working...
            X