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 05-07-2009, 07:55 AM   #1
netjms
Junior Member
 
Join Date: Apr 2009
Posts: 27
Thanks: 0
Thanked 0 times in 0 posts
Default Detecting a Posting Exit

I am working on code in which I enter the market all-in and exit the market by scaling out. I have reviewed previous posts and have incorporated entering with multiple order each using a unique id. I also use SetProfitTarget and SetStopLoss to manage the exits. Works fine.

I am looking for a way to determine when my first target is reached via SetProfitTarget (1st lot id) and then move my stop for the second lot dynamically based on other indicators (not just a trailing stop using ticks). I have also reviewed OnExecution() but cannot find a way. I could add code that checks the current price against the 1st lot target but I was hoping for a more accurate/less cumbersome method.

Are there methods or properties exposed to handle this?

Thanks
netjms is offline  
Reply With Quote
Old 05-07-2009, 08:12 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

Yes, you would have to work with IOrder objects to track when your first target reports filled - http://www.ninjatrader-support.com/H...V6/IOrder.html

You can also review this sample for more details - http://www.ninjatrader-support2.com/...ead.php?t=7499
NinjaTrader_Bertrand 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
Auto Posting of Trades to mIRC pinebilly Suggestions And Feedback 2 04-13-2009 02:05 PM
Detecting double entry... ninjaq Strategy Development 1 04-06-2009 04:33 PM
detecting backtest or real time simulation dave1992 Strategy Analyzer 9 11-22-2008 06:09 AM
How to call an ATM when detecting signals ? jed77 Strategy Development 2 03-28-2008 01:23 AM
mIRC trade posting with Ninja guy Miscellaneous Support 7 10-11-2005 01:36 PM


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