[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank RunWalkForwa
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2005-04-24 15:52:31
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6436/b7_Scripts/WalkForwardTesting/WalkForwardOneRank Modified Files: RunWalkForwardOneRank.cs Log Message: - The progress bar form is in a new thread now (far better now) - IWalkForwardProgressNotifier interface is implemented ( InSampleNewProgress and OutOfSampleNewProgress events are exposed now) Index: RunWalkForwardOneRank.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardOneRank/RunWalkForwardOneRank.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RunWalkForwardOneRank.cs 30 Mar 2005 23:40:59 -0000 1.8 --- RunWalkForwardOneRank.cs 24 Apr 2005 15:52:23 -0000 1.9 *************** *** 24,27 **** --- 24,29 ---- using System.Collections; using System.Data; + using System.Threading; + using QuantProject.ADT; using QuantProject.ADT.FileManaging; *************** *** 44,48 **** /// when a fixed time span has elapsed. /// </summary> ! public class RunWalkForwardOneRank : Script { private IHistoricalQuoteProvider historicalQuoteProvider = --- 46,50 ---- /// when a fixed time span has elapsed. /// </summary> ! public class RunWalkForwardOneRank : Script , IWalkForwardProgressNotifier { private IHistoricalQuoteProvider historicalQuoteProvider = *************** *** 63,67 **** public RunWalkForwardOneRank() { - this.progressBarForm = new ProgressBarForm(); this.reportTable = new ReportTable( "Summary_Reports" ); this.startDateTime = new EndOfDayDateTime( --- 65,68 ---- *************** *** 71,74 **** --- 72,79 ---- this.numIntervalDays = 1; } + + public event NewProgressEventHandler InSampleNewProgress; + public event NewProgressEventHandler OutOfSampleNewProgress; + #region Run private void run_initializeEndOfDayTimer() *************** *** 95,101 **** Object sender , NewProgressEventArgs eventArgs ) { ! this.progressBarForm.ProgressBarInSample.Value = eventArgs.CurrentProgress; ! this.progressBarForm.ProgressBarInSample.Refresh(); } private void run_initializeProgressHandlers() { --- 100,118 ---- Object sender , NewProgressEventArgs eventArgs ) { ! this.InSampleNewProgress( this , eventArgs ); } + #region + private void run_initializeProgressBar_newThread() + { + this.progressBarForm = new ProgressBarForm( this ); + this.progressBarForm.ShowDialog(); + } + private void run_initializeProgressBar() + { + Thread thread = new Thread(new ThreadStart(run_initializeProgressBar_newThread)); + // thread.IsBackground = true; + thread.Start(); + } + #endregion private void run_initializeProgressHandlers() { *************** *** 115,121 **** { // a new out of sample time percentage point has been elapsed ! this.progressBarForm.ProgressBarOutOfSample.Value = ! Convert.ToInt16( Math.Floor( elapsedDays / totalDays * 100 ) ); ! this.progressBarForm.ProgressBarOutOfSample.Refresh(); } } --- 132,139 ---- { // a new out of sample time percentage point has been elapsed ! int currentProgress = Convert.ToInt16( Math.Floor( elapsedDays / totalDays * 100 ) ); ! NewProgressEventArgs newProgressEventArgs = ! new NewProgressEventArgs( currentProgress , 100 ); ! this.OutOfSampleNewProgress( this , newProgressEventArgs ); } } *************** *** 134,138 **** // the simulation has reached the ending date this.account.EndOfDayTimer.Stop(); ! this.progressBarForm.Close(); ObjectArchiver.Archive( this.account , @"C:\Documents and Settings\Glauco\Desktop\reports\final.qP" ); --- 152,156 ---- // the simulation has reached the ending date this.account.EndOfDayTimer.Stop(); ! // this.progressBarForm.Close(); ObjectArchiver.Archive( this.account , @"C:\Documents and Settings\Glauco\Desktop\reports\final.qP" ); *************** *** 151,154 **** --- 169,173 ---- run_initializeAccount(); run_initializeEndOfDayTimerHandler(); + run_initializeProgressBar(); run_initializeProgressHandlers(); this.endOfDayTimer.MarketOpen += *************** *** 163,167 **** new FiveMinutesBeforeMarketCloseEventHandler( this.endOfDayTimerHandler.FiveMinutesBeforeMarketCloseEventHandler ); ! this.progressBarForm.Show(); this.endOfDayTimer.Start(); } --- 182,186 ---- new FiveMinutesBeforeMarketCloseEventHandler( this.endOfDayTimerHandler.FiveMinutesBeforeMarketCloseEventHandler ); ! // this.progressBarForm.Show(); this.endOfDayTimer.Start(); } |