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 > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 07-04-2012, 01:22 PM   #1
Pourleau
Junior Member
 
Join Date: Mar 2010
Posts: 29
Thanks: 1
Thanked 0 times in 0 posts
Default SetProfitTarget

Hi,

I have been using:

EnterLongLimit()
with
SetStopLoss()
and
SetProfitTarget()

and these have been working fine. However I recently had an in-flight issue after a partial fill, whereby my original trade position was not confirmed back as fully filled and my stop and target orders ended up being rejected as they took my net worst-case position over my account limit.
To prevent another in-flight issue I would like to delay the SetProfitTarget() half of the order by a few ticks or, say by a 1min bar update, in order that the original trade will always be confirmed back before both stops and target orders get sent in.
However, when I delay the SetProfitTarget() by a bar it does not get sent, and I only get a stop with my position, no target limit order.
Is there a way to delay this SetProfitTarget() so that it is still tied to my trade? thanks
Pourleau is offline  
Reply With Quote
Old 07-04-2012, 01:35 PM   #2
koganam
Senior Member
 
Join Date: Feb 2008
Location: Durham, North Carolina, USA
Posts: 3,218
Thanks: 24
Thanked 1,231 times in 1,002 posts
Send a message via Skype™ to koganam
Default

Quote:
Originally Posted by Pourleau View Post
Hi,

I have been using:

EnterLongLimit()
with
SetStopLoss()
and
SetProfitTarget()

and these have been working fine. However I recently had an in-flight issue after a partial fill, whereby my original trade position was not confirmed back as fully filled and my stop and target orders ended up being rejected as they took my net worst-case position over my account limit.
To prevent another in-flight issue I would like to delay the SetProfitTarget() half of the order by a few ticks or, say by a 1min bar update, in order that the original trade will always be confirmed back before both stops and target orders get sent in.
However, when I delay the SetProfitTarget() by a bar it does not get sent, and I only get a stop with my position, no target limit order.
Is there a way to delay this SetProfitTarget() so that it is still tied to my trade? thanks
I believe the Set methods must be in place before the trade is entered. To do what you want, you are going to have to use ExitLongLimit() to set your profit target. You probably want to use OnExecution() or OnPositionUpdate() to determine the exact quantity you need for your ExitLong.

NT has a reference sample, ref: http://www.ninjatrader.com/support/f...ead.php?t=7499
koganam is offline  
Reply With Quote
The following 2 users say thank you to koganam for this post:
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
SetProfitTarget peonia trader ATM Strategies (Discretionary Trading) 1 07-05-2012 03:27 AM
SetProfitTarget ohjob General Programming 6 04-12-2012 09:25 PM
SetprofitTarget ??? Italy General Programming 4 12-16-2010 06:57 AM
SetProfitTarget murfinp Strategy Development 2 04-07-2009 03:06 PM
SetProfitTarget() nolantx Automated Trading 1 02-08-2007 12:55 AM


All times are GMT -6. The time now is 05:53 PM.