A strategy with CalculateOnBarClose = true;
1st bar : Enterlong();
2nd bar : ExitLongLimit(price)
next bars : If the previous ExitLongLimit order is not filled, I want to enter short with a EnterShortLimit(price2);
my problem is that the ExitLongLimit order is just canceled at the 3rd bard and there is no short pending order !
Here is a simple ( but stupid ) example which would cause this behaviour :
protected override void OnBarUpdate()
{
if ( Position.MarketPosition == MarketPosition.Flat )
{ EnterLong(1); }
if ( Position.MarketPosition == MarketPosition.Long ) {
if ( BarsSinceEntry() < 2 )
ExitLongLimit(High[0]+20);
else
EnterShortLimit(GetCurrentAsk()+1);
}
if ( Position.MarketPosition == MarketPosition.Short )
ExitShort();
}
Comment