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

Opening Orders on a different Instrument

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

    Opening Orders on a different Instrument

    Hi,

    I have a strategy based on YM futures. I get entry and exit signals from this strategy which is attached to the YM chart, but I only want to open orders on the MYM due to smaller capital requirements. I saw that you can add another data series, but that is not what I require. To explain more simply:

    1) Strategy finds entry / exit signals on the YM chart
    2) I want to enter into positions for the MYM based on the above signals.
    3) Strategy is attached to the YM chart, and I need to open positions on the MYM instrument.

    Thanks in advance!

    #2
    Hello vonboettichert,

    Thank you for your post.

    This would, in fact, require an additional data series. I'd suggest making MYM the primary data series, and YM the secondary series so you can see the trades when you apply the strategy to a chart.

    I'm attaching a simple Strategy Builder strategy that places trades on MYM based YM data. Note that this needs to be run on an MYM chart. I suggest both checking it out in the Builder and also unlocking the code so you can see the syntax necessary.

    Also, here is a link to our help guide that goes over Multi-Instrument strategies:

    https://ninjatrader.com/support/help...nstruments.htm

    Please let us know if we may be of further assistance to you.
    Attached Files
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      I am doing something similar. My strategy ran as expected on Stock Instruments. I added additional data for MNQ 09-22 to create condition sets for Exits and Entries of the Primary Instrument.

      When backtesting most of my trades are on the primary, but I have a few random trades on the Secondary MNQ instrument

      My entry order is as follows\

      EnterLong(Convert.ToInt32(DefaultQuantity), @"Long1");

      Update:
      I was able to avoid the wrong instrument by adding the following to all condition sets for Entries

      && (BarsInProgress == 0)

      Thanks
      Last edited by DTSSTS; 08-27-2022, 12:40 PM.

      Comment


        #4
        Hello DTSSTS,

        When you add a series with AddDataSeries() all series will update OnBarUpdate().

        Whichever BarsInProgress is updating in OnBarUpdate() will be the default for price series and where orders are sent, unless the barsInProgressIndex is specified with the order method.

        EnterLong(int barsInProgressIndex, int quantity, string signalName)


        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kulwinder73, Today, 10:31 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by RookieTrader, Today, 09:37 AM
        3 responses
        15 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by terofs, Yesterday, 04:18 PM
        1 response
        24 views
        0 likes
        Last Post terofs
        by terofs
         
        Started by CommonWhale, Today, 09:55 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Gerik, Today, 09:40 AM
        2 responses
        8 views
        0 likes
        Last Post Gerik
        by Gerik
         
        Working...
        X