This code works fine, there is something in your strategy you need to fix.
protected override void OnBarUpdate()
{
if(CurrentBar < 1) return;
if(Close[0] > Close[1])
{
EnterLong();
}
if(Position.MarketPosition == MarketPosition.Long)
{
ExitLong(Position.Quantity);
}
}

Comment