Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator not plotting on RTH only plots on 24/7

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

    Indicator not plotting on RTH only plots on 24/7

    Hello.

    I've built a custom indicator but it doesn't plot on the price panel if Data Series is set to RTH (in this case CME RTH Futures).

    Click image for larger version

Name:	RTH.jpg
Views:	181
Size:	18.7 KB
ID:	1182762


    It does plot if I select ETH or 24/7 or 25/7.


    Help appreciated

    #2
    Hello dj22522,

    Thank you for your post.

    Do any errors appear in the Log section of the Control Center regarding the indicator when you try to use it on an RTH chart? If so, what is the full text of the error?

    Without seeing the indicator code I couldn't really say why that may be. Can you provide the code here or if you don't want to share it publicly, you can send an email to scriptingsupport [at] ninjatrader [dot] com with 3410656 ATTN Kate W. in the subject line and a link to this post in the body of the email with the script attached and I'm happy to take a look.

    Thanks in advance; I look forward to assisting you further.

    Comment


      #3
      Hello Kate.

      I've sent you an email as instructed.

      Many thanks
      Last edited by dj22522; 12-22-2021, 02:52 PM.

      Comment


        #4
        Hello dj22522,

        Thank you for your reply.

        The error indicates you are trying to access an index of a series that's not possible to access, this usually occurs because not enough bars are loaded at the time the script tries to access that series index. This is occurring somewhere within OnBarUpdate.

        I would advise adding some prints to your script to narrow down exactly where the error is occurring.

        This forum post goes into great detail on how to use prints to help figure out where issues may stem from — this should get you going in the correct direction. You can even add these using the Strategy Builder.

        https://ninjatrader.com/support/foru...ns-not-working

        If you run into issues like we saw here, the above information will allow you to print out all values used to pinpoint where the error is occurring when using an RTH timeframe. It appears to be occurring on the very first bar on the chart, so I would also make sure you have CurrentBar checks if you're looking back several bars for a value. For example:

        if(CurrentBar < 5)
        return;

        double myValue = High[5];

        would correctly assign myValue the price of the high 5 bars ago without error; however, if you didn't check there were at least 5 bars on the chart first, you'd get an error like the one you see above.

        Please let us know if we may be of further assistance to you.

        Comment


          #5
          Hello Kate:

          Solved.

          Thank you.

          As you explained I was missing :

          if(CurrentBar < 2)
          return;
          Please ignore the email I sent you.

          Sincere thanks

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          576 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X