Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to open two orders (positions) simultaneously in opposite direction
Collapse
X
-
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!
-
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>
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by chrischongpdx, Today, 09:39 PM
|
0 responses
7 views
0 likes
|
Last Post Today, 09:39 PM | ||
Started by Mountain_cast, Today, 12:41 PM
|
2 responses
9 views
0 likes
|
Last Post Today, 08:53 PM | ||
Started by dontpanic, 04-07-2015, 04:42 AM
|
4 responses
1,322 views
0 likes
|
Last Post Today, 08:33 PM | ||
Started by algospoke, Today, 07:54 PM
|
0 responses
5 views
0 likes
|
Last Post
by algospoke
Today, 07:54 PM
|
||
Started by Rxxar, Today, 06:26 PM
|
0 responses
10 views
0 likes
|
Last Post
by Rxxar
Today, 06:26 PM
|
Comment