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

Referencing cumulative delta in strategy builder by using an ema of cumulative delta

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

    Referencing cumulative delta in strategy builder by using an ema of cumulative delta

    Hello,

    Since cumulative delta cannot be directly accessed in the builder, I am trying a workaround by adding an ema of cumulative delta to the cumulative delta indicator (set to bar) where it can actually be accessed in the builder. The idea is if I set the ema to 1 period, and have the cumulative delta indicator set to bar, where it is above or below a zero line, and have the ema set to the close of each delta bar, I should be able to get exact delta values through the builder that I can then set logic to within the builder because I am referencing the ema value at the close of each delta bar. The issue I am seeing is that it works perfectly in a backtest, but in live it is taking random trades that don't correlate to the delta values of the ema. I just want to know what the discrepancy is between it working in the backtest but not accurately seeing the ema value during live.

    Thanks,
    Jim

    #2
    Hello Jim,

    Thank you for your post.

    Due to limitations of the Strategy Builder, I'm afraid this would not work as expected unless you are using a 1-tick data series as your primary series that the strategy is applied to. There is not a known workaround for getting Order Flow Cumulative Delta values in the Strategy Builder, though I will gladly add your vote to an existing feature request to add support for Order Flow tools in the Strategy Builder in the future.

    In an unlocked script, you can work with the primary series and an added 1-tick data series to get accurate Cumulative Delta values, as demonstrated in the code examples on this page:


    Thank you for using NinjaTrader.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Thank you. Since it seems I have to work in the script anyway, what I would prefer to access is the delta in the data table of the volumetric bars chart type instead of cumulative delta indicator.

      1. Do you have an example of how to access and work with those delta values in the volumetric data table?

      2. I noticed that cumulative delta per par on the indicator doesn't equal the delta per bar in the volumetric chart type data table. Could you explain why this is? I would assume the data table is showing the cumulative delta per bar and should match the indicator.

      Thank you,
      Jim

      Comment


        #4
        Hello Jim,

        Thank you for your reply.

        The NinjaScript methods and properties available for the Order Flow Volumetric Bars, including delta values, may be found here:


        So I may better assist you with item #2, please provide a screenshot of your settings for the cumulative delta and the volumetric bars so I may set it up on my platform and compare. When I tested on my end, I saw that the Cumulative Delta values matched with the delta per bar, as shown in this video:
        https://www.screencast.com/t/QquvGc8jX
        • To send a screenshot with Windows 10 or newer I would recommend using the Windows Snipping Tool.
        • 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 it as a jpeg file and send the file as an attachment.

        I look forward to your reply.
        Emily C.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          Thank you for sending. Below is a snip of a cumulative delta bar showing a value of around 670 on the indicator while the volumetric chart delta is showing 570.

          Click image for larger version

Name:	image.png
Views:	56
Size:	10.8 KB
ID:	1293285

          Thank you,
          Jim

          Comment


            #6
            Hello Jim,

            Thank you for your reply.

            Please right-click your chart and select Data Series then scroll down to the volumetric settings and provide a screenshot of your configuration for the Volumetric Bars. Click OK to close that window then right-click the chart and select Indicators. Select the Cumulative Delta indicator and provide a screenshot of those settings. I would like to set up the same bars and indicator on my own chart to review and analyze why the values might be different.

            I look forward to your reply.
            Emily C.NinjaTrader Customer Service

            Comment


              #7
              Hello,

              Please see the screenshots below:

              Volumetric bars:
              Click image for larger version

Name:	image.png
Views:	42
Size:	110.9 KB
ID:	1293322

              Cumulative Delta Indicator:

              Click image for larger version

