[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination OTC_CTODail
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2006-07-02 19:22:16
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv521/b7_Scripts/WalkForwardTesting/LinearCombination Modified Files: TestDisplayer.cs StrategyType.cs LinearCombinationTest.cs GenomeRepresentation.cs FixedPeriodOscillatorStrategy.cs ExtremeCounterTrendStrategy.cs Added Files: OTC_CTODailyStrategy.cs Log Message: Added OTC_CTO strategy for the genome form displayer. Updated other file strategies for the displayer. Index: ExtremeCounterTrendStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/ExtremeCounterTrendStrategy.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExtremeCounterTrendStrategy.cs 14 May 2006 18:13:17 -0000 1.1 --- ExtremeCounterTrendStrategy.cs 2 Jul 2006 19:22:12 -0000 1.2 *************** *** 43,46 **** --- 43,47 ---- private Account account; private string[] signedTickers; + private double[] weightsForSignedTickers; private int numDaysForReturnCalculation; private int numOfClosesElapsed = 0; *************** *** 48,56 **** public ExtremeCounterTrendStrategy( Account account , ! string[] signedTickers, int numDaysForReturnCalculation) { this.account = account; this.signedTickers = signedTickers; this.numDaysForReturnCalculation = numDaysForReturnCalculation; } --- 49,59 ---- public ExtremeCounterTrendStrategy( Account account , ! string[] signedTickers, ! double[] weightsForSignedTickers, int numDaysForReturnCalculation) { this.account = account; this.signedTickers = signedTickers; + this.weightsForSignedTickers = weightsForSignedTickers; this.numDaysForReturnCalculation = numDaysForReturnCalculation; } *************** *** 67,86 **** private long marketCloseEventHandler_addOrder_getQuantity( ! string ticker ) { double accountValue = this.account.GetMarketValue(); double currentTickerAsk = ! this.account.DataStreamer.GetCurrentAsk( ticker ); double maxPositionValueForThisTicker = ! accountValue/this.signedTickers.Length; long quantity = Convert.ToInt64( Math.Floor( maxPositionValueForThisTicker / currentTickerAsk ) ); return quantity; } ! private void marketCloseEventHandler_addOrder( string signedTicker ) { ! OrderType orderType = GenomeRepresentation.GetOrderType( signedTicker ); ! string ticker = GenomeRepresentation.GetTicker( signedTicker ); ! long quantity = marketCloseEventHandler_addOrder_getQuantity( ticker ); Order order = new Order( orderType , new Instrument( ticker ) , quantity ); --- 70,89 ---- private long marketCloseEventHandler_addOrder_getQuantity( ! int indexForSignedTicker) { double accountValue = this.account.GetMarketValue(); double currentTickerAsk = ! this.account.DataStreamer.GetCurrentAsk( SignedTicker.GetTicker(this.signedTickers[indexForSignedTicker]) ); double maxPositionValueForThisTicker = ! accountValue*this.weightsForSignedTickers[indexForSignedTicker]; long quantity = Convert.ToInt64( Math.Floor( maxPositionValueForThisTicker / currentTickerAsk ) ); return quantity; } ! private void marketCloseEventHandler_addOrder( int indexForSignedTicker ) { ! OrderType orderType = GenomeRepresentation.GetOrderType( this.signedTickers[indexForSignedTicker] ); ! string ticker = GenomeRepresentation.GetTicker( this.signedTickers[indexForSignedTicker] ); ! long quantity = marketCloseEventHandler_addOrder_getQuantity( indexForSignedTicker ); Order order = new Order( orderType , new Instrument( ticker ) , quantity ); *************** *** 89,94 **** private void marketCloseEventHandler_addOrders() { ! foreach ( string signedTicker in this.signedTickers ) ! marketCloseEventHandler_addOrder( signedTicker ); } --- 92,97 ---- private void marketCloseEventHandler_addOrders() { ! for(int i = 0; i<this.signedTickers.Length; i++) ! marketCloseEventHandler_addOrder( i ); } --- NEW FILE: OTC_CTODailyStrategy.cs --- /* QuantProject - Quantitative Finance Library OTC_CTODailyStrategy.cs Copyright (C) 2003 Marco Milletti This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Collections; using QuantProject.Business.Financial.Accounting; using QuantProject.Business.Financial.Instruments; using QuantProject.Business.Financial.Ordering; using QuantProject.Business.Strategies; using QuantProject.Business.Timing; namespace QuantProject.Scripts.WalkForwardTesting.LinearCombination { /// <summary> /// Open to close - Close to open daily strategy /// </summary> [Serializable] public class OTC_CTODailyStrategy : IEndOfDayStrategy { private Account account; private string[] signedTickers; private double[] weightsForSignedTickers; public OTC_CTODailyStrategy( Account account , string[] signedTickers, double[] weightsForSignedTickers) { this.account = account; this.signedTickers = signedTickers; this.weightsForSignedTickers = weightsForSignedTickers; } private long addOrders_addOrder_getQuantity( int indexForSignedTicker ) { double accountValue = this.account.GetMarketValue(); double currentTickerAsk = this.account.DataStreamer.GetCurrentAsk( SignedTicker.GetTicker(this.signedTickers[indexForSignedTicker]) ); double maxPositionValueForThisTicker = accountValue*this.weightsForSignedTickers[indexForSignedTicker]; long quantity = Convert.ToInt64( Math.Floor( maxPositionValueForThisTicker / currentTickerAsk ) ); return quantity; } private void addOrders_addOrder( int indexForSignedTicker ) { OrderType orderType = GenomeRepresentation.GetOrderType( this.signedTickers[indexForSignedTicker] ); string ticker = GenomeRepresentation.GetTicker( this.signedTickers[indexForSignedTicker] ); long quantity = addOrders_addOrder_getQuantity( indexForSignedTicker ); Order order = new Order( orderType , new Instrument( ticker ) , quantity ); this.account.AddOrder( order ); } private void addOrders() { for(int i = 0; i<this.signedTickers.Length; i++) this.addOrders_addOrder( i ); } public void MarketOpenEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs ) { this.closePositions(); if ( ( this.account.CashAmount == 0 ) && ( this.account.Transactions.Count == 0 ) ) // cash has not been added yet this.account.AddCash( 30000 ); this.addOrders(); } private void closePositions() { ArrayList tickers = new ArrayList(); foreach ( Position position in this.account.Portfolio.Positions ) tickers.Add( position.Instrument.Key ); foreach ( string ticker in tickers ) this.account.ClosePosition( ticker ); } public void FiveMinutesBeforeMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) { } public void MarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) { this.closePositions(); SignedTicker.ChangeSignOfEachTicker(this.signedTickers); this.addOrders(); SignedTicker.ChangeSignOfEachTicker(this.signedTickers); } public void OneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) { } } } Index: FixedPeriodOscillatorStrategy.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/FixedPeriodOscillatorStrategy.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FixedPeriodOscillatorStrategy.cs 14 May 2006 18:13:17 -0000 1.1 --- FixedPeriodOscillatorStrategy.cs 2 Jul 2006 19:22:12 -0000 1.2 *************** *** 41,44 **** --- 41,45 ---- private Account account; private string[] signedTickers; + private double[] weightsForSignedTickers; private int daysForRightPeriod; private int daysForReversalPeriod; *************** *** 51,55 **** public FixedPeriodOscillatorStrategy( Account account , ! string[] signedTickers, int daysForRightPeriod, int daysForReversalPeriod) --- 52,57 ---- public FixedPeriodOscillatorStrategy( Account account , ! string[] signedTickers, ! double[] weightsForSignedTickers, int daysForRightPeriod, int daysForReversalPeriod) *************** *** 57,80 **** this.account = account; this.signedTickers = signedTickers; this.daysForRightPeriod = daysForRightPeriod; this.daysForReversalPeriod = daysForReversalPeriod; } private long marketCloseEventHandler_addOrder_getQuantity( ! string ticker ) { double accountValue = this.account.GetMarketValue(); double currentTickerAsk = ! this.account.DataStreamer.GetCurrentAsk( ticker ); double maxPositionValueForThisTicker = ! accountValue/this.signedTickers.Length; long quantity = Convert.ToInt64( Math.Floor( maxPositionValueForThisTicker / currentTickerAsk ) ); return quantity; } ! private void marketCloseEventHandler_addOrder( string signedTicker ) { ! OrderType orderType = GenomeRepresentation.GetOrderType( signedTicker ); ! string ticker = GenomeRepresentation.GetTicker( signedTicker ); ! long quantity = marketCloseEventHandler_addOrder_getQuantity( ticker ); Order order = new Order( orderType , new Instrument( ticker ) , quantity ); --- 59,83 ---- this.account = account; this.signedTickers = signedTickers; + this.weightsForSignedTickers = weightsForSignedTickers; this.daysForRightPeriod = daysForRightPeriod; this.daysForReversalPeriod = daysForReversalPeriod; } private long marketCloseEventHandler_addOrder_getQuantity( ! int indexForSignedTicker) { double accountValue = this.account.GetMarketValue(); double currentTickerAsk = ! this.account.DataStreamer.GetCurrentAsk( SignedTicker.GetTicker(this.signedTickers[indexForSignedTicker]) ); double maxPositionValueForThisTicker = ! accountValue*this.weightsForSignedTickers[indexForSignedTicker]; long quantity = Convert.ToInt64( Math.Floor( maxPositionValueForThisTicker / currentTickerAsk ) ); return quantity; } ! private void marketCloseEventHandler_addOrder( int indexForSignedTicker ) { ! OrderType orderType = GenomeRepresentation.GetOrderType( this.signedTickers[indexForSignedTicker] ); ! string ticker = GenomeRepresentation.GetTicker( this.signedTickers[indexForSignedTicker] ); ! long quantity = marketCloseEventHandler_addOrder_getQuantity( indexForSignedTicker ); Order order = new Order( orderType , new Instrument( ticker ) , quantity ); *************** *** 83,88 **** private void marketCloseEventHandler_addOrders() { ! foreach ( string signedTicker in this.signedTickers ) ! marketCloseEventHandler_addOrder( signedTicker ); } --- 86,91 ---- private void marketCloseEventHandler_addOrders() { ! for(int i = 0; i<this.signedTickers.Length; i++) ! marketCloseEventHandler_addOrder( i ); } Index: StrategyType.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/StrategyType.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StrategyType.cs 14 May 2006 18:18:23 -0000 1.2 --- StrategyType.cs 2 Jul 2006 19:22:12 -0000 1.3 *************** *** 33,36 **** --- 33,37 ---- OpenToCloseWeekly, CloseToOpenDaily, + OpenToCloseCloseToOpenDaily, FixedPeriodOscillator, ExtremeCounterTrend Index: GenomeRepresentation.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/GenomeRepresentation.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GenomeRepresentation.cs 23 Oct 2005 19:09:04 -0000 1.4 --- GenomeRepresentation.cs 2 Jul 2006 19:22:12 -0000 1.5 *************** *** 23,26 **** --- 23,27 ---- using System; + using QuantProject.ADT; using QuantProject.ADT.Optimizing.Genetic; using QuantProject.Business.Financial.Ordering; *************** *** 68,76 **** } ! public static string[] GetSignedTickers( string signedTickers ) { ! string[] returnValue = signedTickers.Split( ";".ToCharArray() ); return returnValue; } public static OrderType GetOrderType( string signedTicker ) { --- 69,117 ---- } ! // public static string[] GetSignedTickers( string signedTickers ) ! // { ! // string[] returnValue = signedTickers.Split( ";".ToCharArray()); ! // return returnValue; ! // } ! ! public static string[] GetSignedTickers( string signedTickersWithWeights ) { ! string[] returnValue = ! signedTickersWithWeights.Split( ConstantsProvider.SeparatorForTickers.ToCharArray()); ! if( signedTickersWithWeights.Split( ConstantsProvider.SeparatorForWeights.ToCharArray() ).Length > 1 ) ! //the separator char for tickers is contained in signedTickersWithWeights: ! //so weights have been saved within tickers, separated by this special char ! { ! for(int i = 0; i<returnValue.Length; i++) ! { ! returnValue[i] = ! returnValue[i].Split( ConstantsProvider.SeparatorForWeights.ToCharArray() )[0]; ! } ! } ! return returnValue; ! } ! ! public static double[] GetWeightsForSignedTickers( string signedTickersWithWeights ) ! { ! string[] signedTickersWithWeightsArray = ! signedTickersWithWeights.Split( ConstantsProvider.SeparatorForTickers.ToCharArray() ); ! double[] returnValue = ! new double[signedTickersWithWeightsArray.Length]; ! for(int i = 0; i<returnValue.Length; i++) ! returnValue[i] = 1.0/returnValue.Length; ! ! if((signedTickersWithWeights.Split(ConstantsProvider.SeparatorForWeights.ToCharArray())).Length > 1) ! //the separator for weights is contained in signedTickersWithWeights: ! //so weights have been saved within tickers, separated by this char ! { ! for(int i = 0; i<returnValue.Length; i++) ! { ! returnValue[i] = ! Convert.ToDouble( signedTickersWithWeightsArray[i].Split( ConstantsProvider.SeparatorForWeights.ToCharArray() )[1] ); ! } ! } return returnValue; } + public static OrderType GetOrderType( string signedTicker ) { *************** *** 91,94 **** --- 132,136 ---- return returnValue; } + private string getSignedTickers( Genome genome ) { *************** *** 100,103 **** --- 142,162 ---- return signedTickers; } + private string getSignedTickersWithWeights( Genome genome ) + { + string signedTickersWithWeights = ""; + for ( int i = 0; i<((GenomeMeaning)genome.Meaning).Tickers.Length; i++ ) + { + signedTickersWithWeights += + ((GenomeMeaning)genome.Meaning).Tickers[i] + + ConstantsProvider.SeparatorForWeights + + ((GenomeMeaning)genome.Meaning).TickersPortfolioWeights[i] + + ConstantsProvider.SeparatorForTickers; + } + signedTickersWithWeights = signedTickersWithWeights.Substring( 0 , + signedTickersWithWeights.Length - 1 ); + + return signedTickersWithWeights; + } + private void genomeRepresentation( Genome genome , DateTime firstOptimizationDate , DateTime lastOptimizationDate , *************** *** 105,109 **** { this.fitness = genome.Fitness; ! this.signedTickers = this.getSignedTickers( genome ); this.firstOptimizationDate = firstOptimizationDate; this.lastOptimizationDate = lastOptimizationDate; --- 164,169 ---- { this.fitness = genome.Fitness; ! this.signedTickers = this.getSignedTickersWithWeights( genome ); ! //this.signedTickers = this.getSignedTickers( genome ); this.firstOptimizationDate = firstOptimizationDate; this.lastOptimizationDate = lastOptimizationDate; Index: LinearCombinationTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/LinearCombinationTest.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LinearCombinationTest.cs 14 May 2006 18:18:23 -0000 1.6 --- LinearCombinationTest.cs 2 Jul 2006 19:22:12 -0000 1.7 *************** *** 94,102 **** string[] signedTickers = GenomeRepresentation.GetSignedTickers( this.genomeRepresentation.SignedTickers ); switch (this.strategyType) { case StrategyType.OpenToCloseDaily: this.endOfDayStrategy = new OpenToCloseDailyStrategy( ! this.account , signedTickers ); break; case StrategyType.OpenToCloseWeekly: --- 94,105 ---- string[] signedTickers = GenomeRepresentation.GetSignedTickers( this.genomeRepresentation.SignedTickers ); + double[] weightsForSignedTickers = GenomeRepresentation.GetWeightsForSignedTickers( + this.genomeRepresentation.SignedTickers ); switch (this.strategyType) { case StrategyType.OpenToCloseDaily: this.endOfDayStrategy = new OpenToCloseDailyStrategy( ! this.account , signedTickers, ! weightsForSignedTickers ); break; case StrategyType.OpenToCloseWeekly: *************** *** 109,120 **** break; case StrategyType.FixedPeriodOscillator: this.endOfDayStrategy = new FixedPeriodOscillatorStrategy( ! this.account , signedTickers , this.numDaysForOscillatorStrategy , this.numDaysForOscillatorStrategy ); break; case StrategyType.ExtremeCounterTrend: this.endOfDayStrategy = new ExtremeCounterTrendStrategy( ! this.account , signedTickers , this.numDaysForOscillatorStrategy ); break; } --- 112,130 ---- break; + case StrategyType.OpenToCloseCloseToOpenDaily: + this.endOfDayStrategy = new OTC_CTODailyStrategy( + this.account , signedTickers , weightsForSignedTickers); + break; + case StrategyType.FixedPeriodOscillator: this.endOfDayStrategy = new FixedPeriodOscillatorStrategy( ! this.account , signedTickers , weightsForSignedTickers, ! this.numDaysForOscillatorStrategy , ! this.numDaysForOscillatorStrategy ); break; case StrategyType.ExtremeCounterTrend: this.endOfDayStrategy = new ExtremeCounterTrendStrategy( ! this.account , signedTickers , weightsForSignedTickers, this.numDaysForOscillatorStrategy ); break; } Index: TestDisplayer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/TestDisplayer.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TestDisplayer.cs 14 May 2006 18:18:23 -0000 1.7 --- TestDisplayer.cs 2 Jul 2006 19:22:12 -0000 1.8 *************** *** 36,46 **** { private System.Windows.Forms.Label labelDays; ! private System.Windows.Forms.TextBox textBoxDaysFPOscillatorAndRevOneRank; ! private System.Windows.Forms.Label label1; private System.Windows.Forms.RadioButton radioButtonOpenToCloseDaily; private System.Windows.Forms.RadioButton radioButtonReversalOneRank; private System.Windows.Forms.DateTimePicker dtpLastDate; private System.Windows.Forms.DateTimePicker dtpFirstDate; ! private System.Windows.Forms.RadioButton radioButtonFixedPeriodOscillator; private System.Windows.Forms.RadioButton radioButtonOpenToCloseWeekly; private System.Windows.Forms.RadioButton radioButtonCloseToOpenDaily; --- 36,46 ---- { private System.Windows.Forms.Label labelDays; ! 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; private System.Windows.Forms.DateTimePicker dtpFirstDate; ! private System.Windows.Forms.TextBox textBoxDaysFPOscillatorAndRevOneRank; private System.Windows.Forms.RadioButton radioButtonOpenToCloseWeekly; private System.Windows.Forms.RadioButton radioButtonCloseToOpenDaily; *************** *** 54,57 **** --- 54,58 ---- private ArrayList bestGenomes; private GenomeRepresentation lastSelectedGenomeRepresentation; + private System.Windows.Forms.RadioButton radioButtonOTCCTODaily; private StrategyType selectedStrategyType = StrategyType.OpenToCloseDaily; *************** *** 103,234 **** /// </summary> private void InitializeComponent() { ! this.dgBestGenomes = new System.Windows.Forms.DataGrid(); ! this.radioButtonCloseToOpenDaily = new System.Windows.Forms.RadioButton(); ! this.radioButtonOpenToCloseWeekly = new System.Windows.Forms.RadioButton(); ! this.radioButtonFixedPeriodOscillator = new System.Windows.Forms.RadioButton(); ! this.dtpFirstDate = new System.Windows.Forms.DateTimePicker(); ! this.dtpLastDate = new System.Windows.Forms.DateTimePicker(); ! this.radioButtonReversalOneRank = new System.Windows.Forms.RadioButton(); ! this.radioButtonOpenToCloseDaily = new System.Windows.Forms.RadioButton(); ! this.label1 = new System.Windows.Forms.Label(); ! this.textBoxDaysFPOscillatorAndRevOneRank = new System.Windows.Forms.TextBox(); ! this.labelDays = new System.Windows.Forms.Label(); ! ((System.ComponentModel.ISupportInitialize)(this.dgBestGenomes)).BeginInit(); ! this.SuspendLayout(); ! // ! // dgBestGenomes ! // ! this.dgBestGenomes.DataMember = ""; ! this.dgBestGenomes.Dock = System.Windows.Forms.DockStyle.Bottom; ! this.dgBestGenomes.HeaderForeColor = System.Drawing.SystemColors.ControlText; ! this.dgBestGenomes.Location = new System.Drawing.Point(0, 205); ! this.dgBestGenomes.Name = "dgBestGenomes"; ! this.dgBestGenomes.Size = new System.Drawing.Size(584, 168); ! this.dgBestGenomes.TabIndex = 0; ! this.dgBestGenomes.MouseUp += new System.Windows.Forms.MouseEventHandler(this.dgBestGenomes_MouseUp); ! // ! // radioButtonCloseToOpenDaily ! // ! this.radioButtonCloseToOpenDaily.Location = new System.Drawing.Point(64, 120); ! this.radioButtonCloseToOpenDaily.Name = "radioButtonCloseToOpenDaily"; ! this.radioButtonCloseToOpenDaily.Size = new System.Drawing.Size(144, 24); ! this.radioButtonCloseToOpenDaily.TabIndex = 6; ! this.radioButtonCloseToOpenDaily.Text = "Close To Open Daily"; ! this.radioButtonCloseToOpenDaily.CheckedChanged += new System.EventHandler(this.radioButtonCloseToOpenDaily_CheckedChanged); ! // ! // radioButtonOpenToCloseWeekly ! // ! this.radioButtonOpenToCloseWeekly.Location = new System.Drawing.Point(64, 144); ! this.radioButtonOpenToCloseWeekly.Name = "radioButtonOpenToCloseWeekly"; ! this.radioButtonOpenToCloseWeekly.Size = new System.Drawing.Size(144, 24); ! this.radioButtonOpenToCloseWeekly.TabIndex = 5; ! this.radioButtonOpenToCloseWeekly.Text = "Open To Close Weekly"; ! this.radioButtonOpenToCloseWeekly.CheckedChanged += new System.EventHandler(this.radioButtonOpenToCloseWeekly_CheckedChanged); ! // ! // radioButtonFixedPeriodOscillator ! // ! this.radioButtonFixedPeriodOscillator.Location = new System.Drawing.Point(232, 96); ! this.radioButtonFixedPeriodOscillator.Name = "radioButtonFixedPeriodOscillator"; ! this.radioButtonFixedPeriodOscillator.Size = new System.Drawing.Size(192, 24); ! this.radioButtonFixedPeriodOscillator.TabIndex = 7; ! this.radioButtonFixedPeriodOscillator.Text = "Fixed Period n-days oscillator"; ! this.radioButtonFixedPeriodOscillator.CheckedChanged += new System.EventHandler(this.radioButtonFixedPeriodOscillator_CheckedChanged); ! // ! // dtpFirstDate ! // ! this.dtpFirstDate.Location = new System.Drawing.Point(16, 24); ! this.dtpFirstDate.Name = "dtpFirstDate"; ! this.dtpFirstDate.TabIndex = 1; ! // ! // dtpLastDate ! // ! this.dtpLastDate.Location = new System.Drawing.Point(264, 24); ! this.dtpLastDate.Name = "dtpLastDate"; ! this.dtpLastDate.Size = new System.Drawing.Size(208, 21); ! 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 ! // ! this.radioButtonOpenToCloseDaily.Location = new System.Drawing.Point(64, 96); ! this.radioButtonOpenToCloseDaily.Name = "radioButtonOpenToCloseDaily"; ! this.radioButtonOpenToCloseDaily.Size = new System.Drawing.Size(144, 24); ! this.radioButtonOpenToCloseDaily.TabIndex = 4; ! this.radioButtonOpenToCloseDaily.Text = "Open To Close Daily"; ! this.radioButtonOpenToCloseDaily.CheckedChanged += new System.EventHandler(this.radioButtonOpenToCloseDaily_CheckedChanged); ! // ! // label1 ! // ! this.label1.Location = new System.Drawing.Point(32, 64); ! this.label1.Name = "label1"; ! this.label1.Size = new System.Drawing.Size(400, 40); ! this.label1.TabIndex = 3; ! this.label1.Text = "Left click data grid rows to reset dates to the optimization period. Right click " + ! "to preserve date displacements and backtest."; ! // ! // textBoxDaysFPOscillatorAndRevOneRank ! // ! this.textBoxDaysFPOscillatorAndRevOneRank.Location = new System.Drawing.Point(320, 152); ! this.textBoxDaysFPOscillatorAndRevOneRank.Name = "textBoxDaysFPOscillatorAndRevOneRank"; ! this.textBoxDaysFPOscillatorAndRevOneRank.Size = new System.Drawing.Size(56, 21); ! this.textBoxDaysFPOscillatorAndRevOneRank.TabIndex = 8; ! this.textBoxDaysFPOscillatorAndRevOneRank.Text = ""; ! // ! // labelDays ! // ! this.labelDays.Location = new System.Drawing.Point(272, 152); ! this.labelDays.Name = "labelDays"; ! this.labelDays.Size = new System.Drawing.Size(40, 16); ! this.labelDays.TabIndex = 9; ! this.labelDays.Text = "days"; ! // ! // TestDisplayer ! // ! this.AutoScaleBaseSize = new System.Drawing.Size(5, 14); ! this.ClientSize = new System.Drawing.Size(584, 373); ! this.Controls.Add(this.radioButtonReversalOneRank); ! this.Controls.Add(this.labelDays); ! this.Controls.Add(this.textBoxDaysFPOscillatorAndRevOneRank); ! this.Controls.Add(this.radioButtonFixedPeriodOscillator); ! this.Controls.Add(this.radioButtonCloseToOpenDaily); ! this.Controls.Add(this.radioButtonOpenToCloseWeekly); ! this.Controls.Add(this.radioButtonOpenToCloseDaily); ! this.Controls.Add(this.label1); ! this.Controls.Add(this.dtpLastDate); ! this.Controls.Add(this.dtpFirstDate); ! this.Controls.Add(this.dgBestGenomes); ! this.Name = "TestDisplayer"; ! this.Text = "TestDisplayer"; ! ((System.ComponentModel.ISupportInitialize)(this.dgBestGenomes)).EndInit(); ! this.ResumeLayout(false); ! } #endregion --- 104,247 ---- /// </summary> private void InitializeComponent() { ! this.dgBestGenomes = new System.Windows.Forms.DataGrid(); ! this.radioButtonCloseToOpenDaily = new System.Windows.Forms.RadioButton(); ! this.radioButtonOpenToCloseWeekly = new System.Windows.Forms.RadioButton(); ! this.textBoxDaysFPOscillatorAndRevOneRank = new System.Windows.Forms.TextBox(); ! this.dtpFirstDate = new System.Windows.Forms.DateTimePicker(); ! 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(); ! // ! // dgBestGenomes ! // ! this.dgBestGenomes.DataMember = ""; ! this.dgBestGenomes.Dock = System.Windows.Forms.DockStyle.Bottom; ! this.dgBestGenomes.HeaderForeColor = System.Drawing.SystemColors.ControlText; ! this.dgBestGenomes.Location = new System.Drawing.Point(0, 205); ! this.dgBestGenomes.Name = "dgBestGenomes"; ! this.dgBestGenomes.Size = new System.Drawing.Size(584, 168); ! this.dgBestGenomes.TabIndex = 0; ! this.dgBestGenomes.MouseUp += new System.Windows.Forms.MouseEventHandler(this.dgBestGenomes_MouseUp); ! // ! // radioButtonCloseToOpenDaily ! // ! this.radioButtonCloseToOpenDaily.Location = new System.Drawing.Point(64, 120); ! this.radioButtonCloseToOpenDaily.Name = "radioButtonCloseToOpenDaily"; ! this.radioButtonCloseToOpenDaily.Size = new System.Drawing.Size(144, 24); ! this.radioButtonCloseToOpenDaily.TabIndex = 6; ! this.radioButtonCloseToOpenDaily.Text = "Close To Open Daily"; ! this.radioButtonCloseToOpenDaily.CheckedChanged += new System.EventHandler(this.radioButtonCloseToOpenDaily_CheckedChanged); ! // ! // radioButtonOpenToCloseWeekly ! // ! this.radioButtonOpenToCloseWeekly.Location = new System.Drawing.Point(64, 144); ! this.radioButtonOpenToCloseWeekly.Name = "radioButtonOpenToCloseWeekly"; ! this.radioButtonOpenToCloseWeekly.Size = new System.Drawing.Size(144, 24); ! this.radioButtonOpenToCloseWeekly.TabIndex = 5; ! this.radioButtonOpenToCloseWeekly.Text = "Open To Close Weekly"; ! this.radioButtonOpenToCloseWeekly.CheckedChanged += new System.EventHandler(this.radioButtonOpenToCloseWeekly_CheckedChanged); ! // ! // textBoxDaysFPOscillatorAndRevOneRank ! // ! this.textBoxDaysFPOscillatorAndRevOneRank.Location = new System.Drawing.Point(320, 152); ! this.textBoxDaysFPOscillatorAndRevOneRank.Name = "textBoxDaysFPOscillatorAndRevOneRank"; ! this.textBoxDaysFPOscillatorAndRevOneRank.Size = new System.Drawing.Size(56, 20); ! this.textBoxDaysFPOscillatorAndRevOneRank.TabIndex = 8; ! this.textBoxDaysFPOscillatorAndRevOneRank.Text = "1"; ! // ! // dtpFirstDate ! // ! this.dtpFirstDate.Location = new System.Drawing.Point(16, 24); ! this.dtpFirstDate.Name = "dtpFirstDate"; ! this.dtpFirstDate.TabIndex = 1; ! // ! // label1 ! // ! this.label1.Location = new System.Drawing.Point(32, 64); ! this.label1.Name = "label1"; ! this.label1.Size = new System.Drawing.Size(400, 40); ! this.label1.TabIndex = 3; ! this.label1.Text = "Left click data grid rows to reset dates to the optimization period. Right click " + ! "to preserve date displacements and backtest."; ! // ! // dtpLastDate ! // ! this.dtpLastDate.Location = new System.Drawing.Point(264, 24); ! this.dtpLastDate.Name = "dtpLastDate"; ! this.dtpLastDate.Size = new System.Drawing.Size(208, 20); ! 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 ! // ! this.radioButtonOpenToCloseDaily.Location = new System.Drawing.Point(64, 96); ! this.radioButtonOpenToCloseDaily.Name = "radioButtonOpenToCloseDaily"; ! this.radioButtonOpenToCloseDaily.Size = new System.Drawing.Size(144, 24); ! this.radioButtonOpenToCloseDaily.TabIndex = 4; ! this.radioButtonOpenToCloseDaily.Text = "Open To Close Daily"; ! this.radioButtonOpenToCloseDaily.CheckedChanged += new System.EventHandler(this.radioButtonOpenToCloseDaily_CheckedChanged); ! // ! // radioButtonFixedPeriodOscillator ! // ! this.radioButtonFixedPeriodOscillator.Location = new System.Drawing.Point(232, 96); ! this.radioButtonFixedPeriodOscillator.Name = "radioButtonFixedPeriodOscillator"; ! this.radioButtonFixedPeriodOscillator.Size = new System.Drawing.Size(192, 24); ! this.radioButtonFixedPeriodOscillator.TabIndex = 7; ! this.radioButtonFixedPeriodOscillator.Text = "Fixed Period n-days oscillator"; ! this.radioButtonFixedPeriodOscillator.CheckedChanged += new System.EventHandler(this.radioButtonFixedPeriodOscillator_CheckedChanged); ! // ! // labelDays ! // ! this.labelDays.Location = new System.Drawing.Point(272, 152); ! this.labelDays.Name = "labelDays"; ! this.labelDays.Size = new System.Drawing.Size(40, 16); ! this.labelDays.TabIndex = 9; ! this.labelDays.Text = "days"; ! // ! // radioButtonOTCCTODaily ! // ! this.radioButtonOTCCTODaily.Location = new System.Drawing.Point(64, 168); ! this.radioButtonOTCCTODaily.Name = "radioButtonOTCCTODaily"; ! this.radioButtonOTCCTODaily.Size = new System.Drawing.Size(144, 24); ! this.radioButtonOTCCTODaily.TabIndex = 11; ! this.radioButtonOTCCTODaily.Text = "OTC - CTO Daily"; ! // ! // TestDisplayer ! // ! this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); ! this.ClientSize = new System.Drawing.Size(584, 373); ! this.Controls.AddRange(new System.Windows.Forms.Control[] { ! this.radioButtonOTCCTODaily, ! this.radioButtonReversalOneRank, ! this.labelDays, ! this.textBoxDaysFPOscillatorAndRevOneRank, ! this.radioButtonFixedPeriodOscillator, ! this.radioButtonCloseToOpenDaily, ! this.radioButtonOpenToCloseWeekly, ! this.radioButtonOpenToCloseDaily, ! this.label1, ! this.dtpLastDate, ! this.dtpFirstDate, ! this.dgBestGenomes}); ! this.Name = "TestDisplayer"; ! this.Text = "TestDisplayer"; ! ((System.ComponentModel.ISupportInitialize)(this.dgBestGenomes)).EndInit(); ! this.ResumeLayout(false); ! ! } #endregion *************** *** 323,326 **** --- 336,341 ---- else if(this.radioButtonReversalOneRank.Checked) this.selectedStrategyType = StrategyType.ExtremeCounterTrend; + else if(this.radioButtonOTCCTODaily.Checked) + this.selectedStrategyType = StrategyType.OpenToCloseCloseToOpenDaily; } |