Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How to open two orders (positions) simultaneously in opposite direction
Collapse
X
-
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.
-
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!
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by leunating, Today, 12:56 AM
|
2 responses
17 views
0 likes
|
Last Post
by leunating
Today, 10:08 PM
|
||
Started by tmk-c, 07-19-2017, 11:29 PM
|
6 responses
1,687 views
0 likes
|
Last Post Today, 09:27 PM | ||
Started by Trader4Life, Today, 09:20 PM
|
0 responses
5 views
0 likes
|
Last Post
by Trader4Life
Today, 09:20 PM
|
||
Started by WileCoyote, Today, 08:26 PM
|
0 responses
8 views
0 likes
|
Last Post
by WileCoyote
Today, 08:26 PM
|
||
Started by madankumars, 11-18-2019, 11:12 AM
|
10 responses
176 views
0 likes
|
Last Post Today, 06:56 PM |
Leave a comment: