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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    47 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X