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.
        https://ninjatrader.com/support/help...inprogress.htm

        You can also specify which instrument to place the order to with the BarsInProgressIndex overload.
        EnterLong(int barsInProgressIndex, int quantity, string signalName)
        https://ninjatrader.com/support/help.../enterlong.htm

        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.
        https://ninjatrader.com/support/foru...245#post712245
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by mattdowns1234, Yesterday, 06:57 PM
        0 responses
        14 views
        0 likes
        Last Post mattdowns1234  
        Started by dgee949, Yesterday, 06:26 PM
        0 responses
        24 views
        0 likes
        Last Post dgee949
        by dgee949
         
        Started by dgee949, Yesterday, 05:58 PM
        0 responses
        30 views
        0 likes
        Last Post dgee949
        by dgee949
         
        Started by thepcmd, Yesterday, 05:14 PM
        0 responses
        34 views
        0 likes
        Last Post thepcmd
        by thepcmd
         
        Started by xmess777, Yesterday, 04:58 PM
        0 responses
        23 views
        0 likes
        Last Post xmess777  
        Working...
        X