![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
I realize I can't be long/short the same instrument in the same "bar"... but any reason I can't be long/short in different BarsInProgress?
ie: - Bar1, added with the Add() function... use EnterShort(). - Bar2, also added with the Add() function... use EnterLong(). My strategy seems to be having issues trying to do this, and I just want to understand whether this is a fundamental limitation, or if I just have a hidden bug somewhere. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
You cannot be literally long and short at the same time. However you can simulate it: One of the great features of NinjaTrader is its ability to manage multiple virtual positions in the same market. This allows you to manage a long and short position in the same market simultaneously. Here is how this is accomplished:
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Hi Ben,
I'm working with a custom-developed C# strategy... so not sure how to incorporate your instructions regarding ATM Strategy... Any ideas? |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Unfortunately you can't be long and short at the same time on the same instrument/position in the same NinjaScript strategy.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#5 | |
|
Senior Member
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
|
Quote:
I realize this isn't a question you're "responsible" for... but how do you think IB would behave if I had multiple strategies, that ended up trying to hold short/long positions simultaneously? I feel like I've seen it reject a BuyToCover when there weren't short shares available. Which would suggest I can't do it across multiple strategies either. I'd probably have to add another layer of code to kind of "net" together all of my strategy positions, before passing it on to IB...? |
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
They most likely would not allow you to be both long and short within the same market. One order would cancel the other one.
Ben
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Long & Short | murfinp | Strategy Development | 1 | 05-13-2009 08:56 AM |
| Different Optimization Long vs Short | 123r34 | Strategy Analyzer | 1 | 04-29-2009 02:48 PM |
| Long and short on same instrument | swandro | Strategy Analyzer | 1 | 11-03-2008 08:58 AM |
| long 1 shown short 0 | ATI user | Strategy Development | 2 | 10-09-2008 09:17 AM |
| Having long and short trades simultaneously. | Scooter1 | Miscellaneous Support | 3 | 10-08-2008 05:44 AM |