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 Jon17, Today, 04:33 PM
      0 responses
      1 view
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      4 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Started by alifarahani, Today, 09:40 AM
      6 responses
      41 views
      0 likes
      Last Post alifarahani  
      Started by Waxavi, Today, 02:10 AM
      1 response
      20 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Working...
      X