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

Unable to add secondary tick series to indicator

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

    Unable to add secondary tick series to indicator

    Hello all,

    I am unable to add a tick series to my custom indicator via the AddDataSeries method. When I attempt this, and reload ninjascript on my chart (running Calculate.OnBarClose or OnEachTick, it doesn't matter), all I see is "(Calculating...)" on the top left of my chart, and it never completes.

    Some auxiliary information:
    I have other multi-time frame indicators that use the AddDataSeries method, however none that use a tick series.
    They function properly.

    I am unable to use anything that may be comparable functionally, i.e. the same thing happens when I try range(1) or second(1), etc...

    I updated recently to the newest version of ninjatrader thinking that the issue may be solved, but to no avail.

    Any ideas? Thank you

    #2
    Hello lunardiplomacy,

    Thank you for your post.

    Who are you using as your data provider? This sounds like you're not getting tick data that you'd need to power tick based charts.

    Do you receive an error, either on screen or in the Log tab of the Control Center? If so, what is the full text of the error?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hello Kate, thanks for getting back to me.

      Yes, when the method is added to State == State.Configure I get the error...

      "Error on calling 'OnBarUpdate' method on bar - 1: You are accessing an index with a value that is invalid since it is out-of-range I.E. accessing a barsAgo value of 5 when there are 4 on the chart"

      I am using CurrentBar < 3 { return; }, which as far as I can tell should be sufficient.

      Please note, when I load my indicator without the AddDataSeries method there is nothing printed in the log window.

      Look forward to hearing your thoughts, Kate.
      Last edited by lunardiplomacy; 04-27-2020, 12:53 PM. Reason: Edit: Provider is NT Continuum, and I know I get tick data, the same exact method in the same place (state.config) works just fine in the context of a strategy, just not on my custom indicator.

      Comment


        #4
        Hello lunardiplomacy,

        Thank you for your reply.

        NinjaTrader Continuum should provide you with the necessary tick data needed to open range or tick based charts if the account is enabled for real time data for that particular instrument. What instrument are you trying to run the indicator on? Are you able now to pull up a tick based chart of this instrument? If not, do you receive a log error message about it in the Log tab of the Control Center?

        Also, you need to make sure that you have enough bars in both the primary series as well as the secondary series. CurrentBar will refer to whichever series is currently processing in OnBarUpdate. Try adding this instead of CurrentBar < 3 { return }:

        if (CurrentBars[0] < 3 || CurrentBars[1] < 3)
        return;

        Thanks in advance; I look forward to resolving this for you.


        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Oh man, that was it, Kate. I assumed since I wasn't actually referring to previous secondary bars in my logic that I wouldn't need to modify the currentbars filter yet, but I guess technically if I am referencing current primary bars, the secondary bars need to exist?

          Anyway, pretty much an oversight on my part. Thanks for helping me work this one out, Kate. Have a good evening.
          Last edited by lunardiplomacy; 04-27-2020, 02:40 PM. Reason: typo

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by AnnJee, Today, 08:31 PM
          0 responses
          1 view
          0 likes
          Last Post AnnJee
          by AnnJee
           
          Started by ESHunter, Today, 08:06 PM
          1 response
          7 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by ETFVoyageur, 05-07-2024, 07:05 PM
          18 responses
          144 views
          0 likes
          Last Post bltdavid  
          Started by thumper57, Yesterday, 04:30 PM
          8 responses
          26 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by morrnel, Today, 06:07 PM
          2 responses
          22 views
          0 likes
          Last Post morrnel
          by morrnel
           
          Working...
          X