To achieve this, the code I have in mind is:
protected override void OnBarUpdate()
{
if (CrossAbove(SMA(10), SMA(20), 1))
EnterLong(100, "myEntryOrder");
/* Check if position is still open 30 days (i.e. 8640 5-min bars) later */
if ((Position.MarketPosition != MarketPosition.Flat) && (BarsSinceEntryExecution() > 8640))
ExitLong();
}
Greatly appreciate any advice, thanks

Comment