Forex_Strategy_Builder.Alligator.Calculate C# (CSharp) Метод

Calculate() публичный Метод

Calculates the indicator's components
public Calculate ( SlotTypes slotType ) : void
slotType SlotTypes
Результат void
        public override void Calculate(SlotTypes slotType)
        {
            MAMethod  maMethod  = (MAMethod )IndParam.ListParam[1].Index;
            BasePrice basePrice = (BasePrice)IndParam.ListParam[2].Index;
            int iNJaws  = (int)IndParam.NumParam[0].Value;
            int iSJaws  = (int)IndParam.NumParam[1].Value;
            int iNTeeth = (int)IndParam.NumParam[2].Value;
            int iSTeeth = (int)IndParam.NumParam[3].Value;
            int iNLips  = (int)IndParam.NumParam[4].Value;
            int iSLips  = (int)IndParam.NumParam[5].Value;
            int iPrvs   =      IndParam.CheckParam[0].Checked ? 1 : 0;

            int iFirstBar = Math.Max(iNJaws + iSJaws + 2, iNTeeth + iSTeeth + 2);
            iFirstBar = Math.Max(iFirstBar, iNLips + iSLips + 2);

            // Calculation
            double[] adJaws  = MovingAverage(iNJaws , iSJaws , maMethod, Price(basePrice));
            double[] adTeeth = MovingAverage(iNTeeth, iSTeeth, maMethod, Price(basePrice));
            double[] adLips  = MovingAverage(iNLips , iSLips , maMethod, Price(basePrice));

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

            Component[0] = new IndicatorComp();
            Component[0].CompName   = "Jaws";
            Component[0].DataType   = IndComponentType.IndicatorValue;
            Component[0].ChartType  = IndChartType.Line;
            Component[0].ChartColor = Color.Blue;
            Component[0].FirstBar   = iFirstBar;
            Component[0].Value      = adJaws;

            Component[1] = new IndicatorComp();
            Component[1].CompName   = "Teeth";
            Component[1].DataType   = IndComponentType.IndicatorValue;
            Component[1].ChartType  = IndChartType.Line;
            Component[1].ChartColor = Color.Red;
            Component[1].FirstBar   = iFirstBar;
            Component[1].Value      = adTeeth;

            Component[2] = new IndicatorComp();
            Component[2].CompName   = "Lips";
            Component[2].DataType   = IndComponentType.IndicatorValue;
            Component[2].ChartType  = IndChartType.Line;
            Component[2].ChartColor = Color.Lime;
            Component[2].FirstBar   = iFirstBar;
            Component[2].Value      = adLips;

            Component[3] = new IndicatorComp();
            Component[3].ChartType = IndChartType.NoChart;
            Component[3].FirstBar  = iFirstBar;
            Component[3].Value     = new double[Bars];

            Component[4] = new IndicatorComp();
            Component[4].ChartType = IndChartType.NoChart;
            Component[4].FirstBar  = iFirstBar;
            Component[4].Value     = new double[Bars];

            // Sets the Component's type.
            if (slotType == SlotTypes.OpenFilter)
            {
                Component[3].DataType = IndComponentType.AllowOpenLong;
                Component[3].CompName = "Is long entry allowed";
                Component[4].DataType = IndComponentType.AllowOpenShort;
                Component[4].CompName = "Is short entry allowed";
            }
            else if (slotType == SlotTypes.CloseFilter)
            {
                Component[3].DataType = IndComponentType.ForceCloseLong;
                Component[3].CompName = "Close out long position";
                Component[4].DataType = IndComponentType.ForceCloseShort;
                Component[4].CompName = "Close out short position";
            }

            switch (IndParam.ListParam[0].Text)
            {
                case "The Jaws rises":
                    IndicatorRisesLogic(iFirstBar, iPrvs, adJaws, ref Component[3], ref Component[4]);
                    break;

                case "The Jaws falls":
                    IndicatorFallsLogic(iFirstBar, iPrvs, adJaws, ref Component[3], ref Component[4]);
                    break;

                case "The Teeth rises":
                    IndicatorRisesLogic(iFirstBar, iPrvs, adTeeth, ref Component[3], ref Component[4]);
                    break;

                case "The Teeth falls":
                    IndicatorFallsLogic(iFirstBar, iPrvs, adTeeth, ref Component[3], ref Component[4]);
                    break;

                case "The Lips rises":
                    IndicatorRisesLogic(iFirstBar, iPrvs, adLips, ref Component[3], ref Component[4]);
                    break;

                case "The Lips falls":
                    IndicatorFallsLogic(iFirstBar, iPrvs, adLips, ref Component[3], ref Component[4]);
                    break;

                case "The Lips crosses the Teeth upward":
                    IndicatorCrossesAnotherIndicatorUpwardLogic(iFirstBar, iPrvs, adLips, adTeeth, ref Component[3], ref Component[4]);
                    break;

                case "The Lips crosses the Teeth downward":
                    IndicatorCrossesAnotherIndicatorDownwardLogic(iFirstBar, iPrvs, adLips, adTeeth, ref Component[3], ref Component[4]);
                    break;

                case "The Lips crosses the Jaws upward":
                    IndicatorCrossesAnotherIndicatorUpwardLogic(iFirstBar, iPrvs, adLips, adJaws, ref Component[3], ref Component[4]);
                    break;

                case "The Lips crosses the Jaws downward":
                    IndicatorCrossesAnotherIndicatorDownwardLogic(iFirstBar, iPrvs, adLips, adJaws, ref Component[3], ref Component[4]);
                    break;

                case "The Teeth crosses the Jaws upward":
                    IndicatorCrossesAnotherIndicatorUpwardLogic(iFirstBar, iPrvs, adTeeth, adJaws, ref Component[3], ref Component[4]);
                    break;

                case "The Teeth crosses the Jaws downward":
                    IndicatorCrossesAnotherIndicatorDownwardLogic(iFirstBar, iPrvs, adTeeth, adJaws, ref Component[3], ref Component[4]);
                    break;

                default:
                    break;
            }

            return;
        }