• 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 zacharydw00, Today, 10:19 PM
      0 responses
      2 views
      0 likes
      Last Post zacharydw00  
      Started by chafan11, Today, 09:28 PM
      0 responses
      5 views
      0 likes
      Last Post chafan11  
      Started by GreenspanAlec, Today, 05:32 PM
      0 responses
      7 views
      0 likes
      Last Post GreenspanAlec  
      Started by mrwarkhan, Today, 03:45 PM
      0 responses
      16 views
      0 likes
      Last Post mrwarkhan  
      Started by momchi, Yesterday, 10:09 PM
      3 responses
      12 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Working...
      X