Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Property Attributes

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

    Property Attributes

    Hi,


    I have an indicator (B) which I call from another indicator (A). In the indicator being called, B, I have a property decorated with the ReadOnly attribute. It is NOT decorated with the [NinjaScript] attribute. I have noticed that in the indicator doing the calling, A, intellisense shows that the read only property of B needs to be specified as part of the call. Is there a way to prevent this?

    #2
    Hello Zeos6,

    Thank you for your note.

    So I may best assist would you be able to put together a quick code sample or upload indicator A and B?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Really AlanP. This is a quick question that hardly needs a code sample.

      Comment


        #4
        Hello Zeos6,

        Could you confirm if you are in fact not using the [NinjaScriptProperty] attribute on your property for indicator A?

        The [NinjaScriptProperty] attribute would be the attribute used for generating overloads in the NinjaScript generated code and would determine what parameters are needed in an indicator call. The property will still be visible in the Indicators dialog property grid, though. The [ReadOnly(true)] attribute should disable the setter and prevent interaction with the property in the property grid.

        Setting up a demo of your case, we can see the effect the [NinjaScriptProperty] attribute has.

        Demo: https://www.screencast.com/t/lGv3pcdh

        NinjaScriptProperty attribute - https://ninjatrader.com/support/help...yattribute.htm

        Please let me know if we can be of further assistance.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi Jim,


          Thank you for your reply. I am NOT using the [NinjaScriptProperty] attribute on the property decorated with the [ReadOnly(true)] attribute.

          EDIT: The Strange thing is that in the compiled version of the indicator being called the partial class in the NT generated code still shows the property even though it is NOT marked with [NinjaScriptProperty].


          EDIT2: My code related to this issue looks almost identical to your demo except that my read only variable is a string.
          Last edited by Zeos6; 06-26-2018, 10:01 AM.

          Comment


            #6
            Hello Zeos6,

            I see the same behavior in the demo as I do when using a string. I've attached the test scripts so you may test what I am verbatim. Do you still see differing results following what I do in the demo? Keep in mind we will have to wait for compilation to finish before we can expect Inteliprompt to change.

            If you are still seeing the old NinjaScript generated code persist, do you still encounter this issue after restarting the platform? What about deleting the NinjaScript generated code before compiling?

            Could you also verify that you are on the latest version of NinjaTrader 8, version 14.2?

            I'll be happy to assist you further.
            Attached Files
            JimNinjaTrader Customer Service

            Comment


              #7
              Hi Jim,


              1. Yes, I AM seeing the old NinjaScript generated code persist.
              2. I still encounter this issue after restarting the platform.
              3. When I delete the NinjaScript generated code and compile again, the same old code returns.
              4. Yes, I am using NT8 release 14.2.


              I will check your files. Thank you for sending them.

              Comment


                #8
                Hi Jim,

                I have isolated the problem and I am able to reproduce it, even using your sample code. However, I am not sure what is happening. Doesn't really make sense to me.

                In your IndiA properties...

                1. If you use...
                Code:
                        #region Properties
                        //Set NinjaScriptProperty to ...
                        [ReadOnly(true)]
                        //[NinjaScriptProperty]
                        [Display(Name="Period", Order=1, GroupName="Parameters")]
                        public string Period
                        { get; set; }
                
                        [Browsable(false)]
                        [XmlIgnore]
                        public Series<double> MyPlot
                        {
                            get { return Values[0]; }
                        }
                        #endregion
                This works as expected.

                2. If you use...
                Code:
                        #region Properties
                        /*
                        //Set NinjaScriptProperty to ...
                        */
                        [ReadOnly(true)]
                        //[NinjaScriptProperty]
                        [Display(Name="Period", Order=1, GroupName="Parameters")]
                        public string Period
                        { get; set; }
                
                        [Browsable(false)]
                        [XmlIgnore]
                        public Series<double> MyPlot
                        {
                            get { return Values[0]; }
                        }
                        #endregion
                This works as expected.

                BUT if you use...
                Code:
                        #region Properties
                        /*
                        Set NinjaScriptProperty to ...
                        */
                        [ReadOnly(true)]
                        //[NinjaScriptProperty]
                        [Display(Name="Period", Order=1, GroupName="Parameters")]
                        public string Period
                        { get; set; }
                
                        [Browsable(false)]
                        [XmlIgnore]
                        public Series<double> MyPlot
                        {
                            get { return Values[0]; }
                        }
                        #endregion
                This creates the issue.

                It therefore appears that the compiler reads and executes NinjaScriptProperty on the property even if it is a part of a comment block, and even if it is not enclosed within square parentheses. Your thoughts on this would be greatly appreciated. Thank you for your help. I really do appreciate it.

                Comment


                  #9
                  Hello Zeos6,

                  It looks like a bug with NinjaScript generated code. I've reported it further and will update this post as this gets further reviewed. In the meantime, I would suggest to avoid using block comments before a property where you wish to not use the [NinjaScriptProperty] attribute.
                  JimNinjaTrader Customer Service

                  Comment


                    #10
                    Thanks Jim. Appreciate it.

                    Comment


                      #11
                      Hello Zeos6,

                      Development has confirmed this as a bug and has assigned the ticket ID NTEIGHT-12964 to track this issue. The ticket ID number can be referenced in the Release Notes page of the help guide when a new version of NinjaTrader includes a fix for the issue.

                      Release Notes - https://ninjatrader.com/support/help...ease_notes.htm
                      JimNinjaTrader Customer Service

                      Comment


                        #12
                        Thanks for the update Jim. Appreciate it.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by frslvr, 04-11-2024, 07:26 AM
                        8 responses
                        111 views
                        1 like
                        Last Post NinjaTrader_BrandonH  
                        Started by stafe, 04-15-2024, 08:34 PM
                        10 responses
                        44 views
                        0 likes
                        Last Post stafe
                        by stafe
                         
                        Started by rocketman7, Today, 09:41 AM
                        3 responses
                        8 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by traderqz, Today, 09:44 AM
                        2 responses
                        5 views
                        0 likes
                        Last Post NinjaTrader_Gaby  
                        Started by rocketman7, Today, 02:12 AM
                        7 responses
                        31 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Working...
                        X