Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cannot access class SynchronizedKeyedCollection in NinjaTrader Editor

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

    Cannot access class SynchronizedKeyedCollection in NinjaTrader Editor

    It is my understanding that NinjaTrader 8 is based on .NET Framework 4.5.

    I am trying to create a SynchronizedKeyedCollection object within my indicator, but I am unable to access this class, even though the directive "using System.Collections.Generic" is present in my source code.

    According to https://docs.microsoft.com/en-us/dot...tframework-4.5 this class should have been accessible.
    Does NinjaTrader Editor limit the number of classes which can be used even though the entire namespace is referenced?

    Thanks!

    #2
    Hello MarianApalaghiei,

    Thank you for the post.

    One note about the MSDN documents is the Assembly it lists at the top.

    SynchronizedKeyedCollection<K,T> Class
    Definition
    Namespace:
    System.Collections.Generic
    Assembly:
    System.ServiceModel.dll
    In this case it uses an assembly which is not referenced yet. While this is part of .net, you need to let NinjaTrader know you want to use that part.

    For system references I generally suggest editing the config file. This allows you to use the same standard formatting that is used with the other .net references to acquire them from the GAC (global assembly cache). Other references you would generally use the Right click -> References menu from the NinjaScript editor and place the .dll in the bin/custom folder.

    To do this you would do the following:
    • Exit NT8
    • Open the folder: Documents\NinjaTrader 8
    • Make a copy of your Config.xml file before editing it
    • Open the Config.xml in notepad or a basic text editor, not MSword.
    • You will see lines like the following:
    <string>System.Xaml.dll</string>
    <string>System.Xml.dll</string>
    <string>System.Xml.Linq.dll</string>
    • Add the reference you want to the list so it looks the same as the other entries:
    <string>System.Xml.Linq.dll</string>
    <string>System.ServiceModel.dll</string>
    • Make sure not to add anything extra to the file, just one line of text below the other references like above.
    • Start NT8 and recompile.
    If you don't feel comfortable editing the config file, please reach out to our platformsupport[at]ninjatrader.com email.


    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    82 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    43 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    68 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    56 views
    0 likes
    Last Post CarlTrading  
    Working...
    X