protected override void OnBarUpdate()
{
if (!Bars.BarsType.IsIntraday)
return;
// If the current data is not the same date as the current bar then its a new session
if (currentDate != sessionIterator.GetTradingDay(Time[0]) || currentOpen == 0)
{
// The current day OHLC values are now the prior days value so set
// them to their respect indicator series for plotting
priorDayClose = currentClose;
if (ShowClose) PriorClose[0] = priorDayClose;
// Initilize the current day settings to the new days data
currentClose = Close[0];
currentDate = sessionIterator.GetTradingDay(Time[0]);
}
else // The current day is the same day
{
// Set the current day OHLC values
currentClose = Close[0];
if (ShowClose) PriorClose[0] = priorDayClose;
}
}
Comment