当前位置: 首页>>代码示例>>C#>>正文


C# StockSerie.ResetSAREX方法代码示例

本文整理汇总了C#中StockSerie.ResetSAREX方法的典型用法代码示例。如果您正苦于以下问题:C# StockSerie.ResetSAREX方法的具体用法?C# StockSerie.ResetSAREX怎么用?C# StockSerie.ResetSAREX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StockSerie的用法示例。


在下文中一共展示了StockSerie.ResetSAREX方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateBestForValue

        private void UpdateBestForValue(StockSerie stockSerie, FloatPropertyRange range, bool refreshGUI,
            ref StockPortofolio bestPortofolio, ref StockPersonality bestPersonality, float currentValue)
        {
            stockSerie.StockAnalysis.StockPersonality.SetFloatPropertyValue(range, currentValue);
            stockSerie.ResetSAREX();

            //Console.WriteLine("Fixed Fee:" + this.simulationParameterControl.fixedFee + " Tax Rate:" + this.simulationParameterControl.taxRate);

            StockPortofolio currentPortofolio = GenerateTradingSimulation(stockSerie, this.simulationParameterControl.StartDate, this.simulationParameterControl.EndDate.AddHours(18),
                this.simulationParameterControl.amount, this.simulationParameterControl.reinvest,
                this.simulationParameterControl.amendOrders, this.simulationParameterControl.supportShortSelling,
                this.simulationParameterControl.fixedFee, this.simulationParameterControl.taxRate);

            //if (generateReportCheckBox.Checked)
            //{
            //    this.simulationParameterControl.Personality = currentPersonality;
            //    this.simulationParameterControl.GenerateReportLine("TuningReport_"+stockSerie.StockName+".csv", stockSerie, currentPortofolio);
            //}
            if ((bestPortofolio == null || bestPortofolio.TotalAddedValue < currentPortofolio.TotalAddedValue) && currentPortofolio.OrderList.Count != 0)
            {
                bestPersonality = stockSerie.StockAnalysis.StockPersonality.Clone();
                //Console.WriteLine("new best" + bestPersonality.ToString());
                //Console.WriteLine("new best" + currentPortofolio.ToString());

                // Update new best portofolio
                bestPortofolio = currentPortofolio;

                // Refresh GUI
                if (refreshGUI)
                {
                    this.simulationParameterControl.Personality = bestPersonality;
                }
            }
            if (!this.allStocksCheckBox.Checked)
            {
                if (this.progressBar.Value < this.progressBar.Maximum)
                {
                    this.progressBar.Value++;
                }
                else
                {
                    this.progressBar.Value = 0;
                }
            }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:45,代码来源:SarexStrategySimulatorTuningDlg.cs

示例2: UpdateBestForValue

        private void UpdateBestForValue(StockSerie stockSerie, FloatPropertyRange range, bool refreshGUI,
            ref float bestReturn, ref StockPersonality bestPersonality, float currentValue)
        {
            stockSerie.StockAnalysis.StockPersonality.SetFloatPropertyValue(range, currentValue);
            stockSerie.ResetSAREX();

            float currentReturn = stockSerie.CalculateSarReturn(StockDataType.SAREX_FOLLOWER_CUSTOM);

            if ( currentReturn > bestReturn)
            {
                bestPersonality = stockSerie.StockAnalysis.StockPersonality.Clone();
                bestReturn = currentReturn;

                // Refresh GUI
                if (refreshGUI)
                {
                    this.simulationParameterControl.Personality = bestPersonality;
                }
            }
            if (!this.allStocksCheckBox.Checked)
            {
                if (this.progressBar.Value < this.progressBar.Maximum)
                {
                    this.progressBar.Value++;
                }
                else
                {
                    this.progressBar.Value = 0;
                }
            }
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:31,代码来源:SarexSimulatorTuningDlg.cs

示例3: TuneAllIndicators

        private void TuneAllIndicators(StockSerie stockSerie)
        {
            float indicatorSARAccelerationStepStep = float.MaxValue;
            float indicatorSARFastSwingFactorStep = float.MaxValue;

            StockPortofolio bestPortofolio = null;
            StockPersonality bestPersonality = null;

            List<FloatPropertyRange> sarexParamRangeList = null;
            FloatPropertyRange accelerationStepRange = null;
            FloatPropertyRange fastSwingFactorRange = null;

            #region Tune only margin with no indicator
            // Generate report header
            if (this.generateReportCheckBox.Checked)
            {
                this.simulationParameterControl.GenerateReportHeader("TuningReport_" + stockSerie.StockName + ".csv", false);
            }
            sarexParamRangeList = SarexParamRangeListFromDialog(ref indicatorSARAccelerationStepStep, ref indicatorSARFastSwingFactorStep);
            accelerationStepRange = sarexParamRangeList.First(r => r.Name == "IndicatorSARAccelerationStep");
            fastSwingFactorRange = sarexParamRangeList.First(r => r.Name == "IndicatorSARFastSwingFactor");

            stockSerie.StockAnalysis.StockPersonality = new StockPersonality();

            TuneSarexParams(stockSerie, sarexParamRangeList, ref bestPortofolio, ref bestPersonality);

            // Update GUI with new parameters
            if (bestPersonality != null)
            {
                stockSerie.StockAnalysis.StockPersonality = bestPersonality.Clone();
                stockSerie.ResetSAREX();
                this.simulationParameterControl.Personality = bestPersonality.Clone();
                this.simulationParameterControl.Refresh();

                this.Portofolio = bestPortofolio;
                if (SimulationCompleted != null)
                {
                    SimulationCompleted();
                }

                // Generate report header
                if (this.generateReportCheckBox.Checked)
                {
                    this.simulationParameterControl.GenerateReportHeader("TuningReport_" + stockSerie.StockName + ".csv", true);
                    this.simulationParameterControl.GenerateReportLine("TuningReport_" + stockSerie.StockName + ".csv", stockSerie, bestPortofolio);
                }
            }
            #endregion

            this.stockPortofolioList.Remove(bestPortofolio.Name);
            this.stockPortofolioList.Add(bestPortofolio);
            this.Portofolio = bestPortofolio;
            stockSerie.StockAnalysis.StockPersonality = bestPersonality;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:54,代码来源:SarexStrategySimulatorTuningDlg.cs

示例4: TuneAllIndicators

        private void TuneAllIndicators(StockSerie stockSerie)
        {
            float indicatorSARAccelerationStepStep = float.MaxValue;
            float indicatorSARFastSwingFactorStep = float.MaxValue;

            float bestReturn = float.MinValue;
            StockPersonality bestPersonality = null;

            List<FloatPropertyRange> sarexParamRangeList = null;
            FloatPropertyRange accelerationStepRange = null;
            FloatPropertyRange fastSwingFactorRange = null;

            #region Tune only margin with no indicator

            sarexParamRangeList = SarexParamRangeListFromDialog(ref indicatorSARAccelerationStepStep, ref indicatorSARFastSwingFactorStep);
            accelerationStepRange = sarexParamRangeList.First(r => r.Name == "IndicatorSARAccelerationStep");
            fastSwingFactorRange = sarexParamRangeList.First(r => r.Name == "IndicatorSARFastSwingFactor");

            stockSerie.StockAnalysis.StockPersonality = new StockPersonality();

            TuneSarexParams(stockSerie, sarexParamRangeList, ref bestReturn, ref bestPersonality);

            // Update GUI with new parameters
            if (bestPersonality != null)
            {
                stockSerie.StockAnalysis.StockPersonality = bestPersonality.Clone();
                stockSerie.ResetSAREX();
                this.simulationParameterControl.Personality = bestPersonality.Clone();
                this.simulationParameterControl.Refresh();

                if (!this.allStocksCheckBox.Checked)
                {
                    MessageBox.Show("Best return is " + bestReturn.ToString("P2"));
                }
                if (this.generateReportCheckBox.Checked)
                {
                    this.GenerateReportLine(group + "_SARTuningReport.csv", stockSerie, bestReturn);
                }
            }
            #endregion

            stockSerie.StockAnalysis.StockPersonality = bestPersonality;
        }
开发者ID:dadelcarbo,项目名称:StockAnalyzer,代码行数:43,代码来源:SarexSimulatorTuningDlg.cs


注:本文中的StockSerie.ResetSAREX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。