NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM 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 01-28-2011, 01:10 PM   #1
kenb2004
Senior Member
 
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
Default How to supersede Ninja ProfitTargets and StopLosses

I have a strategy that uses NinjaTrader ProfitTargets and StopLosses. When I'm in a DownTrend I'm taking short positions and when in UpTrend taking long positions. The problem I'm having is that when in a short position and the Trend changes to UpTrend I have a Exit Action that will not supersede the StopLoss. My exit names the "From Entry" of the sell order but will not exit until stopped out. How can I make MySellExit supersede the NinjaTrader StopLoss?

Thanks
kenb2004 is offline  
Reply With Quote
Old 01-28-2011, 01:32 PM   #2
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

kenb2004,

What do you mean by supercede? You want to use your explicit exit instead of your stop loss now? Under such a scenario I would suggest you instead of sending a new explicit exit order, but instead to just modify your stop loss to wherever you desire it to be instead. To modify it, just call SetStopLoss() again with the new price you want it at. Be aware that you will want to reset it back to the original level prior to your next entry.

Please see this reference sample: http://www.ninjatrader.com/support/f...ead.php?t=3222
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-28-2011, 01:52 PM   #3
kenb2004
Senior Member
 
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
Default

Yes, I want to exit at the first close after the UpTrend signal INSTEAD OF (supersede) waiting to get stopped out by the StopLoss order. I would rather use my "explicit exit instead of changing the stop loss". Is this possible??
Thanks
kenb2004 is offline  
Reply With Quote
Old 01-28-2011, 02:01 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

To do that all you would need to do is to just call ExitLong() whenever your conditions to exit are true and it will do so.
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-28-2011, 02:23 PM   #5
kenb2004
Senior Member
 
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
Default

Your right ExitLong() does work but what about ExitLongLimit()? Is it possible to make this work INSTEAD OF a StopLoss? Say from current close -1 tick...
Thanks
kenb2004 is offline  
Reply With Quote
Old 01-28-2011, 02:27 PM   #6
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

Correct, it is because doing so would violate one of the internal order handling rules as outlined in this article: http://www.ninjatrader.com/support/h...d_approach.htm
NinjaTrader_Josh is offline  
Reply With Quote
Old 01-28-2011, 02:54 PM   #7
kenb2004
Senior Member
 
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
Default

I'm sorry, I don't understand? You said, "correct" when I asked: "Is it possible to make this (ExitLongLimit()) work INSTEAD OF a StopLoss? Say from current close -1 tick"...and then you said it "would violate one of the internal order handling rules".

So bottom line I can use an ExitLong() but NOT an ExitLongLimit() to supersede a StopLoss order? Is this correct???
kenb2004 is offline  
Reply With Quote
Old 01-28-2011, 02:57 PM   #8
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

Correct, ExitLong() will work even if you have a Set() method in place and ExitLongLimit() will not.
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
Change from Sim Ninja to Live Trading Ninja Eoghan O Sullivan Installation and Licensing 1 02-23-2010 10:31 AM
backtesting trailing stoplosses Eddy-2d Strategy Analyzer 3 02-03-2010 08:27 AM
orders sent from one ninja to many ninja on lan-internet alleillo Miscellaneous Support 1 12-23-2008 11:49 PM
Can Ninja script print into Ninja Log/Trace file? maxima General Programming 2 05-24-2008 04:48 PM
Ninja silmulation and Ninja standard gretrader Installation and Licensing 3 10-24-2007 03:34 AM


All times are GMT -6. The time now is 11:45 PM.