I am backtesting an indicator. But I found my strategy can only enter/exit at the open price of the next day after the signal is triaggered. Actually I want to enter/exit at the close price of the day when the signal is triaggered.
Please see my code below.
Thanks,
Jing
protected override void OnBarUpdate()
{
if( Position.MarketPosition == MarketPosition.Flat && MyIndicator().BuySignal[0])
EnterLong("L");
if (Position.MarketPosition == MarketPosition.Long && MyIndicator().SellSignal[0])
ExitLong("L");
}

Comment