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 08-01-2008, 11:01 AM   #1
richa61416
Senior Member
 
Join Date: Jun 2007
Location: Anguilla
Posts: 140
Thanks: 0
Thanked 0 times in 0 posts
Default Reversing a strategy Position

If I am long a contract, and a new signal is generated by my strategy to go short, what is the correct way to go short.

Currently I use the following


ExitLong()
EnterShort()


However I believe this may be incorrect, as, I ended up Short 2 contracts, instead of one. In both the simulated strategy, and my live account strategy.
richa61416 is offline  
Reply With Quote
Old 08-01-2008, 11:27 AM   #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

All you need to call is:

EnterShort()

this will take care of closing the long and opening the short.
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-02-2008, 02:44 PM   #3
novakpetr
Junior Member
 
Join Date: Aug 2008
Posts: 1
Thanks: 0
Thanked 0 times in 0 posts
Default Reversing a position - problem with stop loss

Hello,
I would like to ask if anyone knows how to solve the problem with reversin position in case stop loss is used and I need to enter via EnterStopLimit().

My short position is closed by stop loss (correctly), but command to enter long position in the same bar is ignored (EnterLongStopLimit). I am sure that strategy coding is correct as when I use only long part, it generates correct entry signals.

Thank you for any idea how to solve it.



Quote:
Originally Posted by NinjaTrader_Ray View Post
All you need to call is:

EnterShort()

this will take care of closing the long and opening the short.
novakpetr is offline  
Reply With Quote
Old 08-02-2008, 06:27 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
Default

Please run with TraceOrders = true. I suspect you may be running into one of these Internal Order Handling Rules. Please check them out here and confirm with your logs if this is the case: http://www.ninjatrader-support.com/H...verview36.html. If not please provide the reason the TraceOrder logs provide as to why your order is ignored. Thanks
NinjaTrader_Josh 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
Entershortstop not reversing long position and vice versa verge Strategy Development 1 05-02-2008 07:42 AM
Re: Strategy Position vs. Account Position Pete S Strategy Development 1 11-14-2007 08:55 AM
Strategy Position vs. Account Position NinjaTrader_Josh Tips 0 11-12-2007 06:06 PM
Reversing Position shellers Automated Trading 3 01-19-2006 05:45 AM
Reversing a Position on Breakout or Breakdown Alfred ATM Strategies (Discretionary Trading) 1 05-10-2005 03:02 AM


All times are GMT -6. The time now is 07:32 PM.