• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dictionary as input/property

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

    Dictionary as input/property

    Is it possible to have `Dictionary` as the input?
    I've tried :

    Code:
    [TypeConverter(typeof(ExpandableObjectConverter))]
    public Dictionary<string, double> smth = new Dictionary<string, double>(){  {"start", 43.3}.  {"end", 81.03}  };
    but it doesnt show up any custom window to see/change the values.. I remember in NT7, it showed up something when Dictionary was used as input..

    #2
    Hi ttodua thanks for your post.

    I'm not sure if that can be done. I will ask a colleague to take a look tomorrow and we will reply then.

    Thanks in advance for your patience.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hello ttodua,

      It looks like you had asked a similar question before and had received the answer to this question:
      https://ninjatrader.com/support/foru...in-user-inputs

      The answer is the same as your other post, a type converter can be used for that purpose. To expand on the other answer, if you are looking at the sample it uses an IList as its collection, you could in theory use any type of collection so long as you use a type converter to control it similar to the sample.

      Type converters are a part of standard C# and are not specific to NinjaScript so there is very limited information on that topic in contrast to NinjaScript. You can see the linked sample for a working example in NinjaScript or also research Type Converters online to gather more details here.

      The type converter "ExpandableObjectConverter" could not be used for this purpose, this type is used to expand a class and its properties as a sub node in the property grid. To display a list or a collection of items would require the concepts from the sample here: https://ninjatrader.com/support/foru...havior?t=97919

      Please let me know if I may be of additional assistance.

      JesseNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by MojoJojo, Today, 07:24 AM
      0 responses
      2 views
      0 likes
      Last Post MojoJojo  
      Started by franco12364, Yesterday, 04:22 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChrisSch  
      Started by aaadetos, Today, 06:24 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_PatrickG  
      Started by ben_ocean11, Yesterday, 08:10 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChrisSch  
      Started by stueepto, Today, 06:11 AM
      0 responses
      1 view
      0 likes
      Last Post stueepto  
      Working...
      X