[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination TestDisplay
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2006-08-03 21:16:00
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv14164/b7_Scripts/WalkForwardTesting/LinearCombination Modified Files: TestDisplayer.cs StrategyType.cs MainForm.cs LinearCombinationTest.cs Log Message: Added ImmediateTrendFollower strategy to the project. ITF strategy is just the reversal of the ECT (ExtremeCounterTrend strategy). Index: LinearCombinationTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/LinearCombinationTest.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** LinearCombinationTest.cs 2 Jul 2006 19:22:12 -0000 1.7 --- LinearCombinationTest.cs 3 Aug 2006 21:15:57 -0000 1.8 *************** *** 92,99 **** private void run_setStrategy() { ! string[] signedTickers = GenomeRepresentation.GetSignedTickers( ! this.genomeRepresentation.SignedTickers ); ! double[] weightsForSignedTickers = GenomeRepresentation.GetWeightsForSignedTickers( ! this.genomeRepresentation.SignedTickers ); switch (this.strategyType) { --- 92,98 ---- private void run_setStrategy() { ! string[] signedTickers = genomeRepresentation.SignedTickers.Split(";".ToCharArray()); ! double[] weightsForSignedTickers = ! GenomeRepresentation.GetWeightsArray(this.genomeRepresentation.WeightsForSignedTickers); switch (this.strategyType) { *************** *** 128,131 **** --- 127,135 ---- this.account , signedTickers , weightsForSignedTickers, this.numDaysForOscillatorStrategy ); break; + + case StrategyType.ImmediateTrendFollower: + this.endOfDayStrategy = new ImmediateTrendFollowerStrategy( + this.account , signedTickers , weightsForSignedTickers, this.numDaysForOscillatorStrategy ); + break; } } Index: MainForm.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/MainForm.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** MainForm.cs 7 Jan 2006 10:45:07 -0000 1.9 --- MainForm.cs 3 Aug 2006 21:15:57 -0000 1.10 *************** *** 109,151 **** private void InitializeComponent() { ! this.mainMenu1 = new System.Windows.Forms.MainMenu(); ! this.menuItem1 = new System.Windows.Forms.MenuItem(); ! this.menuItem2 = new System.Windows.Forms.MenuItem(); ! this.menuItem3 = new System.Windows.Forms.MenuItem(); ! // ! // mainMenu1 ! // ! this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { ! this.menuItem1}); ! // ! // menuItem1 ! // ! this.menuItem1.Index = 0; ! this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { ! this.menuItem2, ! this.menuItem3}); ! this.menuItem1.Text = "File"; ! // ! // menuItem2 ! // ! this.menuItem2.Index = 0; ! this.menuItem2.Text = "Create Optimized Genomes"; ! this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click); ! // ! // menuItem3 ! // ! this.menuItem3.Index = 1; ! this.menuItem3.Text = "Test Optimized Genomes"; ! this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click); ! // ! // MainForm ! // ! this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(292, 273); ! this.Menu = this.mainMenu1; ! this.Name = "MainForm"; ! this.Text = "MainForm"; ! } #endregion --- 109,151 ---- private void InitializeComponent() { ! this.mainMenu1 = new System.Windows.Forms.MainMenu(); ! this.menuItem1 = new System.Windows.Forms.MenuItem(); ! this.menuItem2 = new System.Windows.Forms.MenuItem(); ! this.menuItem3 = new System.Windows.Forms.MenuItem(); ! // ! // mainMenu1 ! // ! this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { ! this.menuItem1}); ! // ! // menuItem1 ! // ! this.menuItem1.Index = 0; ! this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { ! this.menuItem2, ! this.menuItem3}); ! this.menuItem1.Text = "File"; ! // ! // menuItem2 ! // ! this.menuItem2.Index = 0; ! this.menuItem2.Text = "Create Optimized Genomes"; ! this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click); ! // ! // menuItem3 ! // ! this.menuItem3.Index = 1; ! this.menuItem3.Text = "Test Optimized Genomes"; ! this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click); ! // ! // MainForm ! // ! this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(292, 273); ! this.Menu = this.mainMenu1; ! this.Name = "MainForm"; ! this.Text = "MainForm"; ! } #endregion *************** *** 280,284 **** TestDisplayer testDisplayer = new TestDisplayer( this.firstDate , this.lastDate , this.optimizationOutput ); ! this.optimizationOutput = null; testDisplayer.Show(); } --- 280,284 ---- TestDisplayer testDisplayer = new TestDisplayer( this.firstDate , this.lastDate , this.optimizationOutput ); ! this.optimizationOutput = null;//why this? testDisplayer.Show(); } Index: StrategyType.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/StrategyType.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** StrategyType.cs 2 Jul 2006 19:22:12 -0000 1.3 --- StrategyType.cs 3 Aug 2006 21:15:57 -0000 1.4 *************** *** 35,39 **** OpenToCloseCloseToOpenDaily, FixedPeriodOscillator, ! ExtremeCounterTrend } } --- 35,40 ---- OpenToCloseCloseToOpenDaily, FixedPeriodOscillator, ! ExtremeCounterTrend, ! ImmediateTrendFollower } } Index: TestDisplayer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/TestDisplayer.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TestDisplayer.cs 2 Jul 2006 19:22:12 -0000 1.8 --- TestDisplayer.cs 3 Aug 2006 21:15:57 -0000 1.9 *************** *** 38,42 **** private System.Windows.Forms.RadioButton radioButtonFixedPeriodOscillator; private System.Windows.Forms.RadioButton radioButtonOpenToCloseDaily; - private System.Windows.Forms.RadioButton radioButtonReversalOneRank; private System.Windows.Forms.DateTimePicker dtpLastDate; private System.Windows.Forms.Label label1; --- 38,41 ---- *************** *** 55,58 **** --- 54,59 ---- private GenomeRepresentation lastSelectedGenomeRepresentation; private System.Windows.Forms.RadioButton radioButtonOTCCTODaily; + private System.Windows.Forms.RadioButton radioButtonExtremeCounterTrend; + private System.Windows.Forms.RadioButton radioButtonImmediateTrendFollower; private StrategyType selectedStrategyType = StrategyType.OpenToCloseDaily; *************** *** 60,63 **** --- 61,106 ---- { this.dgBestGenomes.DataSource = this.bestGenomes; + DataGridTableStyle ts = new DataGridTableStyle(); + ts.MappingName = this.dgBestGenomes.DataSource.GetType().Name; + + DataGridTextBoxColumn signedTickersBox = new DataGridTextBoxColumn(); + signedTickersBox.MappingName ="SignedTickers"; + signedTickersBox.HeaderText = "Tickers"; + ts.GridColumnStyles.Add(signedTickersBox); + + DataGridTextBoxColumn weights = new DataGridTextBoxColumn(); + weights.MappingName ="WeightsForSignedTickers"; + weights.HeaderText = "Weights"; + ts.GridColumnStyles.Add(weights); + + DataGridTextBoxColumn fitness = new DataGridTextBoxColumn(); + fitness.MappingName ="Fitness"; + fitness.HeaderText = "Fitness"; + ts.GridColumnStyles.Add(fitness); + + DataGridTextBoxColumn firstDate = new DataGridTextBoxColumn(); + firstDate.MappingName ="FirstOptimizationDate"; + firstDate.HeaderText = "FirstOptimizationDate"; + ts.GridColumnStyles.Add(firstDate); + + DataGridTextBoxColumn lastDate = new DataGridTextBoxColumn(); + lastDate.MappingName ="LastOptimizationDate"; + lastDate.HeaderText = "LastOptimizationDate"; + ts.GridColumnStyles.Add(lastDate); + + DataGridTextBoxColumn genNumber = new DataGridTextBoxColumn(); + genNumber.MappingName ="GenerationCounter"; + genNumber.HeaderText = "GenNum"; + ts.GridColumnStyles.Add(genNumber); + + DataGridTextBoxColumn eligible = new DataGridTextBoxColumn(); + eligible.MappingName ="EligibleTickers"; + eligible.HeaderText = "EligibleTickers"; + ts.GridColumnStyles.Add(eligible); + + this.dgBestGenomes.TableStyles.Clear(); + ts.AllowSorting = true; + this.dgBestGenomes.TableStyles.Add(ts); + this.dgBestGenomes.AllowSorting = true; } public TestDisplayer( DateTime firstDate , DateTime lastDate , *************** *** 111,119 **** this.label1 = new System.Windows.Forms.Label(); this.dtpLastDate = new System.Windows.Forms.DateTimePicker(); ! this.radioButtonReversalOneRank = new System.Windows.Forms.RadioButton(); this.radioButtonOpenToCloseDaily = new System.Windows.Forms.RadioButton(); this.radioButtonFixedPeriodOscillator = new System.Windows.Forms.RadioButton(); this.labelDays = new System.Windows.Forms.Label(); this.radioButtonOTCCTODaily = new System.Windows.Forms.RadioButton(); ((System.ComponentModel.ISupportInitialize)(this.dgBestGenomes)).BeginInit(); this.SuspendLayout(); --- 154,163 ---- this.label1 = new System.Windows.Forms.Label(); this.dtpLastDate = new System.Windows.Forms.DateTimePicker(); ! this.radioButtonExtremeCounterTrend = new System.Windows.Forms.RadioButton(); this.radioButtonOpenToCloseDaily = new System.Windows.Forms.RadioButton(); this.radioButtonFixedPeriodOscillator = new System.Windows.Forms.RadioButton(); this.labelDays = new System.Windows.Forms.Label(); this.radioButtonOTCCTODaily = new System.Windows.Forms.RadioButton(); + this.radioButtonImmediateTrendFollower = new System.Windows.Forms.RadioButton(); ((System.ComponentModel.ISupportInitialize)(this.dgBestGenomes)).BeginInit(); this.SuspendLayout(); *************** *** 150,154 **** // textBoxDaysFPOscillatorAndRevOneRank // ! this.textBoxDaysFPOscillatorAndRevOneRank.Location = new System.Drawing.Point(320, 152); this.textBoxDaysFPOscillatorAndRevOneRank.Name = "textBoxDaysFPOscillatorAndRevOneRank"; this.textBoxDaysFPOscillatorAndRevOneRank.Size = new System.Drawing.Size(56, 20); --- 194,198 ---- // textBoxDaysFPOscillatorAndRevOneRank // ! this.textBoxDaysFPOscillatorAndRevOneRank.Location = new System.Drawing.Point(320, 176); this.textBoxDaysFPOscillatorAndRevOneRank.Name = "textBoxDaysFPOscillatorAndRevOneRank"; this.textBoxDaysFPOscillatorAndRevOneRank.Size = new System.Drawing.Size(56, 20); *************** *** 178,189 **** this.dtpLastDate.TabIndex = 2; // ! // radioButtonReversalOneRank // ! this.radioButtonReversalOneRank.Location = new System.Drawing.Point(232, 120); ! this.radioButtonReversalOneRank.Name = "radioButtonReversalOneRank"; ! this.radioButtonReversalOneRank.Size = new System.Drawing.Size(192, 24); ! this.radioButtonReversalOneRank.TabIndex = 10; ! this.radioButtonReversalOneRank.Text = "Extreme counter trend"; ! this.radioButtonReversalOneRank.CheckedChanged += new System.EventHandler(this.radioButtonReversalOneRank_CheckedChanged); // // radioButtonOpenToCloseDaily --- 222,233 ---- this.dtpLastDate.TabIndex = 2; // ! // radioButtonExtremeCounterTrend // ! this.radioButtonExtremeCounterTrend.Location = new System.Drawing.Point(232, 120); ! this.radioButtonExtremeCounterTrend.Name = "radioButtonExtremeCounterTrend"; ! this.radioButtonExtremeCounterTrend.Size = new System.Drawing.Size(192, 24); ! this.radioButtonExtremeCounterTrend.TabIndex = 10; ! this.radioButtonExtremeCounterTrend.Text = "Extreme counter trend"; ! this.radioButtonExtremeCounterTrend.CheckedChanged += new System.EventHandler(this.radioButtonExtremeCounterTrend_CheckedChanged); // // radioButtonOpenToCloseDaily *************** *** 207,211 **** // labelDays // ! this.labelDays.Location = new System.Drawing.Point(272, 152); this.labelDays.Name = "labelDays"; this.labelDays.Size = new System.Drawing.Size(40, 16); --- 251,255 ---- // labelDays // ! this.labelDays.Location = new System.Drawing.Point(272, 176); this.labelDays.Name = "labelDays"; this.labelDays.Size = new System.Drawing.Size(40, 16); *************** *** 221,224 **** --- 265,277 ---- this.radioButtonOTCCTODaily.Text = "OTC - CTO Daily"; // + // radioButtonImmediateTrendFollower + // + this.radioButtonImmediateTrendFollower.Location = new System.Drawing.Point(232, 144); + this.radioButtonImmediateTrendFollower.Name = "radioButtonImmediateTrendFollower"; + this.radioButtonImmediateTrendFollower.Size = new System.Drawing.Size(192, 24); + this.radioButtonImmediateTrendFollower.TabIndex = 12; + this.radioButtonImmediateTrendFollower.Text = "Immediate Trend Follower"; + this.radioButtonImmediateTrendFollower.CheckedChanged += new System.EventHandler(this.radioButtonImmediateTrendFollower_CheckedChanged); + // // TestDisplayer // *************** *** 226,231 **** this.ClientSize = new System.Drawing.Size(584, 373); this.Controls.AddRange(new System.Windows.Forms.Control[] { this.radioButtonOTCCTODaily, ! this.radioButtonReversalOneRank, this.labelDays, this.textBoxDaysFPOscillatorAndRevOneRank, --- 279,285 ---- this.ClientSize = new System.Drawing.Size(584, 373); this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.radioButtonImmediateTrendFollower, this.radioButtonOTCCTODaily, ! this.radioButtonExtremeCounterTrend, this.labelDays, this.textBoxDaysFPOscillatorAndRevOneRank, *************** *** 288,293 **** this.dgBestGenomes_MouseUp_getClickedGenomeRepresentation( sender , e ); dgBestGenomes_MouseUp_rightButton_updateDates( genomeRepresentation ); ! string[] signedTickers = GenomeRepresentation.GetSignedTickers( ! genomeRepresentation.SignedTickers ); LinearCombinationTest linearCombinationTest = new LinearCombinationTest( this.dtpFirstDate.Value , --- 342,346 ---- this.dgBestGenomes_MouseUp_getClickedGenomeRepresentation( sender , e ); dgBestGenomes_MouseUp_rightButton_updateDates( genomeRepresentation ); ! string[] signedTickers = genomeRepresentation.SignedTickers.Split(";".ToCharArray()); LinearCombinationTest linearCombinationTest = new LinearCombinationTest( this.dtpFirstDate.Value , *************** *** 334,341 **** else if(this.radioButtonFixedPeriodOscillator.Checked) this.selectedStrategyType = StrategyType.FixedPeriodOscillator; ! else if(this.radioButtonReversalOneRank.Checked) this.selectedStrategyType = StrategyType.ExtremeCounterTrend; else if(this.radioButtonOTCCTODaily.Checked) this.selectedStrategyType = StrategyType.OpenToCloseCloseToOpenDaily; } --- 387,396 ---- else if(this.radioButtonFixedPeriodOscillator.Checked) this.selectedStrategyType = StrategyType.FixedPeriodOscillator; ! else if(this.radioButtonExtremeCounterTrend.Checked) this.selectedStrategyType = StrategyType.ExtremeCounterTrend; else if(this.radioButtonOTCCTODaily.Checked) this.selectedStrategyType = StrategyType.OpenToCloseCloseToOpenDaily; + else if(this.radioButtonImmediateTrendFollower.Checked) + this.selectedStrategyType = StrategyType.ImmediateTrendFollower; } *************** *** 360,367 **** } ! private void radioButtonReversalOneRank_CheckedChanged(object sender, System.EventArgs e) { this.update_selectedStrategyType(); } } } --- 415,428 ---- } ! private void radioButtonExtremeCounterTrend_CheckedChanged(object sender, System.EventArgs e) { this.update_selectedStrategyType(); } + + private void radioButtonImmediateTrendFollower_CheckedChanged(object sender, System.EventArgs e) + { + this.update_selectedStrategyType(); + } + } } |