I am here with a so strange case. When I use iterator to define a stopTime to use this as time to stop enter long and compare this to Time[0] by ToTime work if I put a print as order to execute but no execute enterlong instead of. Any help will be welcommed due to I have test many diferent ways and when I do not put this in my logic the strategy work fine (but create long entries after stopTime).
protected override void OnBarUpdate()
{
if (Bars.IsFirstBarOfSession)
{
// use the current bar time to calculate the next session
sessionIterator.GetNextSession(Time[0], true);
// store the desired session information
tradingDay = sessionIterator.ActualTradingDayExchange;
beginTime = sessionIterator.ActualSessionBegin;
stopTime = sessionIterator.ActualSessionBegin.AddHours(3);
endTime = sessionIterator.ActualSessionEnd.AddHours(-0.2);
}
if (ToTime(Time[0]) < ToTime(stopTime))
{
EnterLong();
}
Regards

Comment