I don't want to use any Stop or Targets as i just want to exit my trades after X bar from entry.
Here below the code.
Any idea whats wrong??
protected override void OnBarUpdate()
{
if (xCustomIndicator.TriggerLow[0] > 60)
{
barNumberOfOrder = CurrentBar;
EnterShortStop(1, Close[0]-1*TickSize,"ShortEntry");
}
}
int NbBars = CurrentBar - barNumberOfOrder;
if (NbBars==10)
{
if (Position.MarketPosition == MarketPosition.Long)
{
ExitLongStop(Close[0]-1,"LongEntry");
}
if (Position.MarketPosition == MarketPosition.Short)
{
ExitShortStop(Close[0]+1,"ShortEntry");
}
}
}

Comment