public override void Calculate(SlotTypes slotType)
{
// Calculation
double[] adClosePrice = new double[Bars];
for (int iBar = 1; iBar < Bars; iBar++)
if (Time[iBar - 1].Day != Time[iBar].Day)
adClosePrice[iBar - 1] = Close[iBar - 1];
// Check the last bar
TimeSpan tsBarClosing = Time[Bars - 1].TimeOfDay.Add(new TimeSpan(0, (int)Period, 0));
TimeSpan tsDayClosing = new TimeSpan(24, 0, 0);
if (tsBarClosing == tsDayClosing)
adClosePrice[Bars - 1] = Close[Bars - 1];
// Saving the components
Component = new IndicatorComp[1];
Component[0] = new IndicatorComp();
Component[0].CompName = "Closing price of the day";
Component[0].DataType = IndComponentType.ClosePrice;
Component[0].ChartType = IndChartType.NoChart;
Component[0].FirstBar = 2;
Component[0].Value = adClosePrice;
return;
}