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 mattbsea, Today, 05:44 PM
        0 responses
        5 views
        0 likes
        Last Post mattbsea  
        Started by RideMe, 04-07-2024, 04:54 PM
        6 responses
        33 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Started by tkaboris, Today, 05:13 PM
        0 responses
        4 views
        0 likes
        Last Post tkaboris  
        Started by GussJ, 03-04-2020, 03:11 PM
        16 responses
        3,282 views
        0 likes
        Last Post Leafcutter  
        Started by WHICKED, Today, 12:45 PM
        2 responses
        20 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Working...
        X