SetData() public method

Sets data
public SetData ( int indexDeviation, int indexParam, double data ) : void
indexDeviation int -10, -9, ... ,0, +1, +2, ... +10
indexParam int Parameter number
data double The value to be stored
return void
コード例 #1
0
        /// <summary>
        /// Sets table with parameter values.
        /// </summary>
        void SetParametersValues(int percentDeviation, int countParam)
        {
            listParametersName = "Index" + Configs.ColumnSeparator + "Parameter name" + Environment.NewLine;
            countStratParams   = 0;
            cycles             = 0;
            deviationSteps     = 2 * percentDeviation + 1;

            tableParameters      = new Over_optimization_Data_Table(percentDeviation, countParam);
            tableParameters.Name = "Values of the Parameters";

            for (int slot = 0; slot < Data.Strategy.Slots; slot++)
            {
                for (int numParam = 0; numParam < 6; numParam++)
                {
                    if (Data.Strategy.Slot[slot].IndParam.NumParam[numParam].Enabled && countStratParams < countParam)
                    {
                        NumericParam currentParam  = Data.Strategy.Slot[slot].IndParam.NumParam[numParam];
                        double       minVal        = currentParam.Min;
                        double       maxVal        = currentParam.Max;
                        int          point         = currentParam.Point;
                        double       originalValue = currentParam.Value;
                        double       deltaStep     = originalValue / 100.0;

                        for (int p = 0; p < deviationSteps; p++)
                        {
                            int    index = percentDeviation - p;
                            double value = originalValue + index * deltaStep;
                            value = Math.Round(value, point);

                            if (index == 0)
                            {
                                value = originalValue;
                            }
                            if (value < minVal)
                            {
                                value = minVal;
                            }
                            if (value > maxVal)
                            {
                                value = maxVal;
                            }

                            tableParameters.SetData(index, countStratParams, value);
                            cycles++;
                        }

                        listParametersName += (countStratParams + 1).ToString() + Configs.ColumnSeparator + currentParam.Caption + Environment.NewLine;
                        countStratParams++;
                    }
                }
            }

            for (int prm = countStratParams; prm < countParam; prm++)
            {
                listParametersName += (prm + 1).ToString() + Environment.NewLine;
            }
            listParametersName += Environment.NewLine;
        }
        /// <summary>
        /// Sets table with parameter values.
        /// </summary>
        void SetParametersValues(int percentDeviation, int countParam)
        {
            listParametersName = "Index" + Configs.ColumnSeparator + "Parameter name" + Environment.NewLine;
            countStratParams = 0;
            cycles = 0;
            deviationSteps = 2 * percentDeviation + 1;

            tableParameters = new Over_optimization_Data_Table(percentDeviation, countParam);
            tableParameters.Name = "Values of the Parameters";

            for (int slot = 0; slot < Data.Strategy.Slots; slot++)
                for (int numParam = 0; numParam < 6; numParam++)
                    if (Data.Strategy.Slot[slot].IndParam.NumParam[numParam].Enabled && countStratParams < countParam)
                    {
                        NumericParam currentParam = Data.Strategy.Slot[slot].IndParam.NumParam[numParam];
                        double minVal = currentParam.Min;
                        double maxVal = currentParam.Max;
                        int    point  = currentParam.Point;
                        double originalValue = currentParam.Value;
                        double deltaStep     = originalValue / 100.0;

                        for (int p = 0; p < deviationSteps; p++)
                        {
                            int    index = percentDeviation - p;
                            double value = originalValue + index * deltaStep;
                            value = Math.Round(value, point);

                            if (index == 0)
                                value = originalValue;
                            if (value < minVal)
                                value = minVal;
                            if (value > maxVal)
                                value = maxVal;

                            tableParameters.SetData(index, countStratParams, value);
                            cycles++;
                        }

                        listParametersName += (countStratParams + 1).ToString() + Configs.ColumnSeparator + currentParam.Caption + Environment.NewLine;
                        countStratParams++;
                    }

            for (int prm = countStratParams; prm < countParam; prm++)
                listParametersName += (prm + 1).ToString() + Environment.NewLine;
            listParametersName += Environment.NewLine;
        }