Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

No Indicator Data on First Bar

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

    No Indicator Data on First Bar

    upon loading the chart and indicators, some indicators like OBV and ADL show a value of "0" for the first bar. However, the first bar has volume data, so OBV and ADL should be populated with the volume number, but it's not. This really messes up calculations for the rest of the day.

    How can I adjust the settings or code to make OBV values start calculating on the first bar instead of 2nd bar?

    #2
    Hello Ocean Zhang,

    Thank you for your post.

    You would need to use another Calculate option such as OnEachTick. If you are using Calculate.OnBarClose it will not calculate until the bar closes.

    Please let me know if you have any questions.

    Comment


      #3
      Patrick, thanks for your reply. I've tried on each tick calculation as well. Doesn't work. Even for on bar close, there's volume data on bar close, so if bar closes with 10,000 volume, and the bar was positive, then OBV value on 1st bar should be 10,000. But it's 0 for both calculation methods.

      Comment


        #4
        Hello Ocean Zhang,

        Thank you for your response.

        Can you attach a screen shot of the charts so I may investigate this matter further?

        To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.

        Click here for instructions: http://windows.microsoft.com/en-us/w...#1TC=windows-8

        Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment to this forum thread.

        Click here for detailed instruction: http://take-a-screenshot.org/

        I look forward to your response.

        Comment


          #5
          screenshot attached. Databox set on the first bar to show OBV of 0. ADL actually does have data. It's only OBV that does not.
          Attached Files

          Comment


            #6
            Hello Ocean Zhang,

            Thank you for your response.

            OBV will always be 0 on the first bar due to it's logic. You can review the indicator code under New > NinjaScript Editor > Indicators > OBV.

            Please let me know if you have any questions.

            Comment


              #7
              The logic is bad. 0 OBV on first bar can severely mess up the calculations the rest of the day. I've worked with 3 other platforms, and all of them retrieve volume data for OBV starting the 1st bar loaded. How can this be changed in NT to recognize the volume of the first bar?

              ADL is a very similar concept as OBV. NT calculates ADL correctly, starting with volume of the 1st bar.

              Comment


                #8
                Hello Ocean Zhang,

                Thank you for your response.

                OBV compares the current close against the prior close. On CurrentBar 0 there is no prior close and therefore the value is set to 0.
                The OBV determines whether to add to or subtract from the prior volume with the current volume based on the comparison of the current and prior close. On bar 0 there is no prior volume nor close.

                Please let me know if you have any questions.

                Comment


                  #9
                  I understand the logic behind the calculations in NT, but it's not 100% correct because it doesn't have a starting value as the creator intended. NT code needs to assign a starting value equal to the positive/negative volume of the first bar and then start the calculations. This is how all other platforms do it.



                  relevant quote:

                  "Because OBV has to start somewhere, the first value (8200) is simply equal to first period's positive/negative volume."

                  Comment


                    #10
                    Hello Ocean Zhang,

                    Thank you for your response.

                    I will forward your notes to our development team.

                    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