Forex_Strategy_Builder.Entry_Hour.Calculate C# (CSharp) Method

Calculate() public method

Calculates the indicator's components
public Calculate ( SlotTypes slotType ) : void
slotType SlotTypes
return void
        public override void Calculate(SlotTypes slotType)
        {
            // Reading the parameters
            int iEntryHour   = (int)IndParam.NumParam[0].Value;
            int iEntryMinute = (int)IndParam.NumParam[1].Value;
            TimeSpan tsEntryHour = new TimeSpan(iEntryHour, iEntryMinute, 0);

            // Calculation
            int iFirstBar = 1;
            double[] adBars = new double[Bars];

            // Calculation of the logic
            for (int iBar = iFirstBar; iBar < Bars; iBar++)
            {
                adBars[iBar] = Time[iBar].TimeOfDay == tsEntryHour ? Open[iBar] : 0;
            }

            // Saving the components
            Component = new IndicatorComp[1];

            Component[0] = new IndicatorComp();
            Component[0].CompName      = "Entry hour";
            Component[0].DataType      = IndComponentType.OpenPrice;
            Component[0].ChartType     = IndChartType.NoChart;
            Component[0].ShowInDynInfo = false;
            Component[0].FirstBar      = iFirstBar;
            Component[0].Value         = adBars;

            return;
        }