NinjaTrader Support Forum  

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 03-15-2009, 01:09 PM   #1
kcsystemtrader
Member
 
Join Date: Dec 2008
Location: Kansas City
Posts: 90
Thanks: 0
Thanked 2 times in 2 posts
Default Modify ExitLongStop Order

Upon entering a long position, I set an ExitLongStop order through the OnExecution method. Once a certain profit level is reached, I am trying to modify that ExitLongStop order (basically my own trailing stop logic).

When I reach that profit level I send another ExitLongStop command with a new Entry Signal, i.e.

Original Stop Order (placed in OnExecution):
StopOrder1 = ExitLongStop(1, true, execution.Order.Filled, Position.AvgPrice - StopTarget1, "Original Stop Loss", "Buy");

After profit level reached, modify stop order (placed through OnBarUpdate):
StopOrder1 = ExitLongStop(1,true,StopOrder1.Quantity, Position.AvgPrice, "Breakeven", "Buy");

I'm using a new 'string signalName' for the same 'StopOrder1'. This is creating an additional ExitLongStop order leaving the "Original Stop Loss" order still in tact (and then 2 stop loss orders outstanding for the same position). I would think since I said 'StopOrder1' again, it would have just modified the stop order, not create a new one (Like SetStopLoss works).

Do I have to manually cancel the 1st ExitLongStop order when I send the second ExitLongStop order statement, or is there a way to modify the 1st order while changing the signalName so I can visually see the stop was adjusted? Thanks,

kc
Last edited by kcsystemtrader; 03-15-2009 at 01:12 PM.
kcsystemtrader is offline  
Reply With Quote
Old 03-16-2009, 04:53 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

Hi kc, this should be possible by simply using the same signal names as in your first stop order, then you would modify the already placed one.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 03-16-2009, 01:42 PM   #3
kcsystemtrader
Member
 
Join Date: Dec 2008
Location: Kansas City
Posts: 90
Thanks: 0
Thanked 2 times in 2 posts
Default

Quote:
Originally Posted by NinjaTrader_Bertrand View Post
Hi kc, this should be possible by simply using the same signal names as in your first stop order, then you would modify the already placed one.
Yeah, I thought that would work, but I wanted it to be setup so that the Exit signal name provided some information about the exit (so needed different signal names). I was able to get it to do what I wanted, but I did have to create new (uniquely named) stop orders and manually cancel the old stop orders in order to get it to work right. Thanks,

kc
kcsystemtrader is offline  
Reply With Quote
Old 03-16-2009, 01:51 PM   #4
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Glad you got this resolved.
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
How to modify an order from a strategy? maxpi Strategy Development 8 07-14-2010 07:32 AM
ExitLongStop and ExitShortStop instead of SetStopLoss stefy Strategy Development 1 12-17-2008 12:25 PM
Bug in TIF Day ExitLongStop Orders heech Strategy Development 8 12-10-2008 10:51 AM
ExitLongStop not executed! sammano Strategy Development 5 11-23-2008 01:08 PM
ExitLongStop, ExitLongLimit and OCO bigtrade5 Strategy Development 27 05-16-2008 04:58 AM


All times are GMT -6. The time now is 10:09 AM.