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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    53 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X