Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to open two orders (positions) simultaneously in opposite direction

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

    How to open two orders (positions) simultaneously in opposite direction

    Can I open two positions simultaneously in opposite direction for two different instruments? For instance, if a buy order is placed for a symbol ABC, the system will automatically place a sell order for symbol XYZ (at the same time). Thanks for all your help!

    #2
    Hello Cryptontrader,

    Thanks for your post.

    Yes, it would be possible to submit a long order to one instrument and a short order to another instrument.

    To do so, you could add an additional data series to that script for the instrument you want to submit the second order to by using AddDataSeries(). After adding the secondary data series, you could create logic in your script that submits long orders to the primary data series (data series the script is enabled on) and short orders to the secondary added data series.

    You would specify the barsInProgressIndex argument when calling your Entry order to submit the order to the secondary series. For example, you would pass a barsInProgressIndex argument of 1 to submit the order to the first added data series in the script.

    EnterLong(int barsInProgressIndex, int quantity, string signalName)
    EnterShort(int barsInProgressIndex, int quantity, string signalName)

    Please see the help guide documentation and reference sample linked below for more information.

    Working with Multi-Timeframe / Multi-Instrument NinjaScripts: https://ninjatrader.com/support/help...nstruments.htm
    AddDataSeries(): https://ninjatrader.com/support/help...=adddataseries

    Note that you cannot submit a long and short order on the same instrument and same account. See the forum thread below for more information about submitting opposite orders to the same instrument and same account.

    https://ninjatrader.com/support/foru...tures-contract

    Let me know if I may assist further.
    Last edited by NinjaTrader_BrandonH; 11-30-2022, 08:29 AM.
    <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 DeskTroll, Today, 12:09 PM
    3 responses
    22 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by Pabulon, 12-02-2024, 03:42 PM
    14 responses
    90 views
    0 likes
    Last Post Pabulon
    by Pabulon
     
    Started by tfa2806trader, Today, 12:04 PM
    10 responses
    25 views
    0 likes
    Last Post tfa2806trader  
    Started by trdninstyle, 11-26-2024, 12:23 PM
    62 responses
    186 views
    0 likes
    Last Post trdninstyle  
    Started by lorien, 08-08-2021, 07:33 AM
    12 responses
    721 views
    0 likes
    Last Post AndyM871  
    Working...
    X