In realtime the strategy gets stuck at the first SetStopLoss (see Pending Submit.png). I had to bail out of the strategy and then this pending order is also stuck. Had to disconnect to clear.
I call several SetStopLoss resets after the inital one. Works in testing not realtime.
if (Position.MarketPosition == MarketPosition.Flat
{
EnterLong();
SetStopLoss(CalculationMode.Price, Low[0]);
}
if (Position.MarketPosition == MarketPosition.Long)
{
stop = Position.AvgPrice - 3*TickSize;
SetStopLoss(CalculationMode.Price, stop);
if (EMA(21)[0] > stop )
{
stop = Instrument.MasterInstrument.Round2TickSize(EMA(21)[0]-1*TickSize);
SetStopLoss(CalculationMode.Price, stop);
}
if ( (Low[0] - 2*TickSize) > Position.AvgPrice )
{
SetStopLoss(CalculationMode.Price, Position.AvgPrice + 1*TickSize);
}
if ( (High[0]) > Position.AvgPrice + 15*TickSize )
{
SetStopLoss(CalculationMode.Price, Position.AvgPrice + 3*TickSize);
}
if ( (High[0]) > Position.AvgPrice + 30*TickSize )
{
SetStopLoss(CalculationMode.Price, Position.AvgPrice + 5*TickSize);
}
}
Strategy Print Statements just before stategy closes
*******************Time[0] 2/4/2011 6:51:00 AM
Vol 68000
Close[0] 14.52
Avg price 14.46
1st stop 14.43
2nd stop 14.46
3rd stop 14.46
Last stop 14.46

Comment