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 > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 07-07-2008, 06:06 AM   #1
jmreal
Junior Member
 
Join Date: May 2008
Posts: 12
Thanks: 0
Thanked 0 times in 0 posts
Default Reverse position with only one order

I have programmed a strategy with the wizard that goes long (EnterLong) when the price crosses over a simple average, and reverse to short (EnterShort) when the price crosses below.

If the strategy is long and the price crosses below the average, then Ninja sends two orders, one to close long and another to open a short position.

Is there any way to make Ninja send only one order to reserve? I mean sending one order selling two contracts in stead of two orders selling one.

Thank you very much.
jmreal is offline  
Reply With Quote
Old 07-07-2008, 06:29 AM   #2
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

You likely closed the position by an explicit exit order which you should not do. Just issue the entry order for the opposite side and NT will close the current position. See also SampleMACrossOver strategy which does exactly what you are looking for.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 07-10-2008, 05:50 AM   #3
jmreal
Junior Member
 
Join Date: May 2008
Posts: 12
Thanks: 0
Thanked 0 times in 0 posts
Default

No, the strategy works correctly. The only problem I have is the way to do the reversal.

I have the same problem with the SampleMACrossOver strategy. For example, if the strategy is one contract long and the fast SMA crosses below the slow, then the strategy reverses to short, so Ninja sends two orders: sell one contract to close long position, and sell one contract to open short position.

I would prefer that Ninja sent only one order: sell two contracts to reverse.

żIs there any way to do it?
jmreal is offline  
Reply With Quote
Old 07-10-2008, 06:20 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

>> żIs there any way to do it?
Unfortunately not.
NinjaTrader_Dierk 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
Coding a reverse order w/ only enough margin for 2 contracts insomniac Strategy Development 8 04-08-2008 06:59 AM
need to reverse position in NinjaScript strategy jammy page General Programming 6 11-06-2007 07:31 AM
Easy questions - superdom single-click entry, Reverse limit order Steveinvest Miscellaneous Support 6 05-16-2007 06:58 AM
Reverse Strategy / Position Torso Automated Trading 2 02-17-2006 04:21 AM
2 order but can you add 2 position strategies? underground Automated Trading 2 04-28-2005 05:47 PM


All times are GMT -6. The time now is 08:40 AM.