PDA

View Full Version : Multiple Pfofit Targets


AO76
05-03-2007, 11:31 AM
I have a few questions:

1) Is it possible to set multiple profit targets with the SetProfitTarget() method?
2) Is it possible to auto enter but then exit manually?

3)Is it possible to SetStopLoss() method based on# ofbars or time(ie if it does not advance/decline in X bars/minutes) get out


Thanks

NinjaTrader_Ray
05-03-2007, 12:52 PM
1) You could do this if you provide unique signal names for your entry, such as entry1, entry2 and then call SetProfitTarget () specifying each entry signal.

2) Only by using ATM strategies. There is a section in the Help Guide on this topic.

3) You can always exit using ExitLong() after X bars, any stop loss in the market will be cancelled. You do run the risk of getting filled on both order in this case so make sure the stop loss is a good distance from the market.

Ray

AO76
05-03-2007, 12:58 PM
Thanks for the response. In regards to 1)

I would like to enter all units at once and then take partial units off at specific targets. I'm guessing there is a way to this but it would be nice if the SetProfitTarget() method could provide this functionality.

Thanks Again

NinjaTrader_Ray
05-04-2007, 02:06 AM
You can enter at once, but with two orders:




Within Initialize()

SetProfitTarget("Entry1", CalculationMode.Ticks, 6);
SetProfitTarget("Entry2", CalculationMode.Ticks, 12);

Within OnBarUpdate()

if (Close[0] > Open[0])
{
EnterLong(1, "Entry1");
EnterLong(1, "Entry2");
}



Then when running or backtesting a strategy, make sure you set the following parameters:

Entries per direction = 1
Entry handling = UniqueEntries

Ray

AO76
05-06-2007, 11:20 AM
Great thanks.

jon_lbs
05-06-2007, 10:47 PM
I just submitted same question.. See my post at Scale Out Partials . I attached the code __ Also got it working just fine.

AO76
05-20-2007, 12:01 AM
Another question.

I have two entries T1, T2. My T1 target is hit now I would like to bring my T2 original stop loss upto Break Even. Any idea how I can do this?

Thanks.

NinjaTrader_Ray
05-20-2007, 08:38 AM
You would need to check Position.Quantity to determine if T1 is hit. Then you can call the SetStopLoss() method with different parameters to tighten the stop loss.

From the Help Guide:

Definition
Generates a stop loss order to exit a position. Stop loss orders are real working orders (unless simulated is specified in which case the stop order is locally simulated and submitted as market once triggered) submitted immediately to the market upon receiving an execution from an entry order.


It is suggested to call this method from within the strategy Initialize() method if your stop loss price/offset is static
You may call this method from within the strategy OnBarUpdate() method should you wish to dynamically change the stop loss price while in an open position
Should you call this method to dynamically change the stop loss price in the strategy OnBarUpdate() method, you should always reset the stop loss price/offset value when your strategy is flat otherwise, the last price/offset value set will be used to generate your stop loss order on your next open position

AO76
05-20-2007, 01:04 PM
Not sure if I'm doing this right:

Initialization:

SetProfitTarget("T1", CalculationMode.Ticks, 5);
SetProfitTarget("T2", CalculationMode.Ticks, 7);

SetStopLoss("T1", CalculationMode.Ticks, 10, true);
SetStopLoss("T2", CalculationMode.Ticks, 10, true);


OnBarUpdate: (not sure if this is how I modify the order)

EnterLong(2, "T1");
EnterLong(2, "T2");

if(Position.Quantity == 2)
{
SetStopLoss("T2", CalculationMode.Ticks, 0, true);
}

AO76
05-20-2007, 01:06 PM
I know in the ATM there are advanced stop loss orders which will trigger the stop loss to BE + X. It would be nice if we had a method to this.

NinjaTrader_Ray
05-20-2007, 04:31 PM
if(Position.Quantity == 2)
{
SetStopLoss("T2", CalculationMode.Price, Position.AvgPrice, true);
}


Then you have to reset this when flat:

if(Position.MarketPosition== MarketPosition.Flat)
{
SetStopLoss("T2", CalculationMode.Ticks, 10, true);
}

AO76
05-20-2007, 06:49 PM
Great thanks Ray. Works great.

Appreciate your help.