Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Add Simultaneous Position on Secondary Asset

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

    Add Simultaneous Position on Secondary Asset

    Hello,

    I am running a script on ES and at the time I am placing a position on it I want to place a position simultaneously on MES. I would prefer if there was a way to do that without having to use MES as a Secondary Data Series, since I dont need to process MES bars at all in the strategy.

    I just want to place the position on it.

    If you could also specify how to place Stop Loss and Take Profit on MES this way as well as modify them, I would greatly appreciate it.

    Thanks in advance.

    #2
    Hello renosdim01,

    Welcome to the NinjaTrader forums!

    In real-time only you can submit orders through an account object through the addon approach to a different instrument without having to add a data series.
    Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


    This cannot be backtested and will not work in historical, and also will not cause the strategy position or order methods to update (OnOrderUpdate(), OnExecutionUpdate()).


    If you want the secondary instrument orders to backtest-able you would need to add an additional series with AddDataSeries().
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for helping so far,

      You gave me the function to enter the position. Can you give me also the function for:

      - Closing the position on MES ( manually )
      - Modifying a stop order ( placing it at a different price )
      - Cancelling all stop or limit orders that have not been filled yet on MES.

      Also, for adding MES as a data series do I specify "MES MAR25" for instrument name or "MES 03-25"

      Thanks Again

      Comment


        #4
        Hello renosdim01,

        "Closing the position on MES ( manually )"

        To manually close a position place a manual market order with the same contract quantity in the opposite direction of the position.
        If you are long 5 place a sell market order of 5.

        "Modifying a stop order ( placing it at a different price )"

        Save the order object to a variable during the Account.CreateOrder() process.
        Set the <order>.StopPriceChanged property of the order to a valid price.
        Use <account>.Change() and supply the variable holding the order.
        Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.


        "Cancelling all stop or limit orders that have not been filled yet on MES."

        Loop through the <account>.Orders.ToList() collection and check the <order>.Instrument and <order>.Account match the desired instrument and account.
        Check the <order>.OrderState is OrderState.Working or OrderState.Accepted.
        Use <account>.Cancel() and supply the variable holding the order.
        Join the official NinjaScript Developer Community for comprehensive resources, documentation, and community support. Build custom indicators and automated strategies for the NinjaTrader platforms with our extensive guides and APIs.



        "for adding MES as a data series do I specify "MES MAR25" for instrument name or "MES 03-25""

        This would depend on the Symbology you've set your account to.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        559 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        546 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X