Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error on Reqesting Bars Series

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

    Error on Reqesting Bars Series

    Hello - I am trying to build an indicator that plots the OBV with 3 smas. The attached code compiles (see attached txt file) but when I try to add it to a chart I get this message:

    Click image for larger version  Name:	Error on Requesting Bars Series.PNG Views:	0 Size:	5.3 KB ID:	1177680 Any suggestions?

    Thank you in advance for any help.
    Last edited by JohnS52; 11-07-2021, 12:23 PM.

    #2
    Hello JohnS52,

    As a tip, to export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
    1. Click Tools -> Export -> NinjaScript...
    2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
    3. Click the 'Export' button
    4. Enter a unique name for the file in the value for 'File name:'
    5. Choose a save location -> click Save
    6. Click OK to clear the export location message
    By default your exported file will be in the following location:
    • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
    Below is a link to the help guide on Exporting NinjaScripts.
    http://ninjatrader.com/support/helpG...-us/export.htm


    Does the chart load without the indicator?

    What do you have the Load data based on set to in the Data Series?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea - Here's the Export - see attached.

      I tried the indicator on both ES 12-21 and RTY 12-21, both pre-session (before 6 pm Sunday) and during session (after 6 pm) to no avail.

      All the other indicators are working fine. The Charts load fine without this indicator. Mystified - I am probably overlooking something obvious.
      Attached Files

      Comment


        #4
        Hello JohnS52,

        The main issue I am seeing is that indicators are being called in State.SetDefaults.

        Indicators cannot be called until State.DataLoaded when the data is ready to supply the indicators.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello Chelsea -

          I moved the indicators to State.DateLoaded (see attached). I no longer get the Error on Requesting Bars message and it compiles fine but none of the lines actually plot. All I get is an empty box on the chart with the label attached. The AddPlots should be in State.SetDefaults, right? I tried setting DrawOnPricePanel to both true and false to no avail. Any suggestions? What am I doing wrong?
          Attached Files

          Comment


            #6
            Hello JohnS52,

            In the script you have provided, no values are being set to the plots in OnBarUpdate().

            My guess is you are wanting to set Values[0] to the value of the OBV1.
            Values[0][0] = OBV1[0];

            Values[1] you are probably wanting to set to the SMA1.
            Values[1][0] = SMA1[0];

            etc..

            Below is a link to the help guide on the Values collection in the help guide.
            https://ninjatrader.com/support/help...nt8/values.htm

            As well as AddPlot() which has example code.
            https://ninjatrader.com/support/help...t8/addplot.htm

            Have a look at the MACD indicator which is a simple indicator that has multiple plots.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Many thanks.That worked perfectly. Attached is the code, in case anyone wants to see it.
              Attached Files

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              571 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              331 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
              549 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              549 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X