Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multiple instances of same strategy in the same chart

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

    Multiple instances of same strategy in the same chart

    Hi there,

    I am running multiple instances of the same strategy in one single chart ; eventually, each strategy instance will manage a separate target, but for now they are all strictly identical.

    This strategy makes use of an indicator I developed myself. It is very complex, uses a lot of cpu & memory, and for that reason I was hoping that Ninja would only create one instance of it and it would be shared by the various instances of the strategy running in the chart.

    However, it appears (by looking at the Indicators form, after turning on several instances of that same strategy) that Ninja does create one instance of the indicator per instance of the strategy.

    What should I do in order to truly share one instance of the indicator between several instances of my strategy?

    Thanks in advance
    Dominique

    #2
    Hello,

    Thanks for the forum post.

    You are correct each indicator is hosted inside of the calling strategy.

    NinjaTrader would not support cross communication between instantiated strategy or indicator classes.

    Unsupported suggestion would be for you to code either your own public class that does not derive from the strategy or indicator base classes. This way you have your own class you can then instantiate it once and use that instantiated class in your code in multiple locations. You would need to figure out the scope and everything but should work and this would require that this class exist so you would need to make sure the indicator is started up first before the strategies that access it.

    The other way you could do this is to have one indicator that does the heavy number crushing and then write to a text file and then read it back in is another suggestion that could be tried..

    Whichever one is easier for you to do if you needed to save the CPU cycles here you would need to do some custom coding.

    -Brett
    BrettNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    650 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    574 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    577 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X