Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

A EnterLong for two instruments

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

    A EnterLong for two instruments

    I'm creating a strategy and I would like the strategy to do an EnterLong in two different instruments when the conditions are fill.

    Is it possible that an automatic strategy can do EnterLong in two different instruments? how?

    Thank you.​

    #2
    Hello daying35,

    Thanks for your post.

    Yes, this would be possible to accomplish in a NinjaScript strategy. Note that is it not possible in a Strategy Builder strategy, only a strategy manually programmed in the NinjaScript Editor window.

    The AddDataSeries() method could be called in the script to add a secondary series.

    The primary series the script is enabled on will have a BarsInProgress index of 0 and the added secondary series will have a BarsInProgress index of 1.

    You could then call the EnterLong() method twice in your script to place orders to the primary series and secondary added series.

    To submit the order to the primary series, you would use the EnterLong() syntax that lets you specify a barsInProgressIndex argument and pass in a value of 0 for the barsInProgressIndex argument.

    To submit the order to the secondary series, you would call EnterLong() and specify a value of 1 for the barsInProgressIndex argument.

    EnterLong(int barsInProgressIndex, int quantity, string signalName)

    See the help guide documentation below for more information.

    AddDataSeries(): https://ninjatrader.com/support/help...dataseries.htm
    EnterLong(): https://ninjatrader.com/support/help.../enterlong.htm
    Working with Multi-Timeframe/Multi-Instrument NinjaScripts: https://ninjatrader.com/support/help...nstruments.htm
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X