Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Running strategy across multiple instruments simultaneously

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

    Running strategy across multiple instruments simultaneously

    I've gotten pretty proficient at creating strategies in strategy builder but I have not figured out how to get the strategies to communicate across different instruments. For instance, I'd like to have a strategy (or set of strategies) running in ES, NQ, YM and RTY simultaneously...but I don't want entries placed in more than one of these instruments. So once a strategy is triggered and an order placed in ES (as an example), I don't want any orders placed in NQ, YM or RTY until the ES strategy has completed running.

    I assume this could be handled with a "global variable" or whatever it's called in C#. I have some programming experience and have considered diving deep into C# to learn how to do this but for this one small issue, it's seems like overkill.

    Thanks for any help in advance.
    Charlie

    #2
    Create a lock file.

    Use folder "NinjaTrader 8/tmp", since this folder is guaranteed to be
    cleared out when starting NinjaTrader -- which guarantees you the
    lock file doesn't exist -- meaning the first strategy to acquire the lock
    is guaranteed to succeed.

    I've used this technique and it works great.

    Comment


      #3
      Good reading here.

      Comment


        #4
        Hello cbarfieldengr,

        Welcome to the NinjaTrader forums!

        The Strategy Builder will only allow placing orders to the primary series. It does not allow placing orders to an added series.

        With an unlocked script, you can require BarsInProgress be equal to the index of the series you want to place orders to in the condition.


        You can also specify which instrument to place the order to with the BarsInProgressIndex overload.
        EnterLong(int barsInProgressIndex, int quantity, string signalName)


        This would be if one strategy placed orders to all instruments added with AddDataSeries.

        Strategy instances are not designed to communicate with each other. Writing to a file is one way to have scripts communicate. Static properties would be another, but is not officially supported by NinjaTrader.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        90 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        137 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        120 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        69 views
        0 likes
        Last Post PaulMohn  
        Working...
        X