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

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:


      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 arvidvanstaey, Today, 02:19 PM
      4 responses
      11 views
      0 likes
      Last Post arvidvanstaey  
      Started by samish18, 04-17-2024, 08:57 AM
      16 responses
      61 views
      0 likes
      Last Post samish18  
      Started by jordanq2, Today, 03:10 PM
      2 responses
      9 views
      0 likes
      Last Post jordanq2  
      Started by traderqz, Today, 12:06 AM
      10 responses
      18 views
      0 likes
      Last Post traderqz  
      Started by algospoke, 04-17-2024, 06:40 PM
      5 responses
      48 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X