• 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

Singleton Classes - Where do they go?

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

    Singleton Classes - Where do they go?

    I have a Singleton that I wish to use with an AddOn. I have tried several different namespaces and/or derived classes, but can't seem to find a combination that will give me good access to the "NinjaTrader.NinjaScript" features.

    It looks like this is due to the private constructor of the singleton. Once I make the constructor public the issue goes away, but then it isn't a singleton.

    Is there a derived class I don't know about that will not try to Initiate my singleton, but still fits into the architecture of NT8?

    #2
    You can place your singleton in any namespace, the namespace doesn't matter much outside code collision purposes and doesn't actually inherit or give functionality depending on where you place it. Just influences the using statements you would need to use for methods. If I was going to place a singleton I'd likely place it in my own namespace to keep my code separate to prevent collision if possible.

    I can't think of any reason why a public vs private constructor would make any difference here. What exactly are you referring to wanting to access for "good access to NinjaTrader.NinjaScript features", could you give one or two examples and I could help guide you.
    BrettNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Captain_Qwark, Today, 10:55 AM
    3 responses
    18 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by kmpc1, Today, 11:03 AM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Started by jransom, Today, 09:08 AM
    1 response
    19 views
    0 likes
    Last Post NinjaTrader_Kate  
    Started by mtamaku, Today, 09:19 AM
    0 responses
    23 views
    0 likes
    Last Post mtamaku
    by mtamaku
     
    Started by traderMNQ, Today, 09:00 AM
    4 responses
    20 views
    0 likes
    Last Post traderMNQ  
    Working...
    X