本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例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;
}
示例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;
}