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

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 traderqz, Today, 12:06 AM
        3 responses
        6 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by RideMe, 04-07-2024, 04:54 PM
        5 responses
        28 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by f.saeidi, Today, 08:13 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by DavidHP, Today, 07:56 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by kujista, Today, 06:23 AM
        3 responses
        11 views
        0 likes
        Last Post kujista
        by kujista
         
        Working...
        X