![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Feb 2012
Posts: 39
Thanks: 0
Thanked 0 times in 0 posts
|
Hi to all,
i've a nice problem to scale out 2 contract, i do the enterlong 2 times, one to contract (not setting the quantity at 2) because i want to give at every entry a different name... Code:
EnterLong(1,"Long1"); EnterLong(1,"Long2"); Code:
SetStopLoss("Long1",CalculationMode.Ticks, 8, false);
SetStopLoss("Long2",CalculationMode.Ticks, 8, false);
SetProfitTarget(Long1",CalculationMode.Ticks, 8);
SetProfitTarget("Long2",CalculationMode.Ticks, 16);
In this case, which is the mode to do this? Which is the mode to detect profit target of first contract is hitted? Or is there a way to know the number of contract i actually have in market (in this mode, when i have only 1 contract, i change stoploss)? Another question: when i have 2 contracts in position, the object Position. ... which is the contract to refer this object? Both? Only the first? only the second? Thanks to all !! wyatt |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
wyatt,
The Position will reflect overall state there, so if you have 2 long orders your position is still Long. Here is a reference sample on modifying stop losses and profit targets : http://www.ninjatrader.com/support/f...ead.php?t=3222 I would suggest using OnOrderUpdate() or OnExecution() to modify your stops since you said you wanted one position to close then to set breakeven. http://www.ninjatrader.com/support/f...ead.php?t=7499 Please let me know if I may assist further.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Feb 2012
Posts: 39
Thanks: 0
Thanked 0 times in 0 posts
|
Ok, i find this way, isn't there a method for detect the number of contracts when i'm in market position?
another question: you say: "The Position will reflect overall state there, so if you have 2 long orders your position is still Long" my ask: if i've 2 contract in position, Position.AvgPrice is the first contract entry price or second contract entry price? thanks! |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| scale out | tonynt | Strategy Analyzer | 9 | 01-06-2013 12:25 PM |
| Switching from Right Scale to Left Scale | laocoon | Charting | 4 | 01-16-2011 06:32 PM |
| Scale out | Munichtrader | General Programming | 3 | 04-14-2010 02:39 PM |
| how to freeze the vertical scale? (manually adjust the scale?) | leontancfa | Charting | 14 | 01-28-2010 01:01 PM |
| How many contracts | gstewart | Installation and Licensing | 3 | 12-02-2004 11:03 AM |