[Quantproject-developers] QuantProject/b7_Scripts/TechnicalAnalysisTesting/TrendFollowing/Immediate
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2006-08-07 21:09:18
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/TrendFollowing/ImmediateTrendFollower In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv24647/b7_Scripts/TechnicalAnalysisTesting/TrendFollowing/ImmediateTrendFollower Modified Files: EndOfDayTimerHandlerITF.cs Log Message: Updated the base handler for tickerSelection strategies (OTC, etc.) and for other strategies (ECT, FixedPeriodOscillator, ImmediateTrendFollower). Index: EndOfDayTimerHandlerITF.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/TrendFollowing/ImmediateTrendFollower/EndOfDayTimerHandlerITF.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EndOfDayTimerHandlerITF.cs 3 Aug 2006 21:14:13 -0000 1.1 --- EndOfDayTimerHandlerITF.cs 7 Aug 2006 21:09:15 -0000 1.2 *************** *** 57,60 **** --- 57,61 ---- private DateTime lastCloseDate; private IGenomeManager iGenomeManager; + private int seedForRandomGenerator; public EndOfDayTimerHandlerITF(string tickerGroupID, int numberOfEligibleTickers, *************** *** 81,84 **** --- 82,86 ---- // this.numDaysBetweenEachOptimization = 2* numDaysForReturnCalculation; this.numDaysBetweenEachOptimization = numDaysBetweenEachOptimization; + this.seedForRandomGenerator = ConstantsProvider.SeedForRandomGenerator; } *************** *** 135,141 **** SignedTicker.ChangeSignOfEachTicker(this.chosenTickers); //short the portfolio ! try{ base.openPositions(); } ! catch(Exception ex){ ex = ex; } ! finally{SignedTicker.ChangeSignOfEachTicker(this.chosenTickers);} } } --- 137,150 ---- SignedTicker.ChangeSignOfEachTicker(this.chosenTickers); //short the portfolio ! try{ ! base.openPositions(); ! } ! catch(Exception ex) ! { ! ex = ex; ! } ! finally{ ! SignedTicker.ChangeSignOfEachTicker(this.chosenTickers); ! } } } *************** *** 144,148 **** private void marketCloseEventHandler_closePositions() { - this.daysCounterWithPositions++; if(this.daysCounterWithPositions == this.numDaysForReturnCalculation || this.stopLossConditionReached) --- 153,156 ---- *************** *** 158,161 **** --- 166,171 ---- { //this.marketCloseEventHandler_updateStopLossCondition(); + if(this.account.Portfolio.Count > 0) + this.daysCounterWithPositions++; this.marketCloseEventHandler_closePositions(); if(this.chosenTickers[0] != null) *************** *** 184,193 **** numOfTickersInGroupAtCurrentDate, 30,500, 0.0001,100); ! ! // SelectorByLiquidity mostLiquidSelector = ! // new SelectorByLiquidity(byPrice.GetTableOfSelectedTickers(), ! // false,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! // this.numberOfEligibleTickers); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromByPrice = new SelectorByQuotationAtEachMarketDay(byPrice.GetTableOfSelectedTickers(), --- 194,198 ---- numOfTickersInGroupAtCurrentDate, 30,500, 0.0001,100); ! SelectorByQuotationAtEachMarketDay quotedAtEachMarketDayFromByPrice = new SelectorByQuotationAtEachMarketDay(byPrice.GetTableOfSelectedTickers(), *************** *** 195,204 **** numOfTickersInGroupAtCurrentDate, this.benchmark); ! SelectorByCloseToCloseVolatility lessVolatile = ! new SelectorByCloseToCloseVolatility(quotedAtEachMarketDayFromByPrice.GetTableOfSelectedTickers(), ! true,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! this.numberOfEligibleTickers); ! return lessVolatile.GetTableOfSelectedTickers(); //OLD for etf // SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, --- 200,215 ---- numOfTickersInGroupAtCurrentDate, this.benchmark); ! // SelectorByCloseToCloseVolatility lessVolatile = ! // new SelectorByCloseToCloseVolatility(quotedAtEachMarketDayFromByPrice.GetTableOfSelectedTickers(), ! // true,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! // this.numberOfEligibleTickers); ! SelectorByLiquidity mostLiquidSelector = ! new SelectorByLiquidity(quotedAtEachMarketDayFromByPrice.GetTableOfSelectedTickers(), ! true,currentDate.AddDays(-this.numDaysForOptimizationPeriod), currentDate, ! this.numberOfEligibleTickers); ! ! ! return mostLiquidSelector.GetTableOfSelectedTickers(); //OLD for etf // SelectorByGroup temporizedGroup = new SelectorByGroup(this.tickerGroupID, *************** *** 247,251 **** this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! ConstantsProvider.SeedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); --- 258,262 ---- this.populationSizeForGeneticOptimizer, this.generationNumberForGeneticOptimizer, ! this.seedForRandomGenerator); if(setGenomeCounter) this.genomeCounter = new GenomeCounter(GO); *************** *** 253,257 **** GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, setOfTickersToBeOptimized.Rows.Count); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; --- 264,269 ---- GO.Run(false); this.addGenomeToBestGenomes(GO.BestGenome,((GenomeManagerForEfficientPortfolio)this.iGenomeManager).FirstQuoteDate, ! ((GenomeManagerForEfficientPortfolio)this.iGenomeManager).LastQuoteDate, setOfTickersToBeOptimized.Rows.Count, ! this.numDaysForReturnCalculation); this.chosenTickers = ((GenomeMeaning)GO.BestGenome.Meaning).Tickers; this.chosenTickersPortfolioWeights = ((GenomeMeaning)GO.BestGenome.Meaning).TickersPortfolioWeights; *************** *** 270,274 **** { this.lastCloseDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; ! ConstantsProvider.SeedForRandomGenerator++; this.numDaysElapsedSinceLastOptimization++; this.orders.Clear(); --- 282,286 ---- { this.lastCloseDate = endOfDayTimingEventArgs.EndOfDayDateTime.DateTime; ! this.seedForRandomGenerator++; this.numDaysElapsedSinceLastOptimization++; this.orders.Clear(); |