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 08-19-2007, 06:40 AM   #1
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default Profit Target / Trail Stop Executed

Hi:

If I enter a long position, I can send a message via the following:

If condition met,
Enter Long()
SendMail()

How do I do the same if the Profit Target or Trail Stop is executed ?
i.e.
If Profit Target Reached,
SendMail()

I am struggling to understand how I can ascertain how Profit Target is Reached via the strategy.

thx
David
dgregor5 is offline  
Reply With Quote
Old 08-19-2007, 09:10 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

You would have to get creative and check several things such as position size and realized PnL, maybe the trades collection.

There is no simple approach to this at this time. NT 6.5 will make this easier.
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-19-2007, 09:36 AM   #3
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

Your right - thx. I can use the Expected PnL to ascertain whether the Profit Target is hit.....trailing stop requires a little more creativity though.

thx
David
dgregor5 is offline  
Reply With Quote
Old 08-19-2007, 09:46 AM   #4
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

by the way when is NT 6.5 being released ? thx
dgregor5 is offline  
Reply With Quote
Old 08-19-2007, 10:03 AM   #5
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

Fall time frame.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 10-02-2007, 02:30 PM   #6
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

Hello.
How is it possible (by whatever means) to track when a dynamic Trailing Stop exit has been executed (using SetTrailStop in OnBarUpdate). One can track the 'Value' of the TrailStop ...... I believe it reaches a minimum value of 1 and if the price moves down by one tick (long trade) then the trail stop will be executed.

If the value went to zero it would be easy, i.e

if (Value=0)
do the following.........

any ideas or pointers would be greatly appreciated.
thx
DAvid
dgregor5 is offline  
Reply With Quote
Old 10-02-2007, 02:35 PM   #7
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 can do this with NT6.5 and track order status changes. Just be patient for a few more weeks.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 10-02-2007, 02:35 PM   #8
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

The only thing you can do right now is monitor the strategy's position.
NinjaTrader_Ray is offline  
Reply With Quote
Old 10-02-2007, 02:41 PM   #9
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

thx guys --- thought so.
any concrete dates for the NT6.5 release ?

thx DG
dgregor5 is offline  
Reply With Quote
Old 10-02-2007, 02:46 PM   #10
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

A few weeks from now until first beta. No ETA on release.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 11-07-2007, 07:14 AM   #11
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi

A couple of weeks I submitted the following as part of this thread:

******************************************

Hello.
How is it possible (by whatever means) to track when a dynamic Trailing Stop exit has been executed (using SetTrailStop in OnBarUpdate). One can track the 'Value' of the TrailStop ...... I believe it reaches a minimum value of 1 and if the price moves down by one tick (long trade) then the trail stop will be executed.

If the value went to zero it would be easy, i.e

if (Value=0)
do the following.........

any ideas or pointers would be greatly appreciated.
thx
DAvid

***********************************

Can I assume that this is now possible with the new Beta version of NT.
If so, & CalculateOnBarClose=True, would the execution happen in real time still (like it tyipcally does for SetTrailStop) or would the execution happen OnBarClose?

many thx in advance
David
dgregor5 is offline  
Reply With Quote
Old 11-07-2007, 10:03 AM   #12
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

Yes, see the NT 6.5 Beta Help Guide, OnOrderUpdate() method. This stuff is for experienced programmers and we will roll out reference samples in time. One already exists here -

http://www.ninjatrader-support.com/v...ead.php?t=3917
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-07-2007, 10:08 AM   #13
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

thx Ray - regarding the second question..... if CalculateOnBarClose=True, does the OnOrderUpdate() method update in real time? i.e. not only update On Bar Close.

thx
DAvid
dgregor5 is offline  
Reply With Quote
Old 11-07-2007, 10:12 AM   #14
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

Here is detailed answer to your question:

http://www.ninjatrader-support.com/H...BarClose1.html
NinjaTrader_Ray is offline  
Reply With Quote
Old 11-07-2007, 11:24 AM   #15
dgregor5
Senior Member
 
Join Date: Jul 2007
Posts: 225
Thanks: 0
Thanked 0 times in 0 posts
Default

Ray
Now i am confused.....

this is some of the text in the reference sample:

The OnOrderUpdate() method is updated whenever the state of an order changes which allows you to submit and control your stop-loss and profit target orders the instant your entry order is filled.

Now a TrailStop updates on every tick (i.e. new order for every up tick on a trailing stop) even if CalculateOnBarClose = True.

This appears to conflict with your last statement......

pls advise. thx
dgregor5 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
Profit Target Suggestion RicTessitore Suggestions And Feedback 5 07-23-2009 09:42 AM
profit target - no stop Futures_Shark Suggestions And Feedback 1 08-14-2007 10:51 PM
Default stop loss and profit target as GTC equitydealer General Programming 4 06-18-2007 11:31 PM
Auto Trail Stop Loss Didn't Trigger Jappenzeller ATM Strategies (Discretionary Trading) 5 03-12-2007 07:39 AM
Adding more cars messes up Profit Target and Stop Nelson1980 Miscellaneous Support 1 05-17-2006 04:16 AM


All times are GMT -6. The time now is 06:17 PM.