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

Multiple DataSeries Issue

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

    #16
    I see that now, I was just trying anything to see if it would work.

    Comment


      #17
      Having a similar issue. It would be nice to hear from NT support on this.

      Comment


        #18
        Hello,

        I am unsure of the overall goal here, OnBarUpdate should occur once bars are loaded or after State.DataLoaded. This would occur in OnStateChange, and then your per bar logic would go in OnBarUpdate. What specifically are you running into where you need to wait until bars are loaded in OnBarUpdate?

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #19
          The overall goal is to know when OnUpdateBar has executed for all dataseries. This would be the most practical and efficient way when building a dashboard. Otherwise, we would be building the dashboard after every execution of OnBarUpdate. What is the most efficient way to determine this?

          Thanks in advance!!

          Comment


            #20
            Hello,

            There is no definite end for OnBarUpdate, each series would call this override for each historical bar in the requested series along with new bars that are built for incoming data. What is the specific goal, are you trying to do a calculation only one time per script being enabled or do something only once you are in realtime?

            You can use State.DataLoaded to know all data is loaded, this occurs before bars start processing. You can wait till State.Realtime if historical data should be omitted and only calculated once all bars have been processed.

            I could suggest adding a Print into OnStateChange and also one in OnBarUpdate, you could then run the script and view the output. This would tell you when each state is run and when each bar is processed to give you a better idea where your logic may need to go.


            I look forward to being of further assistance.
            JesseNinjaTrader Customer Service

            Comment


              #21
              Thanks. I actually already solved it. But the goal is to make sure all of the dataseries had loaded so that my indicator could recommend trading decisions.I actually think that would be a nice enhancement as many strategies call for the use of multiple dataseries.

              Thanks!!

              Comment


                #22
                Hello,

                It may be helpful to provide the solution you found for other users, as I am still not clear on what the problem was in relation to what you were trying, this may help seal this thread.

                Please let me know if I may be of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #23
                  I'll try to explain again. Let's say you use the Daily, H4 and H2 bars to make a trading decision on 10 different pars and you want to evaluate this data after every bar close for all 30 of the dataseries after they have been updated. How would you do it?

                  Comment


                    #24
                    Hello,

                    If you are wanting to check that all series have at least A bar processed or have enough data to begin processing logic, you would use the CurrentBar:

                    Code:
                    if(CurrentBars[0] < 1 || CurrentBars[1] < 1 || CurrentBars[2] < 1) return;
                    This would check 3 series, you could expand this by adding any number of conditions after for each series:

                    Code:
                    || CurrentBars[BarsInProgressIndex] < MinimumBarsNeeded
                    The return would prevent any logic after this statement from happening unless the condition was false. The above statement would just make sure all the series in the condition have at least 1 bar.

                    This would only ensure that bars are available for each series, if you wanted to then execute logic after this point but be specific on which series executes that logic, you would use BarsInProgress

                    Code:
                    if(CurrentBars[0] < 1 || CurrentBars[1] < 1 || CurrentBars[2] < 1) return; // return until each series has X bars available 
                    if(BarsInProgress == 0)
                    {
                        // do logic on primary series only after all bars have X bars processed. 
                    }

                    Is this what you were questioning?

                    I look forward to being of further assistance.
                    JesseNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by bmartz, 03-12-2024, 06:12 AM
                    4 responses
                    31 views
                    0 likes
                    Last Post bmartz
                    by bmartz
                     
                    Started by Aviram Y, Today, 05:29 AM
                    4 responses
                    11 views
                    0 likes
                    Last Post Aviram Y  
                    Started by algospoke, 04-17-2024, 06:40 PM
                    3 responses
                    28 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by gentlebenthebear, Today, 01:30 AM
                    1 response
                    8 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Started by cls71, Today, 04:45 AM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Working...
                    X