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

Total Volume current and prior day

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

    #31
    Sorry, Just forget to say that I add data back to the chart like the last 15 days or so on Minute and Daily chart but is still same error exactly.

    Comment


      #32
      Hello Mike.A,

      Thank you for your reply.

      Now that your script is looking for the values from up to 3 bars ago, you will need to adjust your CurrentBars check. Here is what you currently have:

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

      Since you are wanting to check a value from Closes[1])[3] then you will need to make sure that there are at least 3 bars on the chart before this is calculated. We have a page about making sure you have enough bars here:



      If you adjust the statement to the following, I suspect it should resolve the error:

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

      Please let us know if we may be of further assistance.
      Emily C.NinjaTrader Customer Service

      Comment


        #33
        Hi Emily

        Thank you very much for your reply

        it is work

        You are the best

        Thanks a lot
        Mike.A

        Comment


          #34
          Hello Mike,

          If you change a barsAgo reference from 0 to 1, you would be changing from "the current processing bar" to "the previous bar."

          Similarly, changing a barsAgo reference from 1 to 2, you would be changing from "the previous bar" to "2 bars ago"

          When scripts start processing, they start on bar 0, then process bar 1, bar 2, etc.

          If we reference 1 bar ago on bar 0, that "1 bar ago" is not yet available to the script because it has not been processed yet.

          So you need to make sure that if the script is processing before bar 2, it is not referencing 2 bars ago.

          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by DanielTynera, Today, 01:14 AM
          0 responses
          2 views
          0 likes
          Last Post DanielTynera  
          Started by yertle, 04-18-2024, 08:38 AM
          9 responses
          40 views
          0 likes
          Last Post yertle
          by yertle
           
          Started by techgetgame, Yesterday, 11:42 PM
          0 responses
          9 views
          0 likes
          Last Post techgetgame  
          Started by sephichapdson, Yesterday, 11:36 PM
          0 responses
          2 views
          0 likes
          Last Post sephichapdson  
          Started by bortz, 11-06-2023, 08:04 AM
          47 responses
          1,615 views
          0 likes
          Last Post aligator  
          Working...
          X