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

Dynamic Enum List of Avaible Accounts

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

    Dynamic Enum List of Avaible Accounts

    Hello,

    I'm looking to get the Account size of a specific account chosen by the user. Is it possible to create an enum that gets populated when the indicator is added to the chart which the user can select from? I'm leaning towards yes, however, this may take a bit too much work. Would a user-submitted text field with the account name be a simpler and more streamlined approach to this problem?

    Thanks
    Unsuitable
    NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

    #2
    Hello Unsuitable,

    Thanks for your post.

    While this is undocumented and not officially supported, you could consider using the following TypeConverter on a string. I have attached an example which uses it.

    Code:
    [TypeConverter(typeof(NinjaTrader.NinjaScript.AccountNameConverter))]
    public string AccountName { get; set; }
    We look forward to assisting.
    Attached Files
    JimNinjaTrader Customer Service

    Comment


      #3
      Hello Jim,

      Aha that works perfectly! Quite a bit more simple than I thought it would be. This is out of the scope of the question, but will this cause compiling issues as it's using the NinjaTrader namespace?

      Thanks
      Last edited by Unsuitable; 02-23-2021, 01:14 PM.
      Unsuitable
      NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

      Comment


        #4
        Hello Unsuitable,

        I have not had issue including the example script in a DLL or compiling in Visual Studio.
        JimNinjaTrader Customer Service

        Comment


          #5
          Ok great, thanks for the help!
          Unsuitable
          NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

          Comment


            #6
            Hello Jim,

            This is more of a C# question. For the AccountName enum, could a custom value be added? For example, I would like to add "Use Custom Size" as the default value. At the moment a bool can be set to true to use a custom account size (there's a custom account size double input).

            Tried this to no avail. This is adding it at run time which I don't think is possible, but I don't necessarily want to add it at run time. Just add it as the first default value and remove the need for a bool variable.
            Code:
            AccountName.Insert(0, "Use Custom Account Size");
            Thanks
            Unsuitable
            NinjaTrader Ecosystem Vendor - Ocean Trading Indicators

            Comment


              #7
              Hello Unsuitable,

              I couldn't suggest adding an element for the selector to have it use different functionality, but I may suggest using a bool for "Use Custom Size" that disables the the Account property when checked.

              An example that shows various ways to modify property grid behavior can be found below.

              JimNinjaTrader Customer Service

              Comment


                #8
                NinjaTrader_Jim
                Originally posted by NinjaTrader_Jim View Post
                Hello Unsuitable,

                Thanks for your post.

                While this is undocumented and not officially supported, you could consider using the following TypeConverter on a string. I have attached an example which uses it.

                Code:
                [TypeConverter(typeof(NinjaTrader.NinjaScript.AccountNameConverter))]
                public string AccountName { get; set; }
                We look forward to assisting.

                Could this be done to select a saved ATM strategy?

                ​​​​​​​Thanks a lot

                Comment


                  #9
                  Hello mlprice,

                  You could make your own TypeConverter to be used with the:

                  Code:
                  [PropertyEditor("NinjaTrader.Gui.Tools.StringStandardValuesEditorKey")]
                  PropertyEditor.

                  Have a look at the attached example.
                  Attached Files
                  JimNinjaTrader Customer Service

                  Comment


                    #10
                    Awesome thanks so much

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by quantismo, 04-17-2024, 05:13 PM
                    3 responses
                    25 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by ScottWalsh, 04-16-2024, 04:29 PM
                    7 responses
                    34 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by cls71, Today, 04:45 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post cls71
                    by cls71
                     
                    Started by mjairg, 07-20-2023, 11:57 PM
                    3 responses
                    214 views
                    1 like
                    Last Post PaulMohn  
                    Started by TheWhiteDragon, 01-21-2019, 12:44 PM
                    4 responses
                    547 views
                    0 likes
                    Last Post PaulMohn  
                    Working...
                    X