public override void Calculate(SlotTypes slotType)
{
// Reading the parameters
DayOfWeek dowFromDay = (DayOfWeek)IndParam.ListParam[1].Index;
DayOfWeek dowUntilDay = (DayOfWeek)IndParam.ListParam[2].Index;
// Calculation
int iFirstBar = 1;
double[] adBars = new double[Bars];
// Calculation of the logic
for (int iBar = iFirstBar; iBar < Bars; iBar++)
{
if (dowFromDay < dowUntilDay)
adBars[iBar] = Time[iBar].DayOfWeek >= dowFromDay &&
Time[iBar].DayOfWeek < dowUntilDay ? 1 : 0;
else if (dowFromDay > dowUntilDay)
adBars[iBar] = Time[iBar].DayOfWeek >= dowFromDay ||
Time[iBar].DayOfWeek < dowUntilDay ? 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;
}