Name:	image.png
Views:	42
Size:	28.4 KB
ID:	1293323

              Thank you,
              Jim
              Attached Files

              Comment


                #8
                Hello Jim,

                Thank you for your response.

                I believe I see the discrepancy you are reporting. I am going to look into this further and create a script that prints the values of the Delta from the Volumetric Bars as well as the Delta Close from the Cumulative Delta indicator in order to compare the data points. I will follow up here once I have an update. In the meantime, please feel free to reach out with any additional questions or concerns.

                Thank you for your patience.
                Emily C.NinjaTrader Customer Service

                Comment


                  #9
                  Hi Emily,

                  Thank you for looking into this. I have a follow up question on building an indicator that references the delta per bar in the volumetric bar chart. If I create a custom indicator in an unlocked script that can call the delta per bar accurately with the proper data series requirements, and then add plots to it so that it can bee seen by the builder, would this work as a workaround for being able to reference delta per bar in other strategies built by the builder? It seems that the bar statistics are open for plotting.

                  Thanks,
                  Jim

                  Comment


                    #10
                    Originally posted by jamesliotttrading View Post
                    Hi Emily,

                    Thank you for looking into this. I have a follow up question on building an indicator that references the delta per bar in the volumetric bar chart. If I create a custom indicator in an unlocked script that can call the delta per bar accurately with the proper data series requirements, and then add plots to it so that it can bee seen by the builder, would this work as a workaround for being able to reference delta per bar in other strategies built by the builder? It seems that the bar statistics are open for plotting.

                    Thanks,
                    Jim
                    Hello Jim,

                    Thank you for your note.

                    Yes, if you create an indicator that accesses the desired delta data and creates a plot with those values, that plot could be accessed within the Strategy Builder. The Strategy Builder is able to access values from an indicator's public plots. For more information about NinjaScript access in an unlocked script for the Order Flow Volumetric Bars and Order Flow Cumulative Delta that you could consider using in an unlocked indicator script, please see the links below:Please let us know if we may be of further assistance. I appreciate your continued patience while I research the discrepancy in values between the Cumulative Delta value and the Volumetric Bar delta value.
                    Emily C.NinjaTrader Customer Service

                    Comment


                      #11
                      Hi Emily,

                      Thank you for confirming. I now have an indicator that, when I apply it to the chart, correctly references and identifies the delta values. The logic of the indicator shows delta divergence, for example - when delta is negative but the candle closes positive, it will draw a dot below the bar. In this indicator is a signal plot that stores a "1" when the condition is true for a bullish divergence, and a "-1" when the condition is true for a bearish divergence. This signal plot is visible in the strategy builder. So I tried to do a simple test in the builder - if the signal plot = 1, then enter a long position. When trying to compile this, I am getting the 2 errors shown in the attached screen shot. Can you clarify what I need to add in order to correct these errors?

                      Click image for larger version

Name:	Screenshot 2024-03-08 120223.jpg
Views:	58
Size:	233.0 KB
ID:	1294856

                      ​Thanks,
                      Jim

                      Comment


                        #12
                        Hello Jim,

                        Thank you for your note.

                        The error seems to be related to the DeltaDivergenceBars indicator. Is this an indicator that you developed, or one that was imported from a third party? Is the Signal plot a public plot in the indicator?
                        If possible, please provide the DeltaDivergenceBars source code by exporting it via Control Center > Tools > Export > NinjaScript AddOn then attach the .zip that is generated to your reply so I may further investigate.

                        I look forward to your reply.
                        Emily C.NinjaTrader Customer Service

                        Comment


                          #13
                          Hi Emily,

                          I had it built to have a plot publicly accessible in the builder and then imported. The file is attached.

                          Thanks,
                          Jim
                          Attached Files

                          Comment


                            #14
                            Originally posted by jamesliotttrading View Post
                            Hi Emily,

                            I had it built to have a plot publicly accessible in the builder and then imported. The file is attached.

                            Thanks,
                            Jim
                            Hello Jim,

                            Thank you for your reply.

                            I was able to successfully import the indicator and add the following Condition/Action set into the Strategy Builder successfully:


                            What version of NinjaTrader are you using? The version number may be found at Control Center > Help > About. Also, since you have created this strategy in the Strategy Builder, do you still get errors after clicking the "Compile" button again in the Strategy Builder or are the errors resolved?

                            I look forward to your reply.
                            Emily C.NinjaTrader Customer Service

                            Comment


                              #15
                              Hi Emily,

                              I am using version 8.1.2.1

                              I tried compiling in the builder and it still produces an error.

                              Click image for larger version

Name:	image.png
Views:	28
Size:	18.9 KB
ID:	1294899

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by tsantospinto, 04-12-2024, 07:04 PM
                              7 responses
                              126 views
                              0 likes
                              Last Post aligator  
                              Started by futtrader, 04-21-2024, 01:50 AM
                              5 responses
                              56 views
                              0 likes
                              Last Post NinjaTrader_Eduardo  
                              Started by PeakTry, Today, 10:49 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post PeakTry
                              by PeakTry
                               
                              Started by llanqui, Today, 10:32 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post llanqui
                              by llanqui
                               
                              Started by StockTrader88, 03-06-2021, 08:58 AM
                              45 responses
                              3,994 views
                              3 likes
                              Last Post johntraderuser2  
                              Working...
                              X