NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 05-16-2009, 03:18 PM   #1
heech
Senior Member
 
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
Default Can I be long/short simultaneously?

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.
heech is offline  
Reply With Quote
Old 05-17-2009, 01:45 AM   #2
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

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:
  • Open 2 SuperDOMs and set them both to the same market
  • Right click in on of the SuperDOMs and select the menu "Properties"
  • Set the 'ATM Strategy selection mode' parameter to "DisplaySelectedAtmStrategyOnly"
  • Repeat the last two instructions on the second SuperDOM
  • Submit a buy order to open a long position in the first SuperDOM
  • Submit a sell order to open a short position in the second SuperDOM
In addition to these instructions, I suggest reviewing the content available in our Online Help Guide specific to this topic.
NinjaTrader_Ben is offline  
Reply With Quote
Old 05-17-2009, 02:09 AM   #3
heech
Senior Member
 
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
Default

Hi Ben,

I'm working with a custom-developed C# strategy... so not sure how to incorporate your instructions regarding ATM Strategy...

Any ideas?
heech is offline  
Reply With Quote
Old 05-17-2009, 04:12 AM   #4
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Unfortunately you can't be long and short at the same time on the same instrument/position in the same NinjaScript strategy.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 05-17-2009, 12:41 PM   #5
heech
Senior Member
 
Join Date: Nov 2008
Posts: 576
Thanks: 0
Thanked 1 time in 1 post
Default

Quote:
Originally Posted by NinjaTrader_Dierk View Post
Unfortunately you can't be long and short at the same time on the same instrument/position in the same NinjaScript strategy.
Okay, understood.

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...?
heech is offline  
Reply With Quote
Old 05-18-2009, 03:39 AM   #6
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

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.
NinjaTrader_Ben is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -6. The time now is 03:17 AM.