PDA

View Full Version : stoploss at breakeven at T1


ceesvh
08-17-2007, 02:20 AM
Hi,

I have a strategy- CalculateOnBarClose=false- trading 2 contracts.
The entry orders are separated in 2 orders of 1 contract each with an unique signal. So the Profittarget and Stoploss can be set for each contract separately.
The first contract is taken out by the profittarget for that contract.
I move then the stoploss for the 2e contract to brealeven+1.
The script is as follows:

//*****************Move Stop to Breakeven+1 after T1

if(Position.Quantity==1)
SetStopLoss("ZLRL2",CalculationMode.Price,Position.AvgPrice+TickSize, false);

if(Position.Quantity==-1)
SetStopLoss("ZLRS2",CalculationMode.Price,Position.AvgPrice-TickSize,false);

However it looks like that the original stoploss is still valid.
I assumed that Position.AvgPrice is the average entry price of the 2 contracts.

Could you pls tell me what I am doing wrong?

NinjaTrader_Dierk
08-17-2007, 02:42 AM
Right, you would need to "invalidate" the SetStopLoss setting, since it stays effective once you called it. We'll look into and let you know.

ceesvh
08-17-2007, 02:49 AM
Dierk,

Could you pls confirm that Position.AvgPrice the entry price is.
In the documentation I could not find any reference to an entry price.

NinjaTrader_Dierk
08-17-2007, 02:51 AM
That is correct.

ceesvh
08-17-2007, 03:35 AM
Dierk,

For the original setting of the stoploss I use the following script

if(Position.MarketPosition==MarketPosition.Flat)
{
SetStopLoss("ZLRL1",CalculationMode.Ticks,Stoploss1,false);
SetStopLoss("ZLRS1",CalculationMode.Ticks,Stoploss1,false);
SetStopLoss("ZLRL2",CalculationMode.Ticks,Stoploss2,false);
SetStopLoss("ZLRS2",CalculationMode.Ticks,Stoploss2,false);
}

and for the new setting I use

//*****************Move Stop to Breakeven+1 after T1

if(Position.Quantity==1)
SetStopLoss("ZLRL2",CalculationMode.Price,Position.AvgPrice+TickSize, false);

if(Position.Quantity==-1)
SetStopLoss("ZLRS2",CalculationMode.Price,Position.AvgPrice-TickSize,false);


Might it be possible that a stoploss can not be changed when the original setting uses

CalculationMode.Ticks

while the reset of the stoploss uses

CalculationMode.Price

NinjaTrader_Dierk
08-17-2007, 04:05 AM
Changing the CalculationMode should work. I suggest verifying by a simple a possible strategy (only one entry).

ceesvh
08-22-2007, 11:04 AM
Hi,

Is there anybody out here who - trading two contracts -has developed a working exit strategy,where the stoploss is moved to breakeven the moment the first contract is taken out at T1.