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 02-10-2009, 07:42 PM   #1
CRCatNinja
Member
 
Join Date: Oct 2008
Posts: 54
Thanks: 0
Thanked 0 times in 0 posts
Default Different Target & Stops

Suppose I wanted to define a TARGET on a long trade activated by CONDITION A and a different target if the long trade was activated by CONDITION B.

How do I differentiate which target (or stop) to have NJ use?
CRCatNinja is offline  
Reply With Quote
Old 02-11-2009, 05:29 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

Hi CRCatNinja, you would then simply adjust your Stop / Target values depending on which entry condition got you into the trade. Here's the link to a reference sample explaining how to achieve this - http://www.ninjatrader-support2.com/...ead.php?t=3222
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 02-11-2009, 08:53 AM   #3
edgeliner
Senior Member
 
Join Date: Oct 2007
Location: Southy Florida
Posts: 263
Thanks: 16
Thanked 1 time in 1 post
Default

Can you set up different profit targets like this?

SetProfitTarget("Long 1a", CalculationMode.Ticks, 10);
SetProfitTarget("Long 1b", CalculationMode.Ticks, 20);
edgeliner is offline  
Reply With Quote
Old 02-11-2009, 09:00 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

Hi edgeliner, yes this should work.
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 02-11-2009, 02:55 PM   #5
CRCatNinja
Member
 
Join Date: Oct 2008
Posts: 54
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you all!!!
CRCatNinja is offline  
Reply With Quote
Old 02-23-2009, 08:24 AM   #6
edgeliner
Senior Member
 
Join Date: Oct 2007
Location: Southy Florida
Posts: 263
Thanks: 16
Thanked 1 time in 1 post
Default

Is there a correct way to code the following?

if ((Position.MarketPosition > Position.AvgPrice + 5 * TickSize)

Then "Do something"

Thanks!
edgeliner is offline  
Reply With Quote
Old 02-23-2009, 08:52 AM   #7
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,555
Thanks: 261
Thanked 1,013 times in 994 posts
Default

Hi, not sure what you are trying to code - Position.MarketPosition will return Long, Short or Flat depending on the current positioning - http://www.ninjatrader-support.com/H...tPosition.html
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
Submitting stoploss order how to set parameter Stops&Targetsubmission clint2008 ATM Strategies (Discretionary Trading) 5 01-20-2009 07:13 AM
'Stops & Targets' missing from the Condition Builder? Elliott Wave Strategy Development 3 06-15-2008 07:44 PM
Setting stops and Target orders trader333 ATM Strategies (Discretionary Trading) 1 08-29-2007 07:37 AM
Using NTOrderStatus for Stops/Target MrMilesIL Automated Trading 18 05-29-2006 12:46 PM
Adjusting targets & stops Zardoz Automated Trading 5 04-24-2006 12:06 PM


All times are GMT -6. The time now is 09:26 PM.