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

How to Access Cumulative Delta in Strategy Builder

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

    How to Access Cumulative Delta in Strategy Builder

    I am attempting to use Strategy Builder to create a simple strategy that compares elements of price to Cumulative Delta. As a paid subscriber I have access to the premium Order Flow + indicators including Cumulative Delta. However, none of the Order Flow + indicators are included in the list of indicators in the Conditions section of Strategy Builder. Am I missing something? Is there a way to accomplish this?

    #2
    Hello JG636943,

    Thanks for your post.

    Unfortunately, Order Flow+ indicators are too complex for use with the Strategy Builder.

    That said, you could unlock the strategy from the Strategy Builder with the 'Unlock code' button to use the Order Flow Cumulative Delta indicator in a NinaScript strategy.

    See the help guide documentation below for an example of using the Order Flow Cumulative Delta in a NinjaScript.

    Order Flow Cumulative Delta: https://ninjatrader.com/support/help...ive_delta2.htm

    Let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_BrandonH View Post
      Hello JG636943,

      Thanks for your post.

      Unfortunately, Order Flow+ indicators are too complex for use with the Strategy Builder.

      That said, you could unlock the strategy from the Strategy Builder with the 'Unlock code' button to use the Order Flow Cumulative Delta indicator in a NinaScript strategy.

      See the help guide documentation below for an example of using the Order Flow Cumulative Delta in a NinjaScript.

      Order Flow Cumulative Delta: https://ninjatrader.com/support/help...ive_delta2.htm

      Let us know if we may assist further.
      That's not correct. They were unlocked last year, then you guys removed them again. Why are these not being included as indicators for strategy builder for PAYING customers?

      Comment


        #4
        Hello trader14,

        Thanks for your note.

        As previously stated, the Order Flow+ indicators were removed from being used the Strategy Builder because the code needed to generate the indicators is too complex for use with the Strategy Builder.

        If you would like to use Order Flow+ indicators in a custom NinjaScript, you need to unlock the script from the Strategy Builder and use the Order Flow+ indicator methods mentioned in the NinjaTrader help guide documentation seen below.

        Order Flow Cumulative Delta: https://ninjatrader.com/support/help...ive_delta2.htm
        Order Flow Volumetric Bars: https://ninjatrader.com/support/help...tric_bars2.htm
        Order Flow VWAP: https://ninjatrader.com/support/help...flow_vwap2.htm

        Let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          With help from a fellow programmer, I have written a simple (very simple) strategy that attempts to access output from the Order Flows Cumulative Delta indicator. The strategy generates no errors in the editor and also compiles with no errors and imports with no errors. Yet, when I apply it to a chart, it simply will not enable. There is a momentary flash and the word "Loading..." appears but then it unchecks the Enable checkmark and stops. There are no accompanying error messages so I have no idea why it refuses to enable, it just doesn't. Other strategies such as the Sample MA Cross work fine. Does anyone have an idea of what the underlying cause of this behavior could be, or how to diagnose it?

          Comment


            #6
            Hello JG636943,

            Thanks for your note.

            Please write into scriptingsupport[AT]ninjatrader.com with your log and trace files so we may investigate this further.

            Follow the steps below to manually attach your log and trace files to your response.
            • Open your NinjaTrader folder under, "Documents" (sometimes called, "My Documents")
            • Right click on the 'log' and 'trace' folders and select Send To> Compressed (zipped) Folder.
            • Send the 2 compressed folders as attachments to this email.
            • Once complete, you can delete these compressed folders.
            Thanks in advance; I look forward to resolving this item.
            Brandon H.NinjaTrader Customer Service

            Comment


              #7
              Thanks BrandonH, The zip files are on the way.

              Comment


                #8
                I hired an expert on Upwork to create a super simple strategy for me. I'm not so interested in the strategy itself but wanted sample code to see how to properly incorporate the Order Flows Cumulative Delta indicator into a strategy. All the strategy does is go long on a green price bar when accompanied by a corresponding red delta bar. The short trade is the opposite: red price bar, green delta bar.

                Well, after many weeks of back and forth with the expert and hundreds of dollars, I am left with a strategy that won't run. It will compile but won't enable, so I can't see its results on a chart. Can anyone recommend someone who can look at the code and tell me what the fatal flaw is?

                Comment


                  #9
                  Hello JG646943,

                  Thanks for your note.

                  Did you receive my email regarding the error that was being thrown by the strategy? See below.

                  "Strategy 'CumDeltaStrategy': Error on calling 'OnBarUpdate' method on bar 21: Index was outside the bounds of the array.

                  This error message indicates that you are trying to access a BarsAgo value in your script that has not yet been processed.

                  As one example, calling Close[1] when CurrentBar is 0 (the very first bar) will cause this error. The reason for this is because there will not be a bar ago; essentially there is not enough data at bar 0 to look back one bar.

                  A CurrentBar check should be added to your script to ensure that there are enough bars processed for the BarsAgo value you are accessing. If you have multiple data series added in your script, you would need to use a CurrentBars check. See the example of a CurrentBar check below.

                  if (CurrentBar < 10)
                  return;

                  This would check to make sure that 10 bars have been processed before the script begins its calculations.

                  See the help guide documentation below for more information.
                  CurrentBar - https://ninjatrader.com/support/help...currentbar.htm
                  CurrentBars - https://ninjatrader.com/support/help...urrentbars.htm
                  Make sure you have enough bars - https://ninjatrader.com/support/help...nough_bars.htm

                  If the issue still occurs after adding a CurrentBar check to your script, debugging steps should be taken. You would be to add prints throughout your strategy's OnBarUpdate() method so you may narrow the issue down to the line of code that is throwing the error. Once you see which line is throwing the error, the indexing issue should be evident and you should be able to fix it.

                  If you did not create the strategy, you should reach out to the developer of the strategy to let them know of the error that is occurring so they can debug and modify their script.

                  Additional debugging tips can be found in our help guide. I'll provide a link below.

                  Debugging Tips - https://ninjatrader.com/support/help...script_cod.htm"



                  Let us know if we may assist further.

                  Brandon H.NinjaTrader Customer Service

                  Comment


                    #10
                    Hi Brandon,

                    I have resolved all of the issues preventing the strategy from running and it now works splendidly. Thank you.

                    I have encountered a strange phenomenon related to the returned Cumulative Delta values. Here is the code snippet in question:

                    // Set 1
                    if (Close[0] > Open[0] && cumulativeDelta.DeltaClose[0] < cumulativeDelta.DeltaOpen[0])
                    {
                    // Do Stuff
                    }

                    The Close and Open related to the price bar do in fact return values for the current price bar. However, the DeltaOpen and DeltaClose return values for the previous bar. How do I get the Open and Close values for the current delta bar?

                    Thanks.

                    Comment


                      #11
                      Hello JG636943,

                      Thanks for your note.

                      After testing the Cumulative Delta indicator DeltaOpen and DeltaClose, we see that the DeltaOpen and DeltaClose are updating and printing values for the current bar. See the attached image showing this.

                      I am attaching the indicator used to test this.

                      Let us know if we may assist further.
                      Attached Files
                      Brandon H.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_BrandonH View Post
                        Hello trader14,

                        Thanks for your note.

                        As previously stated, the Order Flow+ indicators were removed from being used the Strategy Builder because the code needed to generate the indicators is too complex for use with the Strategy Builder.

                        If you would like to use Order Flow+ indicators in a custom NinjaScript, you need to unlock the script from the Strategy Builder and use the Order Flow+ indicator methods mentioned in the NinjaTrader help guide documentation seen below.

                        Order Flow Cumulative Delta: https://ninjatrader.com/support/help...ive_delta2.htm
                        Order Flow Volumetric Bars: https://ninjatrader.com/support/help...tric_bars2.htm
                        Order Flow VWAP: https://ninjatrader.com/support/help...flow_vwap2.htm

                        Let us know if we may assist further.
                        Hi Brandon

                        If I understand your post, I can unlock the Order Flow Cum Delta and it will appear in the list of indicators in the Strategy Builder?

                        I don't want to do this if there is any programming.

                        I also don't want to do this if I then have any potential problems in the future. I have been a lifetime member for over 10 years and love the platform.

                        Thank you
                        Michael

                        Comment


                          #13
                          Hello nymexwti,

                          Thanks for your notes.

                          That is incorrect. No Order Flow indicators are accessible in the Strategy Builder due to the complexity of their code.

                          To access the Order Flow Cumulative Delta indicator in a custom NinjaScript, you must unlock the code from the Strategy Builder and manually program your strategy in the NinjaScript Editor window to use the OrderFlowCumulativeDelta() method.

                          Here is a help guide page with more information about accessing Order Flow Cumulative Delta in a custom NinjaScript: https://ninjatrader.com/support/help...ive_delta2.htm
                          Brandon H.NinjaTrader Customer Service

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Haiasi, 04-25-2024, 06:53 PM
                          2 responses
                          17 views
                          0 likes
                          Last Post Massinisa  
                          Started by Creamers, Today, 05:32 AM
                          0 responses
                          5 views
                          0 likes
                          Last Post Creamers  
                          Started by Segwin, 05-07-2018, 02:15 PM
                          12 responses
                          1,786 views
                          0 likes
                          Last Post Leafcutter  
                          Started by poplagelu, Today, 05:00 AM
                          0 responses
                          3 views
                          0 likes
                          Last Post poplagelu  
                          Started by fx.practic, 10-15-2013, 12:53 AM
                          5 responses
                          5,408 views
                          0 likes
                          Last Post Bidder
                          by Bidder
                           
                          Working...
                          X