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 > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 05-14-2008, 02:07 PM   #1
geoMEAN
Member
 
Join Date: Mar 2008
Posts: 69
Thanks: 0
Thanked 0 times in 0 posts
Question Time To Flatten (All Positions) Feature

Today I started using my new full version of NT with IB. I'm using NT to route futures day trading orders from Tradestation to IB.

I was going to use the "time to flatten" checkbox feature to flatten my futures day trading positions but then I realized that this feature would probably flatten all of my manually-entered long-term stock holdings in my IB account, so I turned off the feature a few minutes before it was going to probably cause major havok.

Am I correct in assuming that this feature will completely flatten EVERYTHING in my IB account at the time specified?

Is there a way to tell NT to only flatten the futures positions, or those initiated today?

Thank you in advance.
geoMEAN is offline  
Reply With Quote
Old 05-14-2008, 02:51 PM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Wow...good thing you disabled that since YES! your entire acccount(s) at IB would be flat.

What you can do is enable Exit on close for each strategy running.
NinjaTrader_Ray is offline  
Reply With Quote
Old 05-14-2008, 03:49 PM   #3
geoMEAN
Member
 
Join Date: Mar 2008
Posts: 69
Thanks: 0
Thanked 0 times in 0 posts
Default

Yeah that's what I thought. Glad I turned it off.

The reason I wanted to use the feature was because my strategy exits at 16:00 EST (at the close) and there tends to be a lot of slippage a few seconds before and after the exact close at 16:00, so I had set the timer to like 30 seconds because the close (15:59:30) or something like that. When I was trading my strategy manually at Mirus with the direct edition of Ninja, that's what I would do.

I suppose I could just exit at 15:55 or 16:05 (using 5 minute bars) instead of right on the 16:00 close bar, though that is not what my backtested / walked-forwarded strategy prescribes.

Thanks for the info.
geoMEAN is offline  
Reply With Quote
Old 05-14-2008, 08:37 PM   #4
mgbloomfield
Senior Member
 
Join Date: Dec 2006
Location: Seattle, Washington, USA
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

Does it depend on brokerage's technology?

For example, Patsystem only tells NinjaTrader the Account's PnL. So, "Flatten All Positions" would only flatten the trades that NinjaTrader knows about and it might not flatten all positions in the brokerage account.

Correct?
mgbloomfield is offline  
Reply With Quote
Old 05-14-2008, 09:34 PM   #5
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

Not sure I follow. NT knows all trades in our broker account and knows the actual position of your broker account and thus knows what to do to flatten out any pending position.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 05-15-2008, 12:14 AM   #6
mgbloomfield
Senior Member
 
Join Date: Dec 2006
Location: Seattle, Washington, USA
Posts: 150
Thanks: 0
Thanked 0 times in 0 posts
Default

http://www.ninjatrader-support.com/v...ing+technology

If there are 5 NT-initiated trades and 10 non-NT-initiated trades in the brokerage account, NT only knows about the 5 NT-initiated trades. According to the link above, NT only gets PnL. NT doesn't know about the non-NT-initiated trades.

Thus, when NT flattens everything, the 10 non-NT-initated trades are still open in the brokerage account.

That's what I meant.
mgbloomfield is offline  
Reply With Quote
Old 05-15-2008, 01:32 AM   #7
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

Not sure where on link below you read that. Flattening an account is driven by positions and open orders and not PnL.

NT always is aware of any open order/position in an account as it connects to this account.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 09-28-2008, 08:34 PM   #8
billitin
Senior Member
 
Join Date: Jun 2008
Posts: 146
Thanks: 0
Thanked 0 times in 0 posts
Default

Regarding stopping a strategy, I wonder if there is a way to stop a strategy and flatten position + cancel all orders associated with it only (e.g. if I have other strategies running concurrently, as well as trades placed manually outside of NT, they all should stay intact upon such a stop). I tried to use something like ExitLong( Position.Quantity ), but it flattens every single position for a given instrument. Thank you!
billitin is offline  
Reply With Quote
Old 09-29-2008, 07:29 AM   #9
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,

Sorry for the delay.

You will find examples on how to do this here:
http://www.ninjatrader-support.com/v...ead.php?t=4804
NinjaTrader_Ben is offline  
Reply With Quote
Old 09-29-2008, 12:36 PM   #10
billitin
Senior Member
 
Join Date: Jun 2008
Posts: 146
Thanks: 0
Thanked 0 times in 0 posts
Default

Great, I will check these out. Thank you Ben
billitin 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
Flatten Everything Suggestion Moog Suggestions And Feedback 5 02-04-2008 06:49 AM
Time to flatten vs. Exit on close dtf139 Automated Trading 1 01-11-2008 07:11 AM
Flatten ALL - closes all positions, not just those open/managed by NT zoltran Miscellaneous Support 7 03-23-2007 07:00 PM
Options Misc Flatten bmaltz SuperDOM and other Order Entry Windows 3 02-02-2007 10:48 AM
FLATTENALL does not flatten non-AT created positions in NT ... ? mkundi Automated Trading 1 06-26-2005 11:34 PM


All times are GMT -6. The time now is 05:23 AM.