Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

[NinjaScriptProperty] attribute

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

    #16
    Originally posted by -=Edge=- View Post
    The problem comes when you export that to a compiled assembly (protected dll or not) and try to import it into another system..


    That is because of how NT generates the .cs file. It ignores all using statements that are not there by default. You will have to edit the .cs file to put in the using statement.

    Here is the long discussion about the matter, a long time ago, when this whole matter of Global Namespace pollution was raised about almost 4 years ago..

    ref: http://ninjatrader.com/support/forum...33&postcount=4

    I know that you will read the whole thread for context.

    Dangnabit, I am giving away too many of my secrets. (rolling eyes at me, not you!)

    Comment


      #17
      Originally posted by koganam View Post
      That is because of how NT generates the .cs file. It ignores all using statements that are not there by default. You will have to edit the .cs file to put in the using statement.

      Here is the long discussion about the matter, a long time ago, when this whole matter of Global Namespace pollution was raised about almost 4 years ago..

      ref: http://ninjatrader.com/support/forum...33&postcount=4

      I know that you will read the whole thread for context.

      Dangnabit, I am giving away too many of my secrets. (rolling eyes at me, not you!)
      It seems to me that there is a bug report / feature request for the Magic Code stuff -- we need a way to inform the Magic Code what "using" statements are needed when its code is in a separate file. The current way is too mysterious for the uninitiated, and pretty annoying for the cognoscenti.

      --EV

      Comment


        #18
        Originally posted by ETFVoyageur View Post
        It seems to me that there is a bug report / feature request for the Magic Code stuff -- we need a way to inform the Magic Code what "using" statements are needed when its code is in a separate file. The current way is too mysterious for the uninitiated, and pretty annoying for the cognoscenti.

        --EV
        Absolutely agreed. Do not hold your breath: they seem pretty determined that the only way to code is to pollute the Global Namespace.

        Comment


          #19
          Originally posted by koganam View Post
          Absolutely agreed. Do not hold your breath: they seem pretty determined that the only way to code is to pollute the Global Namespace.
          I hope you are being to negative.

          They seem to be trying to provide quality code and a quality development environment. Basically forcing their users into the global namespace is the antithesis of providing a quality environment. Polluting the global namespace is Evil.

          Let's hope that whoever from NT reads this will see to it that we get a way to let the Magic Code know what "using" statements it will need for it to compile independently.

          --EV

          Comment


            #20
            Hello!

            I have a question about [NinjaScriptProperty].

            I have two parameters in my code:
            Code:
            [Range(1, int.MaxValue), NinjaScriptProperty]
            [Display(Name = "Parameter1", GroupName = "NinjaScriptParameters", Order = 0)]
            public int Parameter1
            { get; set; }
            
            [Range(1, int.MaxValue), NinjaScriptProperty]
            [Display(Name = "Parameter2", GroupName = "NinjaScriptParameters", Order = 1)]
            public int Parameter2
            { get; set; }
            In the UI they are showed in the correct order. "NinjaScript generated code" also uses them in the correct order. But on the chart their data are displayed in the reverse order, like:
            MyIndy(ES 12-15(60 Minute), P2, P1)
            where P2 and P1 are the values of 'Parameter2' and 'Parameter1'.

            Is it a bug or a feature? How can I change the order of displaying the parameters on the chart?

            Comment


              #21
              Originally posted by quicktrick View Post
              I have a question about [NinjaScriptProperty].
              This should not be occurring, and I am not seeing the same thing on my end just by plugging these properties into an existing indicator. Can you please share a script with me which is reliably producing the issue on your end? That may help me to pin the issue down on my end.
              Dave I.NinjaTrader Product Management

              Comment


                #22
                Originally posted by NinjaTrader_Dave View Post
                This should not be occurring, and I am not seeing the same thing on my end just by plugging these properties into an existing indicator. Can you please share a script with me which is reliably producing the issue on your end? That may help me to pin the issue down on my end.
                Hello Dave,

                I made some tests and found that 'Order' attribute doesn't work for strings displaying on a chart, NT sorts the parameters alphabetically.

                I've attached the code.
                Attached Files

                Comment


                  #23
                  Thank you. The way that the values are ordered in your script is as expected. As you noted, they are sorted alphabetically, and I was able to confirm that this is the intended behavior. However, it appears that you were seeing something different in your previous example, as I would expect Parameter1 to be listed before Parameter2 alphabetically (as it was for me when I tested using those property names).

                  Do you find that the properties are not listed alphabetically when the only difference in their names is a number, by chance? For example, if you tried "Test2" and "Test3", would Test3 be listed first on your end?
                  Dave I.NinjaTrader Product Management

                  Comment


                    #24
                    Intended behavior? Really? I'm disappointed. That's illogical. You introduce the 'Order' attribute to make it possible for user to set the desired order in the properties list, but you don't use the same thing in the string displayed on the chart. That's silly. Please, talk it over with NT8's developing team. It's a feature request.

                    Originally posted by NinjaTrader_Dave View Post
                    Do you find that the properties are not listed alphabetically when the only difference in their names is a number, by chance? For example, if you tried "Test2" and "Test3", would Test3 be listed first on your end?
                    No.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by frankthearm, Today, 09:08 AM
                    5 responses
                    14 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Started by jeronymite, 04-12-2024, 04:26 PM
                    3 responses
                    43 views
                    0 likes
                    Last Post jeronymite  
                    Started by yertle, Today, 08:38 AM
                    5 responses
                    16 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by adeelshahzad, Today, 03:54 AM
                    3 responses
                    19 views
                    0 likes
                    Last Post NinjaTrader_BrandonH  
                    Started by bill2023, Yesterday, 08:51 AM
                    6 responses
                    27 views
                    0 likes
                    Last Post NinjaTrader_Erick  
                    Working...
                    X