public override void Calculate(SlotTypes slotType)
{
// Reading the parameters
int iFromDay = (int)IndParam.NumParam[0].Value;
int iUntilDay = (int)IndParam.NumParam[1].Value;
// Calculation
int iFirstBar = 1;
double[] adBars = new double[Bars];
// Calculation of the logic
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
if (iFromDay < iUntilDay)
adBars[iBar] = Time[iBar].Day >= iFromDay && Time[iBar].Day < iUntilDay ? 1 : 0;
else if (iFromDay > iUntilDay)
adBars[iBar] = Time[iBar].Day >= iFromDay || Time[iBar].Day < iUntilDay ? 1 : 0;
else
adBars[iBar] = 1;
}
// Saving the components
Component = new IndicatorComp[2];
Component[0] = new IndicatorComp();
Component[0].CompName = "Allow long entry";
Component[0].DataType = IndComponentType.AllowOpenLong;
Component[0].ChartType = IndChartType.NoChart;
Component[0].ShowInDynInfo = false;
Component[0].FirstBar = iFirstBar;
Component[0].Value = adBars;
Component[1] = new IndicatorComp();
Component[1].CompName = "Allow short entry";
Component[1].DataType = IndComponentType.AllowOpenShort;
Component[1].ChartType = IndChartType.NoChart;
Component[1].ShowInDynInfo = false;
Component[1].FirstBar = iFirstBar;
Component[1].Value = adBars;
return;
}