[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank RunWalkForwa
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2004-12-26 17:47:36
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7141/b7_Scripts/WalkForwardTesting/WalkForwardOneRank Modified Files: RunWalkForwardOneRank.cs Log Message: - bug fixed: totalDays is properly computed, now - bug fixed: at the beginning, cash is added now Index: RunWalkForwardOneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/RunWalkForwardOneRank.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RunWalkForwardOneRank.cs 20 Dec 2004 00:14:53 -0000 1.4 --- RunWalkForwardOneRank.cs 26 Dec 2004 17:47:20 -0000 1.5 *************** *** 62,69 **** this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2002 , 1 , 1 ) , EndOfDaySpecificTime.FiveMinutesBeforeMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2002 , 12 , 31 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); ! this.numIntervalDays = 7; } #region Run --- 62,71 ---- this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( ! new DateTime( 2002 , 1 , 1 ) , EndOfDaySpecificTime.MarketOpen ); ! // this.endDateTime = new EndOfDayDateTime( ! // new DateTime( 2002 , 12 , 31 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); this.endDateTime = new EndOfDayDateTime( ! new DateTime( 2002 , 2 , 28 ) , EndOfDaySpecificTime.OneHourAfterMarketClose ); ! this.numIntervalDays = 7; } #region Run *************** *** 102,106 **** this.startDateTime.DateTime )).TotalDays ); double totalDays = Convert.ToDouble( ((TimeSpan)( this.endDateTime.DateTime - ! this.startDateTime.DateTime )).TotalDays ); if ( Math.Floor( elapsedDays / totalDays * 100 ) > Math.Floor( ( elapsedDays - 1 ) / totalDays * 100 ) ) --- 104,108 ---- this.startDateTime.DateTime )).TotalDays ); double totalDays = Convert.ToDouble( ((TimeSpan)( this.endDateTime.DateTime - ! this.startDateTime.DateTime )).TotalDays + 1); if ( Math.Floor( elapsedDays / totalDays * 100 ) > Math.Floor( ( elapsedDays - 1 ) / totalDays * 100 ) ) *************** *** 112,115 **** --- 114,123 ---- } } + public void marketOpenEventHandler( + Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) + { + if ( this.account.Transactions.Count == 0 ) + this.account.AddCash( 30000 ); + } public void oneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) *************** *** 123,126 **** --- 131,136 ---- this.account.EndOfDayTimer.Stop(); this.progressBarForm.Close(); + Report report = new Report( this.account ); + report.Show( "WFT One Rank" , this.numIntervalDays , this.endDateTime , "MSFT" ); } } *************** *** 128,136 **** public override void Run() { - Report report; run_initializeEndOfDayTimer(); run_initializeAccount(); run_initializeEndOfDayTimerHandler(); run_initializeProgressHandlers(); this.endOfDayTimer.OneHourAfterMarketClose += new OneHourAfterMarketCloseEventHandler( --- 138,147 ---- public override void Run() { run_initializeEndOfDayTimer(); run_initializeAccount(); run_initializeEndOfDayTimerHandler(); run_initializeProgressHandlers(); + this.endOfDayTimer.MarketOpen += + new MarketOpenEventHandler( this.marketOpenEventHandler ); this.endOfDayTimer.OneHourAfterMarketClose += new OneHourAfterMarketCloseEventHandler( *************** *** 144,149 **** this.progressBarForm.Show(); this.endOfDayTimer.Start(); - report = new Report( this.account ); - report.Show( "WFT One Rank" , this.numIntervalDays , this.startDateTime , "MSFT" ); } #endregion --- 155,158 ---- |