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

Strategy Builder does not call enum values correctly.

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

    Strategy Builder does not call enum values correctly.

    The indicator amaSuperTrendU11 uses an enum

    Code:
    public enum amaSuperTrendU11VolaType 
    {
        Range, 
        True_Range, 
        Res_Mean_Abs_Dev, 
        Res_RMS_Dev
    }
    The default value for the variable thisOffsetType is "amaSuperTrendU11VolaType.True_Range".

    When I use the amaSuperTrendU11 with the Strategy Builder, the strategy does not compile. The reason here is that the strategy calls the indicator with the value "amaSuperTrendU11VolaType.true_Range" instead of amaSuperTrendU11VolaType.True_Range.

    The strategy builder simply misspells the enum constant "True_Range" and replaces it with "true_Range".

    This is a clear bug of the strategy builder! There is no variable or constant "true_Range" in the entire code of the indicator. The value is simply invented by the strategy builder.

    To repair the strategy I need to unlock it, then replace the offensive enum constant and compile. Afterwards the strategy works as expected.

    #2
    To make things simpler, I have created a test indicator.

    The indicator is based on the in-built Keltner Channel that ships with NinjaTrader. I have simply added an enum allowing to select between the range and the true range for calculating the channel.The true range is set as default option for the channel type.

    When this simple indicator is used with the strategy builder, it fails to compile, because the strategy builder also replaces the enum constant "True_Range" with the unknown value "true_Range".

    The behavior is the same as for the complex indicator, but much easier to analyze. The test indicator is attached.
    Attached Files

    Comment


      #3
      Hello Harry,

      Thank you for reporting the behavior.

      I will test and report this to the NinjaTrader Development. Once I have verified the behavior, and ensured the behavior is not expected, I will forward a tracking ID for the issue.

      In the meantime, it looks like you may be able to use lower case names for the enum elements to prevent the error.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Hello Chelsea,


        Thank you for responding.

        I am curious what this is about.

        I did not find it earlier, because I never use the strategy builder.

        Comment


          #5
          Hello Harry,

          I was not able to reproduce this behavior in a new test script using the latest version of NinjaTrader (8.0.11.0).

          May I confirm you are using 8.0.11.0?

          Are you able to reproduce using the test script I have created?
          Attached Files
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Hello Chelsea,

            The strategy did neither compile with NT 8.010.0 nor with NT 8.0.11.0.

            Please find attached the strategy that was created by the strategy builder and which does not compile. I have simply unlocked the code to show the problem. You will easily find the problem in line 62.

            Code:
            else if (State == State.DataLoaded)
            {                
                  KeltnerTest1  = KeltnerTest(Close, KeltnerTestChannelType.true_Range, 10, 1.5);
            }

            This behavior has also been observed by two other users, I have only replicated it on my machine to help them.
            Attached Files

            Comment


              #7
              Hello Harry,

              I'm creating a simple script to test that we can submit to our development that does not contain any code that is not absolutely necessary.
              I am also attempting narrow down what is causing the issue. From your first post, it would appear that using a capital enum value is causing the issue.

              May I confirm you have tested my script and you were able to reproduce the behavior?
              If so, I would like to schedule a call with you so that I may test the script on your end in a clean environment.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Chelsea,

                I have now tested your script. The issue is related to the string which is used as an enum value.

                The strategy builder correctly works with your test indicator when the enum value is selected as

                Value1
                Value_1
                Blue_Value

                However, the strategy builder does not compile the strategy when the enum value is selected as

                True_Range
                True_Value

                This means that the issue is probably related to the use of the string "True" as part of an enum value. In that case the strategy builder replaces "True_Range" with "true_Range" or "True_Value" with "true_Value", which causes the failure to compile the strategy.
                Last edited by Harry; 12-11-2017, 01:32 PM.

                Comment


                  #9
                  Chelsea,

                  Could you reproduce the issue on your side?

                  Comment


                    #10
                    Hello Harry,

                    I was able to reproduce when using True_Range or True_Value.

                    I am inquiring with development to see if these are NinjaScript properties that are used behind the scenes.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      Originally posted by NinjaTrader_ChelseaB View Post
                      Hello Harry,

                      I was able to reproduce when using True_Range or True_Value.

                      I am inquiring with development to see if these are NinjaScript properties that are used behind the scenes.

                      Is there any solution to this issue?

                      I am getting frequent complaints from users, as the strategy builder does not correctly call the enums.

                      Comment


                        #12
                        Hello Harry,

                        Thank you for your patience.

                        A fix for this item is expected in the next release of NinjaTrader 8. I do not have a release date at this time nor can I confirm that the fix will be implemented at this time.

                        Please let me know if you have any questions.

                        Comment


                          #13
                          Thank you for your answer. I will wait for the next release.

                          Comment


                            #14
                            Hello Harry,

                            NinjaTrader 8.0.12.0 has been released.

                            Please check the release notes for ID NTEIGHT-12350 which I am including a publicly available link to below.



                            If this ID is found please update to the latest version and test for the behavior.
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Strategy now compiling as expected.

                              Thank you for your feedback.

                              I have now updated NinjaTrader to version 8.0.12.0.

                              Also I have created a test strategy as before and this time it compiled as expected.

                              I am happy to confirm that the bug is fixed.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by PaulMohn, Today, 03:49 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post PaulMohn  
                              Started by inanazsocial, Today, 01:15 AM
                              1 response
                              7 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
                              2 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