[Quantproject-developers] QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOs
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2008-03-12 22:05:38
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv8127 Modified Files: PVOLogItem.cs PVOMain.cs PVOStrategy.cs Log Message: Updated objects implementing the PVO strategy Index: PVOStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOStrategy.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PVOStrategy.cs 9 Mar 2008 22:49:25 -0000 1.1 --- PVOStrategy.cs 12 Mar 2008 22:05:33 -0000 1.2 *************** *** 84,88 **** public Account Account { ! set { this.account = value; } } protected bool stopLossConditionReached; --- 84,89 ---- public Account Account { ! get { return this.account; } ! set { this.account = value; } } protected bool stopLossConditionReached; Index: PVOMain.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOMain.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PVOMain.cs 9 Mar 2008 22:49:24 -0000 1.1 --- PVOMain.cs 12 Mar 2008 22:05:33 -0000 1.2 *************** *** 29,32 **** --- 29,33 ---- using QuantProject.Business.DataProviders; using QuantProject.Business.Strategies; + using QuantProject.Business.Financial.Accounting.AccountProviding; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.EquityEvaluation; *************** *** 100,125 **** return messageManager; } ! ! // TO DO check if you can add this to QuantProject.Presentation.Reporting.WindowsForm.Report ! // as a public method or as a new constructor ! // private void showReport( ! // DateTime lastDateTimeRequestedForTheScript , ! // EndOfDayStrategyBackTester endOfDayStrategyBackTester ) ! // { ! //// DateTime lastReportDateTime = ExtendedDateTime.Min( ! //// lastDateTimeRequestedForTheScript , ! //// endOfDayStrategyBackTester.EndOfDayTimer.GetCurrentTime().DateTime ); ! // DateTime lastReportDateTime = ! // endOfDayStrategyBackTester.ActualLastDateTime; ! // Report report = new Report( ! // endOfDayStrategyBackTester.AccountReport , ! // true ); ! // report.Create( endOfDayStrategyBackTester.DescriptionForLogFileName , 1 , ! // new EndOfDayDateTime( lastReportDateTime , ! // EndOfDaySpecificTime.OneHourAfterMarketClose ) , ! // endOfDayStrategyBackTester.Benchmark.Ticker ); ! // report.Show(); ! // } ! //Saves (in silent mode): //- a log file where the In Sample Analysis are --- 101,105 ---- return messageManager; } ! //Saves (in silent mode): //- a log file where the In Sample Analysis are *************** *** 153,157 **** //general DateTime firstDateTime = new DateTime( 2000 , 6 , 1 ); ! DateTime lastDateTime = new DateTime( 2000 , 7 , 31 ); double maxRunningHours = 5; Benchmark benchmark = new Benchmark( "^GSPC" ); --- 133,137 ---- //general DateTime firstDateTime = new DateTime( 2000 , 6 , 1 ); ! DateTime lastDateTime = new DateTime( 2001 , 6 , 1 ); double maxRunningHours = 5; Benchmark benchmark = new Benchmark( "^GSPC" ); *************** *** 164,184 **** // parameters for the in sample Chooser ! double crossoverRate = 0.85; ! double mutationRate = 0.02; ! double elitismRate = 0.001; ! int populationSizeForGeneticOptimizer = 500; ! int generationNumberForGeneticOptimizer = 10; int numberOfBestTestingPositionsToBeReturnedInSample = 5; int seedForRandomGenerator = QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator; int numDaysBetweenEachOptimization = 15; ! int minLevelForOversoldThreshold = 50; ! int maxLevelForOversoldThreshold = 100; ! int minLevelForOverboughtThreshold = 50; ! int maxLevelForOverboughtThreshold = 100; int divisorForThresholdComputation = 10000; int numDaysForOscillatingPeriodForChooser = 1; //for genetic optimization bool symmetricalThresholds = true; ! bool overboughtMoreThanOversoldForFixedPortfolio = false; double maxAcceptableCloseToCloseDrawdown = 0.03; double minimumAcceptableGain = 0.008; --- 144,164 ---- // parameters for the in sample Chooser ! // double crossoverRate = 0.85; ! // double mutationRate = 0.02; ! // double elitismRate = 0.001; ! // int populationSizeForGeneticOptimizer = 500; ! // int generationNumberForGeneticOptimizer = 10; int numberOfBestTestingPositionsToBeReturnedInSample = 5; int seedForRandomGenerator = QuantProject.ADT.ConstantsProvider.SeedForRandomGenerator; int numDaysBetweenEachOptimization = 15; ! // int minLevelForOversoldThreshold = 50; ! // int maxLevelForOversoldThreshold = 100; ! // int minLevelForOverboughtThreshold = 50; ! // int maxLevelForOverboughtThreshold = 100; int divisorForThresholdComputation = 10000; int numDaysForOscillatingPeriodForChooser = 1; //for genetic optimization bool symmetricalThresholds = true; ! // bool overboughtMoreThanOversoldForFixedPortfolio = false; double maxAcceptableCloseToCloseDrawdown = 0.03; double minimumAcceptableGain = 0.008; *************** *** 195,210 **** historicalQuoteProviderForInSampleChooser = historicalQuoteProviderForBackTester; historicalQuoteProviderForStrategy = historicalQuoteProviderForInSampleChooser; ! IInSampleChooser inSampleChooser = ! new PVOGeneticChooser(numDaysForOscillatingPeriodForChooser , ! numberOfPortfolioPositions , numberOfBestTestingPositionsToBeReturnedInSample, ! benchmark, decoderForTestingPositions , fitnessEvaluator , ! historicalQuoteProviderForInSampleChooser , ! crossoverRate , mutationRate , elitismRate , ! populationSizeForGeneticOptimizer , generationNumberForGeneticOptimizer , ! seedForRandomGenerator , minLevelForOversoldThreshold , ! maxLevelForOversoldThreshold , minLevelForOverboughtThreshold , ! maxLevelForOverboughtThreshold , divisorForThresholdComputation , ! symmetricalThresholds , overboughtMoreThanOversoldForFixedPortfolio ); //parameters for eligiblesSelector bool temporizedGroup = true; --- 175,194 ---- historicalQuoteProviderForInSampleChooser = historicalQuoteProviderForBackTester; historicalQuoteProviderForStrategy = historicalQuoteProviderForInSampleChooser; ! ! // IInSampleChooser inSampleChooser = ! // new PVOGeneticChooser(numDaysForOscillatingPeriodForChooser , ! // numberOfPortfolioPositions , numberOfBestTestingPositionsToBeReturnedInSample, ! // benchmark, decoderForTestingPositions , fitnessEvaluator , ! // historicalQuoteProviderForInSampleChooser , ! // crossoverRate , mutationRate , elitismRate , ! // populationSizeForGeneticOptimizer , generationNumberForGeneticOptimizer , ! // seedForRandomGenerator , minLevelForOversoldThreshold , ! // maxLevelForOversoldThreshold , minLevelForOverboughtThreshold , ! // maxLevelForOverboughtThreshold , divisorForThresholdComputation , ! // symmetricalThresholds , overboughtMoreThanOversoldForFixedPortfolio ); ! IInSampleChooser inSampleChooser = ! new PVO_CTCCorrelationChooser(numberOfBestTestingPositionsToBeReturnedInSample, ! numDaysForOscillatingPeriodForChooser); //parameters for eligiblesSelector bool temporizedGroup = true; *************** *** 235,245 **** new EndOfDayStrategyBackTester( this.strategyIdentifier , strategy , ! historicalQuoteProviderForBackTester , firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); - // TO DO check if you can do this assign in the EndOfDayStrategyBackTester - // constructor - strategy.Account = endOfDayStrategyBackTester.Account; - MessageManager messageManager = this.setMessageManager( eligiblesSelector , inSampleChooser , --- 219,226 ---- new EndOfDayStrategyBackTester( this.strategyIdentifier , strategy , ! historicalQuoteProviderForBackTester , ! new SimpleAccountProvider(), firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); MessageManager messageManager = this.setMessageManager( eligiblesSelector , inSampleChooser , *************** *** 251,262 **** #endregion Run - public void Run1() - { - BackTestLog backTestLog = - LogArchiver.Load( System.Configuration.ConfigurationSettings.AppSettings["LogArchive"] ); - LogViewer logViewer = - new LogViewer( backTestLog ); - logViewer.Show(); - } } } --- 232,235 ---- Index: PVOLogItem.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/PVOLogItem.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PVOLogItem.cs 9 Mar 2008 22:49:24 -0000 1.1 --- PVOLogItem.cs 12 Mar 2008 22:05:33 -0000 1.2 *************** *** 25,28 **** --- 25,29 ---- using QuantProject.Business.DataProviders; using QuantProject.Business.Strategies; + using QuantProject.Business.Financial.Accounting.AccountProviding; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.InSample; *************** *** 45,59 **** public class PVOLogItem : LogItem { ! // static public Random rand = new Random(4676); ! private TestingPositions[] bestPVOPositionsInSample; ! private int numberOfEligibleTickers; ! private double fitnessOfFirstPVOPositionsInSample; ! private double fitnessOfLastPVOPositionsInSample; ! private int generationOfFirstPVOPositionsInSample; ! private int generationOfLastPVOPositionsInSample; ! private string thresholdsOfFirst; ! private string thresholdsOfLast; ! private string tickersOfFirst; ! private string tickersOfLast; public TestingPositions[] BestPVOPositionsInSample --- 46,59 ---- public class PVOLogItem : LogItem { ! protected TestingPositions[] bestPVOPositionsInSample; ! protected int numberOfEligibleTickers; ! protected double fitnessOfFirstPVOPositionsInSample; ! protected double fitnessOfLastPVOPositionsInSample; ! protected int generationOfFirstPVOPositionsInSample; ! protected int generationOfLastPVOPositionsInSample; ! protected string thresholdsOfFirst; ! protected string thresholdsOfLast; ! protected string tickersOfFirst; ! protected string tickersOfLast; public TestingPositions[] BestPVOPositionsInSample *************** *** 191,195 **** new EndOfDayStrategyBackTester( "PVO" , strategy , ! historicalQuoteProviderForBackTester , firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); --- 191,196 ---- new EndOfDayStrategyBackTester( "PVO" , strategy , ! historicalQuoteProviderForBackTester , ! new SimpleAccountProvider(), firstDateTime , lastDateTime , benchmark , cashToStart , maxRunningHours ); |