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

Problems with Cumulative Delta Indicator

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

    Problems with Cumulative Delta Indicator

    Hi, this is an additional post to my earlier post https://ninjatrader.com/support/forum/node/1121004

    I plotted the Cumulative Delta indicator on a 1 Range ES chart

    My settings for this indicator are:
    1. Delta type = BidAsk
    2. Period = Bar

    I let the indicator run for a while and then pressed F5 to refresh. To my shock, the past delta values are different !

    This also happens to other range charts and tick charts.

    Please see the attached PDF for the comparison between and after refresh.

    Kindly look into this and advise how this can be resolved?

    Thanks.


    Attached Files

    #2
    Hello Rainmakersg,

    Thanks for your post.

    In your last thread we explained that this is due to historical data being processed in chronological order based on bar timestamps and if ticks are received with the same timestamp, they may not unroll in the same order that they were received.

    See post #5 - https://ninjatrader.com/support/foru...80#post1120980

    We also mentioned:

    Discrepancies with tick based charts will be less noticeable in larger tick sized charts, but these discrepancies may be more noticeable in smaller tick based charts.
    Range is a tick based chart and you are going to see larger discrepancies with smaller tick/range bars like you have provided with your screenshot.

    If you need absolute accuracy for small tick based charts, you could develop a Cumulative Delta indicator that uses Volumetric Bars data access methods, or simply use Volumetric bars themselves.



    Please let me know if this is not clear.
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,

      Thanks for your reply.

      For a paid indicator like the Cumulative Delta that comes with the lifetime licence, I would at least expect it be consistent with itself. This time, the problem I have flagged out is not comparing the Delta of the Cumulative Delta indicator with the Delta of the volumetric bars.

      I am merely refreshing the chart and found that the Delta calculated by the Cumulative Delta indicator are not consistent with past Deltas. This is not supposed to happen if the calculation are consistent. I am wondering whether can we trust the Deltas shown by the Cumulative Delta indicator?




      Comment


        #4
        Hello Rainmakersg,

        There are going to be discrepancies between historical processing and realtime processing because of how ticks with the same timestamp get unrolled.

        First it is processed with realtime data with the actual tick order. Then it is refreshed with F5, processed as historical data, and then matching timestamps for ticks do not get unrolled in the same order. (We just know the timestamp of the bar with historical data.) This is a known limitation which we had discussed in the other thread.

        The limitation affects historical data only when there are ticks with the same timestamp and most noticeable with small tick based bars, like in your example.

        The discrepancies are minimal on larger bars, and realtime data is not affected. As mentioned, if you need absolute accuracy for the historical end, you can use Volumetric Bars or create an indicator that access the Volumetric Bar's data access methods.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi Jim,

          We just created an indicator that accessed the Volumetric Bar's data access methods. The results are the same. The historical Delta and the real time Delta don't match up.

          Turning on tick replay on the data series does not resolve the problem.

          To be frank, I am only interested in the real time Delta, as it is the one used for trading purposes. I am happy as long as it is accurate at the moment it is generated by the indicator. Can you confirm again that this real-time delta is accurate?

          Comment


            #6
            Hello Rainmakersg,

            I have set up a test indicator that we can use for comparisons as well. I have also prepared a demonstration illustrating the discrepancies are seen with OFCD with historical data on small tick based bars, but not with Volumetric.

            So we are clear, the limitation involves indicators processing ticks with the same timestamp on a tick based bar with historical data. This is not seen with realtime data, or on time based bars, and larger tick based bars will show minimal discrepancies with historical data when smaller tick based bars will show larger discrepancies. Since the Volumetric BarsType collects this data before it is packaged into a bar and later unrolled in an indicator, we do not get those discrepancies.

            Demo - https://drive.google.com/file/d/1FmQ...yEqDlINDx/view

            My test indicator is also attached.

            Please let us know if there is anything else we can do to help.
            Attached Files
            Last edited by NinjaTrader_Jim; 10-22-2020, 10:49 AM.
            JimNinjaTrader Customer Service

            Comment


              #7
              Hi Jim,

              Thanks for putting in the effort in writing the indicator and making the video. I really appreciate it.

              Unfortunately, the video has no sound, so I can only guess what you are trying to present.

              My interpretation of the video is that you are trying to show that the Volumetric real-time delta tallies with the OFCD real-time delta. But upon refreshing, things are different for OFCD. At 7:15:38, the Volumetric Chart's real-time delta still tallies with its own historical delta. It is the OFCD that is giving the issue, whereby its historical delta does not tally with its real-time delta.

              For my case, I am using a regular tick chart and not a volumetric chart. I add the volumetric Delta as an additional series via Ninjascript, so I run into the problem of the historical delta not tallying with the real-time delta. Can you advise if my observation is correct?

              Comment


                #8
                Sorry about that. I had an issue with my microphone and I updated my post with a recording with audio.

                Yes, OFCD on tick based bars will change with historical processing in comparison to realtime processing. This is because OnBarUpdate cannot differentiate which tick should come first when single tick bars with the same timestamp are seen.

                OFCD is consistent with realtime data, and with historical data with time based bars. The issue is relevant only with the indicator when processing historical data with tick based bars. If you need absolute historical accuracy with tick based bars, you can use the Volumetric Bars data access methods.

                We look forward to assisting.
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Hi Jim,

                  Looks like the Volumetric Chart is the best chart for users who are running Order Flow indicators and strategies as it is constructed differently from other charts and is the most accurate for this purpose.

                  Having said that, not everyone needs a footprint chart type of presentation. For someone like myself, I just need a tick chart that shows Delta. For this group of users like myself, may I suggest that Ninjatrader gives us an option on the volumetric chart settings to hide those numbers and boxes and give the bars a wick so that it looks like a regular chart (tick, volume, range or time-based), which is powered in the background by volumetric bars.

                  This will allow us to harness the power of the volumetric bars while maintaining the simple look and feel of a regular chart (tick, volume, range or time-based). I would like to put in a request for such an option to be added.

                  Thanks.

                  Comment


                    #10
                    Hello Rainmakersg,

                    You can already accomplish your goal by adding the Volumetric BarsType as a secondary data series in an indicator, and using the Volumetric Bars Data Access methods to fetch the values you want to present on the chart. We would recommend doing this to display specific Volumetric values and do not want to view everything offered with Volumetric Bars

                    I have attached an example that adds the volumetric bars as a secondary series, and displays BarDelta with Draw.Text.

                    Please let me know if this not a viable solution for your needs.
                    Attached Files
                    JimNinjaTrader Customer Service

                    Comment


                      #11
                      Hi Jim,

                      Thanks once again for taking the time to write this indicator. It is exactly what I need. I modified it and plotted the delta into non time-based charts. Now the historical delta is the same as the real-time delta. Thanks so much

                      I have previously been plotting delta using the OFCD access method. In comparison, this Volumetric Bar access method is more straight forward, less confusing, syncs historical delta with real-time delta and seems to make the charts load faster.

                      Given that the Volumetric Bar access method gives no error in generating historical delta, and it can achieve much more than what the OFCD access method can do, isn't the OFCD access method redundant?

                      Another question is since the historical delta of the OFCD access method is not accurate, does it mean its backtests are also unreliable?
                      Last edited by Rainmakersg; 10-23-2020, 11:40 AM.

                      Comment


                        #12
                        Hello Rainmakersg,

                        We suggest hard coding the data series into the script since it is not always guaranteed that properties based on user input, the Instrument object, or Bars/BarsPeriod would not be available until State.DataLoaded, and we add data series in State.Configure which comes before.

                        See note in AddDataSeries documentation below.

                        AddDataSeries - https://ninjatrader.com/support/help...dataseries.htm

                        While the below would be unsupported and would not work in certain cases (optimizations in a strategy for example,) you could get away with doing this for some cases and may be worth trying.

                        Code:
                        AddVolumetric(null, BarsPeriod.BarsPeriodType, BarsPeriod.Value, VolumetricDeltaType.BidAsk, 1);
                        We look forward to assisting.
                        JimNinjaTrader Customer Service

                        Comment


                          #13
                          Hi Jim,

                          Before your reply, I modified the code exactly the way you suggested and got what I needed, so I modified the original post. I have also taken note of your caution, so I will just hardcode it.

                          In case you missed my modified post, this is it:


                          Hi Jim,

                          Thanks once again for taking the time to write this indicator. It is exactly what I need. I modified it and plotted the delta into non time-based charts. Now the historical delta is the same as the real-time delta. Thanks so much

                          I have previously been plotting delta using the OFCD access method. In comparison, this Volumetric Bar access method is more straight forward, less confusing, syncs historical delta with real-time delta and seems to make the charts load faster.

                          Given that the Volumetric Bar access method gives no error in generating historical delta, and it can achieve much more than what the OFCD access method can do, isn't the OFCD access method redundant?

                          Another question is since the historical delta of the OFCD access method is not accurate, does it mean its backtests are also unreliable?

                          Comment


                            #14
                            Hello Rainmakersg,,

                            If you are using Volumetric Bars to get information that is provided by OFCD, the use of OFCD would be redundant.

                            As we have mentioned, the historical data limitation with the indicator only is relative to tick based charts. There would be no issue with OFCD on a time based data series, and this would work fine in a backtest.

                            If you are backtesting a tick based bar and need absolute accuracy, use the Volumetric Bars data access methods instead of OFCD.
                            Last edited by NinjaTrader_Jim; 10-23-2020, 12:48 PM.
                            JimNinjaTrader Customer Service

                            Comment


                              #15
                              Hi Jim,

                              Thanks for all your answers. Really appreciate it!

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by alifarahani, Today, 09:40 AM
                              6 responses
                              36 views
                              0 likes
                              Last Post alifarahani  
                              Started by Waxavi, Today, 02:10 AM
                              1 response
                              17 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by Kaledus, Today, 01:29 PM
                              5 responses
                              14 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by Waxavi, Today, 02:00 AM
                              1 response
                              12 views
                              0 likes
                              Last Post NinjaTrader_LuisH  
                              Started by gentlebenthebear, Today, 01:30 AM
                              3 responses
                              17 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X