Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8B10: 'barsAgo' needed to be between 0 and -1 but was 0

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

    NT8B10: 'barsAgo' needed to be between 0 and -1 but was 0

    Hi

    When testing a strategy in Strategy Analyzer, following error is reported:
    'barsAgo' needed to be between 0 and -1 but was 0

    This happens while comparing current [0] and previous [1] values of a public series, that is evaluated in other custom indicator.

    I have tried changing MaximumBarsLookBack to Infinite (in both the strategy and the indicator), but to no avail.

    Is there some way out?

    Kind Regards
    Vivek

    #2
    Hello Vivek,

    When calling 1 bar ago, are you ensuring there is at least 1 bar previous?

    Do you have any check such as 'if (CurrentBar < 1) return;' ?
    Last edited by NinjaTrader_ChelseaB; 05-03-2016, 07:25 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Yes Chelsea,

      if (CurrentBar < 30) return;
      exists within OnBarUpdate() of the strategy, before it calls the indicator.

      Comment


        #4
        Hello engrvivs,

        May I test your script.

        If so, please attach an export to your next post.
        To export a NinjaTrader 8 NinjaScript do the following:
        1. Click Tools -> Export -> NinjaScript...
        2. Click the 'add' link -> check the box(es) for the script(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.


        If you want to keep the script private, please send an email to platformsupport [at] ninjatrader [dot] com. In the email include a link to this forum thread.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,
          I'm having the same issue getting the barsAgo error with NT8 what works ok with NT7.
          It's a NT7 indicator I did convert to run with NT8 and now producing that error.
          The bars lookback logic hasn't change between the NT7 version and NT8, the only changes I made are concerning the drawing and that shouldn’t cause any concerns for NT8.
          May I send you the script to have a look ?



          thanks and regards,
          Olaf

          Comment


            #6
            Hello Olaf,

            I have received your email in platform support and I am happy to take a look.

            I'll be working with you in email moving forward.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by PaulMohn, Today, 03:49 AM
            0 responses
            7 views
            0 likes
            Last Post PaulMohn  
            Started by inanazsocial, Today, 01:15 AM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Jason  
            Started by rocketman7, Today, 02:12 AM
            0 responses
            10 views
            0 likes
            Last Post rocketman7  
            Started by dustydbayer, Today, 01:59 AM
            0 responses
            4 views
            0 likes
            Last Post dustydbayer  
            Started by trilliantrader, 04-18-2024, 08:16 AM
            5 responses
            23 views
            0 likes
            Last Post trilliantrader  
            Working...
            X