[Quantproject-developers] QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOs
Brought to you by:
glauco_1
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/BiasedPVO In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7110/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/BiasedPVO Modified Files: EndOfDayTimerHandlerBiasedPVO.cs RunBiasedPVO.cs Log Message: Several changes applied to the classes implementing the Portfolio Value Oscillator strategy (the most important one relates to the use of ReturnsManager) Index: RunBiasedPVO.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/BiasedPVO/RunBiasedPVO.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RunBiasedPVO.cs 8 Apr 2007 18:56:00 -0000 1.2 --- RunBiasedPVO.cs 14 Jan 2008 23:07:03 -0000 1.3 *************** *** 24,27 **** --- 24,29 ---- using System.Collections; using System.Data; + using System.IO; + using QuantProject.ADT; using QuantProject.ADT.Optimizing.Genetic; *************** *** 58,65 **** public class RunBiasedPVO : RunPVO { ! private int numOfDifferentGenomesToEvaluateOutOfSample; ! private double minimumAcceptableGain; ! ! public RunBiasedPVO(string tickerGroupID, int maxNumOfEligibleTickersForOptimization, int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, --- 60,84 ---- public class RunBiasedPVO : RunPVO { ! protected double minPriceForTickersToBeChosen; ! protected double maxPriceForTickersToBeChosen; ! protected int numOfDifferentGenomesToEvaluateOutOfSample; ! protected int numDaysOfStayingOnTheMarket; ! protected double maxCoefficientForDegreeComputationOfCrossingThreshold; ! protected double numOfStdDevForThresholdsComputation; ! protected bool resetThresholdsBeforeCheckingOutOfSample; ! protected bool buyOnlyPositionsThatAreMovingTogether; ! protected bool doNotOpenReversedPositionsThatHaveJustBeenClosed; ! protected int numDaysForThresholdsReComputation; ! ! protected string pathOfFileContainingGenomes; ! public string PathOfFileContainingGenomes ! { ! get { return pathOfFileContainingGenomes; } ! set { pathOfFileContainingGenomes = value; } ! } ! ! public RunBiasedPVO(string tickerGroupID, int maxNumOfEligibleTickersForOptimization, ! double minPriceForTickersToBeChosen, ! double maxPriceForTickersToBeChosen, int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, int generationNumberForGeneticOptimizer, *************** *** 67,71 **** --- 86,97 ---- DateTime startDate, DateTime endDate, int numOfDifferentGenomesToEvaluateOutOfSample, + bool resetThresholdsBeforeCheckingOutOfSample, + int numDaysForThresholdsReComputation, + double numOfStdDevForThresholdsComputation, + double maxCoefficientForDegreeComputationOfCrossingThreshold, + bool buyOnlyPositionsThatAreMovingTogether, + bool doNotOpenReversedPositionsThatHaveJustBeenClosed, int numDaysForOscillatingPeriod, + int numDaysOfStayingOnTheMarket, int minLevelForOversoldThreshold, int maxLevelForOversoldThreshold, *************** *** 93,101 **** numDaysBetweenEachOptimization, inSamplePortfolioType, maxAcceptableCloseToCloseDrawdown, maxRunningHours) { ! this.numOfDifferentGenomesToEvaluateOutOfSample = numOfDifferentGenomesToEvaluateOutOfSample; this.minimumAcceptableGain = minimumAcceptableGain; ! this.ScriptName = "PVO_Biased_WithWeightsPriceSel"; } --- 119,144 ---- numDaysBetweenEachOptimization, inSamplePortfolioType, maxAcceptableCloseToCloseDrawdown, + minimumAcceptableGain, maxRunningHours) { ! this.minPriceForTickersToBeChosen = minPriceForTickersToBeChosen; ! this.maxPriceForTickersToBeChosen = maxPriceForTickersToBeChosen; ! this.numOfDifferentGenomesToEvaluateOutOfSample = numOfDifferentGenomesToEvaluateOutOfSample; this.minimumAcceptableGain = minimumAcceptableGain; ! //this.ScriptName = "PVO_Biased_WithWeightsPriceSel"; ! this.ScriptName = "PVO_Biased_NoWeightsPriceSel"; ! this.numDaysOfStayingOnTheMarket = numDaysOfStayingOnTheMarket; ! this.maxCoefficientForDegreeComputationOfCrossingThreshold = maxCoefficientForDegreeComputationOfCrossingThreshold; ! this.resetThresholdsBeforeCheckingOutOfSample = resetThresholdsBeforeCheckingOutOfSample; ! this.numDaysForThresholdsReComputation = numDaysForThresholdsReComputation; ! this.numOfStdDevForThresholdsComputation = numOfStdDevForThresholdsComputation; ! this.buyOnlyPositionsThatAreMovingTogether = buyOnlyPositionsThatAreMovingTogether; ! this.doNotOpenReversedPositionsThatHaveJustBeenClosed = doNotOpenReversedPositionsThatHaveJustBeenClosed; ! this.pathOfFileContainingGenomes = null; ! //if this field is set to null, selections of tickers (with ! //optimization), takes place; otherwise, tickers for ! //out of sample testing are chosen from a given ! //set of genomes saved to disk (representing a set of ! //a certain number of optimizations run over a given period) } *************** *** 105,127 **** { this.endOfDayTimerHandler = new EndOfDayTimerHandlerBiasedPVO(this.tickerGroupID, this.numberOfEligibleTickers, ! this.numberOfTickersToBeChosen, this.numDaysForOptimizationPeriod, ! this.account, ! this.generationNumberForGeneticOptimizer, ! this.populationSizeForGeneticOptimizer, this.benchmark, ! this.numOfDifferentGenomesToEvaluateOutOfSample, ! this.numDaysForOscillatingPeriod, ! this.minLevelForOversoldThreshold, ! this.maxLevelForOversoldThreshold, ! this.minLevelForOverboughtThreshold, ! this.maxLevelForOverboughtThreshold, ! this.divisorForThresholdComputation, ! this.symmetricalThresholds, ! this.overboughtMoreThanOversoldForFixedPortfolio, ! this.numDaysBetweenEachOptimization, ! this.portfolioType, this.maxAcceptableCloseToCloseDrawdown, ! this.minimumAcceptableGain); } ! public override void SaveScriptResults() --- 148,228 ---- { this.endOfDayTimerHandler = new EndOfDayTimerHandlerBiasedPVO(this.tickerGroupID, this.numberOfEligibleTickers, ! this.minPriceForTickersToBeChosen, ! this.maxPriceForTickersToBeChosen, ! this.numberOfTickersToBeChosen, this.numDaysForOptimizationPeriod, ! this.account, ! this.PathOfFileContainingGenomes, ! this.generationNumberForGeneticOptimizer, ! this.populationSizeForGeneticOptimizer, this.benchmark, ! this.numOfDifferentGenomesToEvaluateOutOfSample, ! this.resetThresholdsBeforeCheckingOutOfSample, ! this.numDaysForThresholdsReComputation, ! this.numOfStdDevForThresholdsComputation, ! this.maxCoefficientForDegreeComputationOfCrossingThreshold, ! this.buyOnlyPositionsThatAreMovingTogether, ! this.doNotOpenReversedPositionsThatHaveJustBeenClosed, ! this.numDaysForOscillatingPeriod, ! this.numDaysOfStayingOnTheMarket, ! this.minLevelForOversoldThreshold, ! this.maxLevelForOversoldThreshold, ! this.minLevelForOverboughtThreshold, ! this.maxLevelForOverboughtThreshold, ! this.divisorForThresholdComputation, ! this.symmetricalThresholds, ! this.overboughtMoreThanOversoldForFixedPortfolio, ! this.numDaysBetweenEachOptimization, ! this.portfolioType, this.maxAcceptableCloseToCloseDrawdown, ! this.minimumAcceptableGain); } ! ! private void saveScriptResults_saveScriptFeaturesToLogFile(string nameForScriptFiles) ! { ! string pathFile = System.Configuration.ConfigurationSettings.AppSettings["ReportsArchive"] + ! "\\" + this.ScriptName + "\\" + nameForScriptFiles + ".txt"; ! StreamWriter w = File.AppendText(pathFile); ! w.WriteLine ("\n----------------------------------------------\r\n"); ! w.Write("\r\nScript file: {0}\r", nameForScriptFiles); ! w.Write("\r\nSelection of tickers from group: {0}\r", this.tickerGroupID); ! w.Write("\r\nSelect eligible from tickers with minimum price (in the last 30 days): {0}\r", this.minPriceForTickersToBeChosen.ToString()); ! w.Write("\r\nSelect eligible from tickers with maximum price (in the last 30 days): {0}\r", this.maxPriceForTickersToBeChosen.ToString()); ! w.Write("\r\nMax num of eligible tickers for optimization (most liquid): {0}\r", this.numberOfEligibleTickers.ToString()); ! w.Write("\r\nNum of tickers in portfolio: {0}\r", this.numberOfTickersToBeChosen.ToString()); ! w.Write("\r\nPath name file of already optimized genomes: {0}\r", this.PathOfFileContainingGenomes); ! w.Write("\r\nLength in days for optimization period: {0}\r", this.numDaysForOptimizationPeriod.ToString()); ! w.Write("\r\nGeneration number for genetic optimizer: {0}\r", this.generationNumberForGeneticOptimizer.ToString()); ! w.Write("\r\nPopulation size for genetic optimizer: {0}\r", this.populationSizeForGeneticOptimizer.ToString()); ! w.Write("\r\nOptimization each (num of days): {0}\r", this.numDaysBetweenEachOptimization.ToString()); ! w.Write("\r\nBenchmark: {0}\r", this.benchmark); ! w.Write("\r\nStart date: {0}\r", this.startDateTime.DateTime.ToLongDateString()); ! w.Write("\r\nEnd date: {0}\r", this.endDateTime.DateTime.ToLongDateString()); ! w.Write("\r\nNum of genomes to check out of sample: {0}\r", this.numOfDifferentGenomesToEvaluateOutOfSample.ToString()); ! w.Write("\r\nReset thresholds out of sample: {0}\r", this.resetThresholdsBeforeCheckingOutOfSample.ToString()); ! w.Write("\r\nNum of Days for thresholds recomputation out of sample: {0}\r", this.numDaysForThresholdsReComputation.ToString()); ! w.Write("\r\nNum of standard deviation from average for setting thresholds out of sample: {0}\r", this.numOfStdDevForThresholdsComputation.ToString()); ! w.Write("\r\nDiscard genome if degree of crossing threshold is {0} * threshold away\r", this.maxCoefficientForDegreeComputationOfCrossingThreshold.ToString()); ! w.Write("\r\nBuy only positions that are moving together: {0}\r", this.buyOnlyPositionsThatAreMovingTogether.ToString()); ! w.Write("\r\nDo not reverse positions that have just been closed: {0}\r", this.doNotOpenReversedPositionsThatHaveJustBeenClosed.ToString()); ! w.Write("\r\nLength return (oscillating period): {0}\r", this.numDaysForOscillatingPeriod.ToString()); ! w.Write("\r\nNumDays of staying on the market: {0}\r", this.numDaysOfStayingOnTheMarket.ToString()); ! w.Write("\r\nMin level for oversold threshold: {0}\r", this.minLevelForOversoldThreshold.ToString()); ! w.Write("\r\nMax level for oversold threshold: {0}\r", this.maxLevelForOversoldThreshold.ToString()); ! w.Write("\r\nMin level for overbought threshold: {0}\r", this.minLevelForOverboughtThreshold.ToString()); ! w.Write("\r\nMax level for overbought threshold: {0}\r", this.maxLevelForOverboughtThreshold.ToString()); ! w.Write("\r\nDivisor for threshold computation: {0}\r", this.divisorForThresholdComputation.ToString()); ! w.Write("\r\nSymmetrical thresholds: {0}\r", this.symmetricalThresholds.ToString()); ! w.Write("\r\nOverbought more than oversold: {0}\r", this.overboughtMoreThanOversoldForFixedPortfolio.ToString()); ! w.Write("\r\nSymmetrical thresholds: {0}\r", this.symmetricalThresholds.ToString()); ! w.Write("\r\nNum days between each optimization: {0}\r", this.numDaysBetweenEachOptimization.ToString()); ! w.Write("\r\nIn sample portfolio type: {0}\r", this.portfolioType.ToString()); ! w.Write("\r\nMax acceptable draw down: {0}\r", this.maxAcceptableCloseToCloseDrawdown.ToString()); ! w.Write("\r\nMinimum acceptable gain: {0}\r", this.minimumAcceptableGain.ToString()); ! w.Write("\r\nMax running hours: {0}\r", this.maxRunningHours.ToString()); ! w.WriteLine ("\n----------------------------------------------"); ! //w.Write("\r\nFitnesses compared (sharpe r. OTC): {0}\r", this.fitnessesInSample.Length.ToString()); ! // Update the underlying file. ! w.Flush(); ! w.Close(); ! } public override void SaveScriptResults() *************** *** 129,132 **** --- 230,234 ---- string fileName = DateTime.Now.Hour.ToString().PadLeft(2,'0') + "_" + DateTime.Now.Minute.ToString().PadLeft(2,'0') + "_" + + DateTime.Now.Second.ToString().PadLeft(2,'0') + "_" + this.scriptName + "GenOS_" + this.numOfDifferentGenomesToEvaluateOutOfSample + "_OsDays_" + numDaysForOscillatingPeriod + *************** *** 145,170 **** this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveBestGenomes); ! OptimizationOutput optimizationOutput = new OptimizationOutput(); ! foreach(GenomeRepresentation genomeRepresentation in this.endOfDayTimerHandler.BestGenomes) optimizationOutput.Add(genomeRepresentation); ! ObjectArchiver.Archive(optimizationOutput, dirNameWhereToSaveBestGenomes + fileName + ".bgn"); ! ! //default report with numIntervalDays = 1 AccountReport accountReport = this.account.CreateReport(fileName,1, this.endOfDayTimer.GetCurrentTime(), this.benchmark, ! new HistoricalAdjustedQuoteProvider()); ! this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveReports); ObjectArchiver.Archive(accountReport, dirNameWhereToSaveReports + fileName + ".qPr"); ! this.endOfDayTimer.Stop(); - } ! #endregion } --- 247,272 ---- this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveBestGenomes); ! if( this.PathOfFileContainingGenomes == null ) ! { ! OptimizationOutput optimizationOutput = new OptimizationOutput(); ! foreach(GenomeRepresentation genomeRepresentation in this.endOfDayTimerHandler.BestGenomes) optimizationOutput.Add(genomeRepresentation); ! ObjectArchiver.Archive(optimizationOutput, dirNameWhereToSaveBestGenomes + fileName + ".bgn"); ! } ! this.checkDateForReport_createDirIfNotPresent(dirNameWhereToSaveReports); AccountReport accountReport = this.account.CreateReport(fileName,1, this.endOfDayTimer.GetCurrentTime(), this.benchmark, ! new HistoricalAdjustedQuoteProvider()); ObjectArchiver.Archive(accountReport, dirNameWhereToSaveReports + fileName + ".qPr"); ! this.saveScriptResults_saveScriptFeaturesToLogFile(fileName); this.endOfDayTimer.Stop(); } ! #endregion } Index: EndOfDayTimerHandlerBiasedPVO.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/BiasedPVO/EndOfDayTimerHandlerBiasedPVO.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** EndOfDayTimerHandlerBiasedPVO.cs 29 Aug 2007 09:47:54 -0000 1.3 --- EndOfDayTimerHandlerBiasedPVO.cs 14 Jan 2008 23:07:03 -0000 1.4 *************** *** 25,28 **** --- 25,31 ---- using QuantProject.ADT; + using QuantProject.ADT.Statistics; + using QuantProject.ADT.FileManaging; + using QuantProject.Business.DataProviders; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Instruments; *************** *** 30,33 **** --- 33,39 ---- using QuantProject.Business.Timing; using QuantProject.Business.Strategies; + using QuantProject.Business.Strategies.ReturnsManagement; + using QuantProject.Business.Strategies.ReturnsManagement.Time; + using QuantProject.Business.Strategies.TickersRelationships; using QuantProject.Data; using QuantProject.Data.DataProviders; *************** *** 39,43 **** using QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator; using QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator.WeightedPVO.WeightedBalancedPVO; - using QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator.BiasedPVO.BiasedPVONoThresholds; namespace QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator.BiasedPVO --- 45,48 ---- *************** *** 49,65 **** /// </summary> [Serializable] ! public class EndOfDayTimerHandlerBiasedPVO : EndOfDayTimerHandlerBiasedPVONoThresholds { ! new protected double[] currentOverboughtThreshold; new protected double[] currentOversoldThreshold; ! public EndOfDayTimerHandlerBiasedPVO(string tickerGroupID, int numberOfEligibleTickers, int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, ! Account account, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, int numOfDifferentGenomesToEvaluateOutOfSample, int numDaysForOscillatingPeriod, int minLevelForOversoldThreshold, int maxLevelForOversoldThreshold, --- 54,98 ---- /// </summary> [Serializable] ! public class EndOfDayTimerHandlerBiasedPVO : EndOfDayTimerHandlerPVO { ! protected int numOfDifferentGenomesToEvaluateOutOfSample; ! protected int currentGenomeIndex = 0; ! protected double currentWeightedPositionsGainOrLoss = 0.0; ! protected Hashtable genomesCollector; ! protected WeightedPositions[] weightedPositionsToEvaluateOutOfSample; ! new protected double[] currentOverboughtThreshold; new protected double[] currentOversoldThreshold; + protected double maxCoefficientForDegreeComputationOfCrossingThreshold; + protected int numDaysWithOpenPositions; + protected double numOfStdDevForThresholdsComputation; + protected int numDaysOfStayingOnTheMarket; + protected bool resetThresholdsBeforeCheckingOutOfSample; + protected int numDaysForThresholdsReComputation; + protected bool buyOnlyPositionsThatAreMovingTogether; + protected bool doNotOpenReversedPositionsThatHaveJustBeenClosed; + protected double minPriceForTickersToBeChosen; + protected double maxPriceForTickersToBeChosen; + protected WeightedPositions lastWeightedPositionsClosed; + protected string pathOfFileContainingGenomes; + protected OptimizationOutput optimizationOutput; ! public EndOfDayTimerHandlerBiasedPVO(string tickerGroupID, int numberOfEligibleTickers, ! double minPriceForTickersToBeChosen, ! double maxPriceForTickersToBeChosen, int numberOfTickersToBeChosen, int numDaysForOptimizationPeriod, ! Account account, ! string pathOfFileContainingGenomes, int generationNumberForGeneticOptimizer, int populationSizeForGeneticOptimizer, string benchmark, int numOfDifferentGenomesToEvaluateOutOfSample, + bool resetThresholdsBeforeCheckingOutOfSample, + int numDaysForThresholdsReComputation, + double numOfStdDevForThresholdsComputation, + double maxCoefficientForDegreeComputationOfCrossingThreshold, + bool buyOnlyPositionsThatAreMovingTogether, + bool doNotOpenReversedPositionsThatHaveJustBeenClosed, int numDaysForOscillatingPeriod, + int numDaysOfStayingOnTheMarket, int minLevelForOversoldThreshold, int maxLevelForOversoldThreshold, *************** *** 72,103 **** PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown, double minimumAcceptableGain): ! base(tickerGroupID, numberOfEligibleTickers, ! numberOfTickersToBeChosen, numDaysForOptimizationPeriod, ! account, generationNumberForGeneticOptimizer, ! populationSizeForGeneticOptimizer, benchmark, ! numOfDifferentGenomesToEvaluateOutOfSample, ! numDaysBetweenEachOptimization, ! portfolioType, maxAcceptableCloseToCloseDrawdown, ! minimumAcceptableGain) { this.currentOverboughtThreshold = new double[numOfDifferentGenomesToEvaluateOutOfSample]; ! this.currentOversoldThreshold = new double[numOfDifferentGenomesToEvaluateOutOfSample]; ! this.numDaysForOscillatingPeriod = numDaysForOscillatingPeriod; ! this.minLevelForOversoldThreshold = minLevelForOversoldThreshold; ! this.maxLevelForOversoldThreshold = maxLevelForOversoldThreshold; ! this.minLevelForOverboughtThreshold = minLevelForOverboughtThreshold; ! this.maxLevelForOverboughtThreshold = maxLevelForOverboughtThreshold; ! this.divisorForThresholdComputation = divisorForThresholdComputation; ! this.symmetricalThresholds =symmetricalThresholds; ! this.overboughtMoreThanOversoldForFixedPortfolio = overboughtMoreThanOversoldForFixedPortfolio; } - #region MarketCloseEventHandler //sets currentGenomeIndex with the genome's index that crosses an overbought/oversold threshold with the ! //highest degree and sets currentTickersGainOrLoss accordingly ! protected override void openPositions_chooseBestGenome(IndexBasedEndOfDayTimer timer) { //default index is the first --- 105,272 ---- PortfolioType portfolioType, double maxAcceptableCloseToCloseDrawdown, double minimumAcceptableGain): ! base(tickerGroupID,numberOfEligibleTickers, ! numberOfTickersToBeChosen,numDaysForOptimizationPeriod, ! account, ! generationNumberForGeneticOptimizer, ! populationSizeForGeneticOptimizer, ! benchmark, ! numDaysForOscillatingPeriod, ! minLevelForOversoldThreshold, ! maxLevelForOversoldThreshold, ! minLevelForOverboughtThreshold, ! maxLevelForOverboughtThreshold, ! divisorForThresholdComputation, ! symmetricalThresholds, ! overboughtMoreThanOversoldForFixedPortfolio, ! numDaysBetweenEachOptimization, ! portfolioType, maxAcceptableCloseToCloseDrawdown, ! minimumAcceptableGain) ! { + this.minPriceForTickersToBeChosen = minPriceForTickersToBeChosen; + this.maxPriceForTickersToBeChosen = maxPriceForTickersToBeChosen; + this.numOfDifferentGenomesToEvaluateOutOfSample = numOfDifferentGenomesToEvaluateOutOfSample; + this.weightedPositionsToEvaluateOutOfSample = new WeightedPositions[numOfDifferentGenomesToEvaluateOutOfSample]; + this.currentOversoldThreshold = new double[numOfDifferentGenomesToEvaluateOutOfSample]; this.currentOverboughtThreshold = new double[numOfDifferentGenomesToEvaluateOutOfSample]; ! this.resetThresholdsBeforeCheckingOutOfSample = resetThresholdsBeforeCheckingOutOfSample; ! this.numDaysForThresholdsReComputation = numDaysForThresholdsReComputation; ! this.maxCoefficientForDegreeComputationOfCrossingThreshold = maxCoefficientForDegreeComputationOfCrossingThreshold; ! this.numOfStdDevForThresholdsComputation = numOfStdDevForThresholdsComputation; ! this.numDaysOfStayingOnTheMarket = numDaysOfStayingOnTheMarket; ! this.buyOnlyPositionsThatAreMovingTogether = buyOnlyPositionsThatAreMovingTogether; ! this.doNotOpenReversedPositionsThatHaveJustBeenClosed = doNotOpenReversedPositionsThatHaveJustBeenClosed; ! this.genomesCollector = new Hashtable(); ! this.pathOfFileContainingGenomes = pathOfFileContainingGenomes; ! } ! ! //to avoid handlers in inherited classes ! public override void MarketOpenEventHandler( ! Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) ! { ! ; } #region MarketCloseEventHandler + protected virtual double getCurrentWeightedPositionsGainOrLoss( + IndexBasedEndOfDayTimer timer, + ReturnsManager returnsManager, + int indexForChosenWeightedPositions ) + { + double returnValue = double.MinValue; + try + { + returnValue = + this.weightedPositionsToEvaluateOutOfSample[indexForChosenWeightedPositions].GetReturn( + 0 , returnsManager); + } + catch(MissingQuotesException ex) + { + ex = ex; + } + return returnValue; + } + protected bool areAllTickersMovingTogetherUpOrDown( + IndexBasedEndOfDayTimer timer, + ReturnsManager returnsManager, + int indexForChosenWeightedPositions ) + { + bool returnValue = true; + SignedTickers signedTickers = + this.weightedPositionsToEvaluateOutOfSample[indexForChosenWeightedPositions].SignedTickers; + float returnOfCurrentTicker, returnOfNextTicker; + for( int i = 0; + signedTickers.Count > 1 && i < signedTickers.Count - 1 && returnValue == true; + i++ ) + { + returnOfCurrentTicker = returnsManager.GetReturn(signedTickers[ i ].Ticker, 0); + returnOfNextTicker = returnsManager.GetReturn(signedTickers[ i+1 ].Ticker, 0); + if( (returnOfCurrentTicker > 0 && returnOfNextTicker < 0) || + (returnOfCurrentTicker < 0 && returnOfNextTicker > 0) ) + returnValue = false; + } + return returnValue; + } + + protected virtual void openPositions_chooseGenome_resetThresholds(DateTime today) + { + for(int i = 0; i < this.weightedPositionsToEvaluateOutOfSample.Length; i++) + { + this.currentOversoldThreshold[i] = (double)this.maxLevelForOversoldThreshold/ + (double)this.divisorForThresholdComputation; + this.currentOverboughtThreshold[i] = (double)this.maxLevelForOverboughtThreshold/ + (double)this.divisorForThresholdComputation; + } + // + // ReturnsManager returnsManager = new ReturnsManager( + // new CloseToCloseIntervals(new EndOfDayDateTime(today.AddDays(-this.numDaysForThresholdsReComputation), EndOfDaySpecificTime.MarketClose), + // new EndOfDayDateTime(today, EndOfDaySpecificTime.MarketClose), + // this.benchmark, + // this.numDaysForOscillatingPeriod), + // new HistoricalAdjustedQuoteProvider() ); + // //double returnsAverage; + // double returnsStdDev; + // for(int i = 0; i < this.weightedPositionsToEvaluateOutOfSample.Length; i++) + // { + //// returnsAverage = BasicFunctions.GetSimpleAverage( + //// this.weightedPositionsToEvaluateOutOfSample[i].GetReturns(returnsManager) ); + // returnsStdDev = BasicFunctions.GetStdDev( + // this.weightedPositionsToEvaluateOutOfSample[i].GetReturns(returnsManager) ); + // this.currentOversoldThreshold[i] = -this.numOfStdDevForThresholdsComputation * returnsStdDev; + // this.currentOverboughtThreshold[i] = this.numOfStdDevForThresholdsComputation * returnsStdDev; + // } + } + //NEW IMPLEMENTATION of chooseBestGenome, now named chooseGenome + //sets currentGenomeIndex with the first genome's index that crosses an overbought/oversold threshold with the + //"acceptable" degree and sets currentWeightedPositionsGainOrLoss accordingly + protected virtual void openPositions_chooseGenome(IndexBasedEndOfDayTimer timer) + { + DateTime today = timer.GetCurrentTime().DateTime; + DateTime firstMarketDayForOscillatingPeriod = + timer.GetPreviousDateTime(this.numDaysForOscillatingPeriod); + ReturnsManager returnsManager = new ReturnsManager( + new CloseToCloseIntervals(new EndOfDayDateTime(firstMarketDayForOscillatingPeriod, EndOfDaySpecificTime.MarketClose), + new EndOfDayDateTime(today, EndOfDaySpecificTime.MarketClose), + this.benchmark, + this.numDaysForOscillatingPeriod), + new HistoricalAdjustedQuoteProvider() ); + if(this.resetThresholdsBeforeCheckingOutOfSample) + this.openPositions_chooseGenome_resetThresholds(today); + this.currentWeightedPositionsGainOrLoss = double.MinValue; + double currentWeightedPositionsGainOrLoss_temp = double.MinValue; + for(int i = 0; i < this.numOfDifferentGenomesToEvaluateOutOfSample; i++) + { + currentWeightedPositionsGainOrLoss_temp = + this.getCurrentWeightedPositionsGainOrLoss( + timer, returnsManager, i); + if( currentWeightedPositionsGainOrLoss_temp != double.MinValue && + ( this.buyOnlyPositionsThatAreMovingTogether == false || + ( this.buyOnlyPositionsThatAreMovingTogether == true && + this.areAllTickersMovingTogetherUpOrDown(timer, returnsManager, i) == true ) ) ) + //currentWeightedPositionsGainOrLoss_temp has been properly computed and + //only positions that are moving together can be bought + { + if( (currentWeightedPositionsGainOrLoss_temp >= this.currentOverboughtThreshold[i] && + currentWeightedPositionsGainOrLoss_temp <= this.maxCoefficientForDegreeComputationOfCrossingThreshold * + this.currentOverboughtThreshold[i] ) || + (currentWeightedPositionsGainOrLoss_temp <= - this.currentOversoldThreshold[i] && + Math.Abs(currentWeightedPositionsGainOrLoss_temp) <= this.maxCoefficientForDegreeComputationOfCrossingThreshold * + this.currentOversoldThreshold[i] ) ) + // if the current genome matches the requested criteria + { + this.currentGenomeIndex = i; + this.currentWeightedPositionsGainOrLoss = currentWeightedPositionsGainOrLoss_temp; + i = this.numOfDifferentGenomesToEvaluateOutOfSample; //exit from for + } + } + } + } + + /* OLD IMPLEMENTATION OF chooseBestGenome //sets currentGenomeIndex with the genome's index that crosses an overbought/oversold threshold with the ! //highest "acceptable" degree and sets currentWeightedPositionsGainOrLoss accordingly ! protected void openPositions_chooseBestGenome(IndexBasedEndOfDayTimer timer) { //default index is the first *************** *** 106,132 **** double currentMaxDegreeOfCrossingThreshold = 0.0; double currentDegreeOfCrossingThreshold = 0.0; for(int i = 0; i < this.numOfDifferentGenomesToEvaluateOutOfSample; i++) { double currentChosenWeightedPositionsGainOrLoss = ! this.getCurrentWeightedPositionsGainOrLoss(timer, i); ! if(currentChosenWeightedPositionsGainOrLoss != 999.0) ! //currentChosenTickersValue has been properly computed { ! //computing degree of crossing threshold ! if(currentChosenWeightedPositionsGainOrLoss >= 1.0 + this.currentOverboughtThreshold[i]) { currentDegreeOfCrossingThreshold = ! (currentChosenWeightedPositionsGainOrLoss - 1.0 - this.currentOverboughtThreshold[i])/ ! (1 + this.currentOverboughtThreshold[i]); } ! else if (currentChosenWeightedPositionsGainOrLoss <= 1.0 - this.currentOversoldThreshold[i]) { currentDegreeOfCrossingThreshold = ! (1.0 - this.currentOversoldThreshold[i] - currentChosenWeightedPositionsGainOrLoss)/ ! (1.0 - this.currentOversoldThreshold[i]); } ! if(currentDegreeOfCrossingThreshold > currentMaxDegreeOfCrossingThreshold) ! { currentMaxDegreeOfCrossingThreshold = currentDegreeOfCrossingThreshold; this.currentGenomeIndex = i; --- 275,337 ---- double currentMaxDegreeOfCrossingThreshold = 0.0; double currentDegreeOfCrossingThreshold = 0.0; + DateTime today = timer.GetCurrentTime().DateTime; + DateTime firstMarketDayForOscillatingPeriod = + timer.GetPreviousDateTime(this.numDaysForOscillatingPeriod); + ReturnsManager returnsManager = new ReturnsManager( + new CloseToCloseIntervals(new EndOfDayDateTime(firstMarketDayForOscillatingPeriod, EndOfDaySpecificTime.MarketClose), + new EndOfDayDateTime(today, EndOfDaySpecificTime.MarketClose), + this.benchmark, + this.numDaysForOscillatingPeriod), + new HistoricalAdjustedQuoteProvider() ); + if(this.resetThresholdsBeforeCheckingOutOfSample) + this.openPositions_chooseBestGenome_resetThresholds(today); + this.currentWeightedPositionsGainOrLoss = 999.0; for(int i = 0; i < this.numOfDifferentGenomesToEvaluateOutOfSample; i++) { double currentChosenWeightedPositionsGainOrLoss = ! this.getCurrentWeightedPositionsGainOrLoss( ! timer, returnsManager, i); ! if(currentChosenWeightedPositionsGainOrLoss != 999.0) ! //currentChosenWeightedPositionsGainOrLoss has been properly computed { ! if( ( this.buyOnlyPositionsThatAreMovingTogether == false || ! ( this.buyOnlyPositionsThatAreMovingTogether == true && ! this.areAllTickersMovingTogetherUpOrDown(timer, returnsManager, i) == true ) ) && ! currentChosenWeightedPositionsGainOrLoss >= this.currentOverboughtThreshold[i] && ! currentChosenWeightedPositionsGainOrLoss <= this.maxCoefficientForDegreeComputationOfCrossingThreshold * ! this.currentOverboughtThreshold[i] ) ! // if it is requested that current tickers have to move together in the same direction ! // if current gain crosses overbought threshold but not ! // as maxCoefficientForDegreeComputationOfCrossingThreshold times ! // as overbought threshold (that is, it could be a reasonable ! // market inefficiency) { currentDegreeOfCrossingThreshold = ! (currentChosenWeightedPositionsGainOrLoss - this.currentOverboughtThreshold[i])/ ! this.currentOverboughtThreshold[i]; } ! else if ( ( this.buyOnlyPositionsThatAreMovingTogether == false || ! ( this.buyOnlyPositionsThatAreMovingTogether == true && ! this.areAllTickersMovingTogetherUpOrDown(timer, returnsManager, i) == true ) ) && ! currentChosenWeightedPositionsGainOrLoss <= - this.currentOversoldThreshold[i] && ! Math.Abs(currentChosenWeightedPositionsGainOrLoss) <= this.maxCoefficientForDegreeComputationOfCrossingThreshold * ! this.currentOversoldThreshold[i] ) ! // if it is requested that current tickers have to move together in the same direction ! // if current loss crosses oversold threshold but not ! // as maxCoefficientForDegreeComputationOfCrossingThreshold times ! // as oversold threshold (that is, it could be a reasonable ! // market inefficiency) { currentDegreeOfCrossingThreshold = ! ( Math.Abs(currentChosenWeightedPositionsGainOrLoss) - this.currentOversoldThreshold[i])/ ! this.currentOversoldThreshold[i]; } ! ! if(currentDegreeOfCrossingThreshold > currentMaxDegreeOfCrossingThreshold) ! // if a genome crosses a threshold without crossing ! // as maxCoefficientForDegreeComputationOfCrossingThreshold times ! // as oversold or overbought thresholds ! { currentMaxDegreeOfCrossingThreshold = currentDegreeOfCrossingThreshold; this.currentGenomeIndex = i; *************** *** 136,156 **** } } ! protected override void openPositions(IndexBasedEndOfDayTimer timer) { ! this.currentWeightedPositionsGainOrLoss = 999.0; // ! this.openPositions_chooseBestGenome(timer); ! if(this.currentWeightedPositionsGainOrLoss != 999.0) ! //currentWeightedPositionsGainOrLoss has been properly computed { ! if(this.currentWeightedPositionsGainOrLoss >= 1.0 + currentOverboughtThreshold[this.currentGenomeIndex] && ! this.portfolioType == PortfolioType.ShortAndLong) { this.weightedPositionsToEvaluateOutOfSample[this.currentGenomeIndex].Reverse(); try{ ! AccountManager.OpenPositions(this.weightedPositionsToEvaluateOutOfSample[this.currentGenomeIndex], ! this.account); ! this.portfolioHasBeenOverbought = true; ! this.portfolioHasBeenOversold = false; } catch(Exception ex){ --- 341,382 ---- } } + *///END OF OLD IMPLEMENTATION + + protected void openPositions_open(WeightedPositions weightedPositions, bool overboughtPortfolio) + { + if( this.lastWeightedPositionsClosed == null || + !this.doNotOpenReversedPositionsThatHaveJustBeenClosed || + !weightedPositions.HasTheOppositeSignedTickersAs(this.lastWeightedPositionsClosed) ) + //it is the first time positions are opening or + //positions that have been just closed can be reversed or + //positions to be opened are just the reversed + //positions that have just been closed + { + AccountManager.OpenPositions(weightedPositions, this.account); + this.portfolioHasBeenOverbought = overboughtPortfolio; + this.portfolioHasBeenOversold = !overboughtPortfolio; + } + } ! protected void openPositions(IndexBasedEndOfDayTimer timer) { ! this.currentWeightedPositionsGainOrLoss = double.MinValue; ! try{ ! this.openPositions_chooseGenome(timer); ! //if the genome has been chosen, then this.currentWeightedPositionsGainOrLoss ! //has been set to a value different from double.MinValue ! } ! catch(Exception ex){ ! ex=ex; ! } ! if(this.currentWeightedPositionsGainOrLoss != double.MinValue) ! //there is a genome that matches requested criteria { ! if(this.currentWeightedPositionsGainOrLoss >= currentOverboughtThreshold[this.currentGenomeIndex] && ! (this.portfolioType == PortfolioType.ShortAndLong || this.portfolioType == PortfolioType.OnlyMixed) ) { this.weightedPositionsToEvaluateOutOfSample[this.currentGenomeIndex].Reverse(); try{ ! this.openPositions_open(weightedPositionsToEvaluateOutOfSample[this.currentGenomeIndex],true); } catch(Exception ex){ *************** *** 161,184 **** } } ! else if (this.currentWeightedPositionsGainOrLoss <= 1.0 - currentOversoldThreshold[this.currentGenomeIndex]) { ! AccountManager.OpenPositions(this.weightedPositionsToEvaluateOutOfSample[this.currentGenomeIndex], ! this.account); ! this.portfolioHasBeenOverbought = false; ! this.portfolioHasBeenOversold = true; } ! this.currentAccountValue = this.account.GetMarketValue(); } } ! public override void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { if(this.account.Portfolio.Count > 0) ! this.marketCloseEventHandler_closeIfItIsTimeToClose(); ! else if ( this.account.Portfolio.Count == 0 && ! this.weightedPositionsToEvaluateOutOfSample != null ) ! //portfolio is empty and optimization has been already launched ! this.openPositions((IndexBasedEndOfDayTimer)sender); } --- 387,443 ---- } } ! else if (this.currentWeightedPositionsGainOrLoss <= - currentOversoldThreshold[this.currentGenomeIndex]) { ! this.openPositions_open(weightedPositionsToEvaluateOutOfSample[this.currentGenomeIndex],false); } ! this.previousAccountValue = this.account.GetMarketValue(); } } ! ! ! private bool marketCloseEventHandler_isTimerStateValidForStrategy(IndexBasedEndOfDayTimer timer) ! { ! bool returnValue; ! DateTime currentTime = timer.GetCurrentTime().DateTime; ! DateTime firstDateOfOscillatingPeriod = ! timer.GetPreviousDateTime(this.numDaysForOscillatingPeriod); ! returnValue = currentTime.CompareTo(firstDateOfOscillatingPeriod) > 0; ! return returnValue; ! //currentTime is greater than the date at which previous close ! //has to be compared to the current close with respect to ! //the oscillating strategy's criteria ! } ! ! protected override void marketCloseEventHandler_closePositionsIfNeeded() ! { ! if( this.numDaysWithOpenPositions == this.numDaysOfStayingOnTheMarket || ! this.stopLossConditionReached || this.takeProfitConditionReached ) ! { ! this.lastWeightedPositionsClosed = AccountManager.GetWeightedPositions(this.account); ! AccountManager.ClosePositions(this.account); ! this.portfolioHasBeenOverbought = false; ! this.portfolioHasBeenOversold = false; ! this.numDaysWithOpenPositions = 0; ! } ! } ! public override void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { if(this.account.Portfolio.Count > 0) ! { ! this.numDaysWithOpenPositions++; ! this.marketCloseEventHandler_updateStopLossAndTakeProfitConditions(); ! this.marketCloseEventHandler_closePositionsIfNeeded(); ! } ! ! if ( this.account.Portfolio.Count == 0 && ! this.weightedPositionsToEvaluateOutOfSample[0] != null && ! this.marketCloseEventHandler_isTimerStateValidForStrategy( (IndexBasedEndOfDayTimer)sender) ) ! //portfolio is empty and optimization has been already launched and ! //currentTime is greater than the date at which previous close ! //has to be compared to the current close with respect to ! //the oscillating strategy's criteria ! this.openPositions( (IndexBasedEndOfDayTimer)sender ); } *************** *** 188,192 **** #region OneHourAfterMarketCloseEventHandler ! private void setTickers_updateTickersWeightsAndThresholdsAndAddGenomesForLog(GeneticOptimizer GO, int eligibleTickersForGO) { --- 447,451 ---- #region OneHourAfterMarketCloseEventHandler ! protected void setTickers_updateTickersWeightsAndThresholdsAndAddGenomesForLog(GeneticOptimizer GO, int eligibleTickersForGO) { *************** *** 226,229 **** --- 485,516 ---- } + protected override DataTable getSetOfTickersToBeOptimized(DateTime currentDate) + { + SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, currentDate); + DataTable tickersFromGroup = temporizedGroup.GetTableOfSelectedTickers(); + int numOfTickersInGroupAtCurrentDate = tickersFromGroup.Rows.Count; + + SelectorByAverageRawOpenPrice byPrice = + new SelectorByAverageRawOpenPrice(tickersFromGroup,false,currentDate.AddDays(-15), + currentDate, + numOfTickersInGroupAtCurrentDate, + this.minPriceForTickersToBeChosen,this.maxPriceForTickersToBeChosen, + 0.0001,100); + + SelectorByLiquidity mostLiquidSelector = + new SelectorByLiquidity(byPrice.GetTableOfSelectedTickers(), + false,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, + this.numberOfEligibleTickers); + + SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromLastSelection = + new SelectorByQuotationAtEachMarketDay(mostLiquidSelector.GetTableOfSelectedTickers(), + false, currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, + this.numberOfEligibleTickers, this.benchmark); + + return quotedAtEachMarketDayFromLastSelection.GetTableOfSelectedTickers(); + + } + + protected override void setTickers(DateTime currentDate, bool setGenomeCounter) *************** *** 231,235 **** DataTable setOfTickersToBeOptimized = this.getSetOfTickersToBeOptimized(currentDate); this.iGenomeManager = ! new GenomeManagerWeightedBalancedPVO(setOfTickersToBeOptimized, currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfTickersToBeChosen, --- 518,522 ---- DataTable setOfTickersToBeOptimized = this.getSetOfTickersToBeOptimized(currentDate); this.iGenomeManager = ! new GenomeManagerPVO(setOfTickersToBeOptimized, currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, this.numberOfTickersToBeChosen, *************** *** 242,253 **** this.symmetricalThresholds, this.overboughtMoreThanOversoldForFixedPortfolio, ! this.portfolioType); GeneticOptimizer GO = new GeneticOptimizer(this.iGenomeManager, this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, this.seedForRandomGenerator); ! if(setGenomeCounter) ! this.genomeCounter = new GenomeCounter(GO); ! GO.MutationRate = 0.1; GO.CrossoverRate = 0.85; --- 529,539 ---- this.symmetricalThresholds, this.overboughtMoreThanOversoldForFixedPortfolio, ! this.portfolioType, this.benchmark); GeneticOptimizer GO = new GeneticOptimizer(this.iGenomeManager, this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, this.seedForRandomGenerator); ! // if(setGenomeCounter) ! // this.genomeCounter = new GenomeCounter(GO); GO.MutationRate = 0.1; GO.CrossoverRate = 0.85; *************** *** 258,261 **** --- 544,625 ---- } + private void setTickersFromFile_updateWeightedPositionsToEvaluateOutOfSample_addGenomeRepresentation(GenomeRepresentation genomeRepresentation) + { + WeightedPositions weightedPositions = new WeightedPositions( + GenomeRepresentation.GetWeightsArray(genomeRepresentation.WeightsForSignedTickers), + new SignedTickers(GenomeRepresentation.GetSignedTickers(genomeRepresentation.SignedTickers)) ); + for(int i = 0; i<this.weightedPositionsToEvaluateOutOfSample.Length; i++) + { + if(this.weightedPositionsToEvaluateOutOfSample[i] == null) + { + this.weightedPositionsToEvaluateOutOfSample[i] = weightedPositions; + this.currentOversoldThreshold[i] = genomeRepresentation.OversoldThreshold; + this.currentOverboughtThreshold[i] = genomeRepresentation.OverboughtThreshold; + i = this.weightedPositionsToEvaluateOutOfSample.Length;//exit from for + } + } + } + + private void setTickersFromFile_updateWeightedPositionsToEvaluateOutOfSample(DateTime currentDate) + { + GenomeRepresentation currentGenomeRepresentation; + for(int i = 0; i<this.optimizationOutput.Count;i++) + { + currentGenomeRepresentation = (GenomeRepresentation)this.optimizationOutput[i]; + if(currentGenomeRepresentation.LastOptimizationDate == currentDate) + { + this.setTickersFromFile_updateWeightedPositionsToEvaluateOutOfSample_addGenomeRepresentation( + currentGenomeRepresentation); + } + } + } + + private void setTickersFromFile_loadGenomesFromFile() + { + if( this.optimizationOutput == null ) + this.optimizationOutput = + (OptimizationOutput)ObjectArchiver.Extract( + this.pathOfFileContainingGenomes); + } + + private void setTickersFromFile_clearWeightedPositionsToEvaluateOutOfSample() + { + for(int i = 0; i< this.weightedPositionsToEvaluateOutOfSample.Length; i++) + this.weightedPositionsToEvaluateOutOfSample[i] = null; + } + + private void setTickersFromFile(DateTime currentDate) + { + this.setTickersFromFile_loadGenomesFromFile(); + this.setTickersFromFile_clearWeightedPositionsToEvaluateOutOfSample(); + this.setTickersFromFile_updateWeightedPositionsToEvaluateOutOfSample(currentDate); + } + + /// <summary> + /// Handles a "One hour after market close" event. + /// </summary> + /// <param name="sender"></param> + /// <param name="eventArgs"></param> + public override void OneHourAfterMarketCloseEventHandler( + Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) + { + this.lastCloseDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; + this.seedForRandomGenerator++; + this.numDaysElapsedSinceLastOptimization++; + if((this.numDaysElapsedSinceLastOptimization == + this.numDaysBetweenEachOptimization)) + //num days without optimization has elapsed + { + if(this.pathOfFileContainingGenomes == null) + //tickers have to be set by a new optimization process (in sample) + this.setTickers(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime, false); + //sets tickers to be chosen next Market Close event + else//this.pathOfFileContainingGenomes != null + this.setTickersFromFile(endOfDayTimingEventArgs.EndOfDayDateTime.DateTime); + //set tickers from file + this.numDaysElapsedSinceLastOptimization = 0; + } + } + #endregion |