[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination FixedLevelO
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2006-09-17 21:24:57
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv25928/b7_Scripts/WalkForwardTesting/LinearCombination Modified Files: TestDisplayer.cs StrategyType.cs LinearCombinationTest.cs GenomeRepresentation.cs Added Files: FixedLevelOscillatorPVOStrategy.cs Log Message: Added Portfolio Value Oscillator strategy. This strategy is similar to the strategy based on the popular technical RSI indicator (Relative Strength Index). Index: LinearCombinationTest.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/LinearCombinationTest.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** LinearCombinationTest.cs 7 Aug 2006 21:19:40 -0000 1.9 --- LinearCombinationTest.cs 17 Sep 2006 21:24:53 -0000 1.10 *************** *** 23,26 **** --- 23,27 ---- using System; using System.Collections; + using System.Drawing; using QuantProject.Business.DataProviders; *************** *** 32,35 **** --- 33,37 ---- using QuantProject.Presentation.Reporting.WindowsForm; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; + using QuantProject.Scripts.WalkForwardTesting.WalkForwardLag; *************** *** 139,142 **** --- 141,151 ---- this.account , signedTickers , weightsForSignedTickers, this.numDaysForOscillatorStrategy ); break; + + case StrategyType.PortfolioValueOscillator: + this.endOfDayStrategy = new FixedLevelOscillatorPVOStrategy( + this.account , signedTickers , weightsForSignedTickers, + this.genomeRepresentation.OversoldThreshold, this.genomeRepresentation.OverboughtThreshold, + this.numDaysForOscillatorStrategy ); + break; } } *************** *** 160,164 **** return returnValue; } ! public void Run() { this.historicalEndOfDayTimer = --- 169,202 ---- return returnValue; } ! ! private void run_addEquityLineForWeightedPositions( ! WeightedPositions weightedPositions , Color color , Report report ) ! { ! EquityLine equityLineForWeightedPositions = ! weightedPositions.GetVirtualEquityLine( ! 30000 , report.AccountReport.EquityLine ); ! report.AddEquityLine( equityLineForWeightedPositions , ! color ); ! } ! ! private WeightedPositions run_getWeightedPositions(GenomeRepresentation genomeRepresentation) ! ! { ! double[] normalizedWeights = ! GenomeRepresentation.GetWeightsArray(this.genomeRepresentation.WeightsForSignedTickers); ! string[] tickers = ! GenomeRepresentation.GetSignedTickers(this.genomeRepresentation.SignedTickers); ! for(int i = 0; i<tickers.Length; i++) ! { ! if(tickers[i].StartsWith("-")) ! { ! tickers[i] = SignedTicker.GetTicker(tickers[i]); ! normalizedWeights[i] = -1.0 * normalizedWeights[i]; ! } ! } ! return new WeightedPositions(normalizedWeights, tickers); ! } ! ! public void Run() { this.historicalEndOfDayTimer = *************** *** 190,196 **** Report report = new Report( this.account , this.historicalQuoteProvider ); ! report.Create( "Linear Combination" , 1 , new EndOfDayDateTime( this.lastDate , EndOfDaySpecificTime.MarketClose ) , "^GSPC"); // ObjectArchiver.Archive( report.AccountReport , --- 228,238 ---- Report report = new Report( this.account , this.historicalQuoteProvider ); ! report.Create( "Linear Combination" , 1 , new EndOfDayDateTime( this.lastDate , EndOfDaySpecificTime.MarketClose ) , "^GSPC"); + WeightedPositions weightedPositions = + this.run_getWeightedPositions(this.genomeRepresentation); + this.run_addEquityLineForWeightedPositions(weightedPositions, Color.Brown, + report); // ObjectArchiver.Archive( report.AccountReport , Index: StrategyType.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/StrategyType.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** StrategyType.cs 3 Aug 2006 21:15:57 -0000 1.4 --- StrategyType.cs 17 Sep 2006 21:24:53 -0000 1.5 *************** *** 36,40 **** FixedPeriodOscillator, ExtremeCounterTrend, ! ImmediateTrendFollower } } --- 36,41 ---- FixedPeriodOscillator, ExtremeCounterTrend, ! ImmediateTrendFollower, ! PortfolioValueOscillator } } Index: GenomeRepresentation.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/GenomeRepresentation.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GenomeRepresentation.cs 7 Aug 2006 21:19:40 -0000 1.7 --- GenomeRepresentation.cs 17 Sep 2006 21:24:53 -0000 1.8 *************** *** 27,30 **** --- 27,31 ---- using QuantProject.ADT; using QuantProject.ADT.Optimizing.Genetic; + using QuantProject.ADT.Optimizing.BruteForce; using QuantProject.Business.Financial.Ordering; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; *************** *** 47,50 **** --- 48,54 ---- private int halfPeriodDays = -1; private PortfolioType portfolioType = PortfolioType.ShortAndLong; + private int createdGenerations = -1; + private double oversoldThreshold = 0.0; + private double overboughtThreshold = 0.0; public string SignedTickers *************** *** 91,94 **** --- 95,107 ---- } + /// <summary> + /// Total number of the generations created by the GO + /// that produced the current genome + /// </summary> + public int CreatedGenerations + { + get { return this.createdGenerations; } + } + public int HalfPeriodDays { *************** *** 106,109 **** --- 119,139 ---- } } + + public double OversoldThreshold + { + get + { + return this.oversoldThreshold; + } + } + + public double OverboughtThreshold + { + get + { + return this.overboughtThreshold; + } + } + // public static string[] GetSignedTickers( string signedTickers ) // { *************** *** 124,132 **** } ! 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 --- 154,162 ---- } ! public static string[] GetSignedTickers( string signedTickersWithOrWithoutWeights ) { string[] returnValue = ! signedTickersWithOrWithoutWeights.Split( ConstantsProvider.SeparatorForTickers.ToCharArray()); ! if( signedTickersWithOrWithoutWeights.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 *************** *** 141,154 **** } ! 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 --- 171,184 ---- } ! public static double[] GetWeightsForSignedTickers( string signedTickersWithOrWithoutWeights ) { ! string[] signedTickersWithOrWithoutWeightsArray = ! signedTickersWithOrWithoutWeights.Split( ConstantsProvider.SeparatorForTickers.ToCharArray() ); double[] returnValue = ! new double[signedTickersWithOrWithoutWeights.Length]; for(int i = 0; i<returnValue.Length; i++) returnValue[i] = 1.0/returnValue.Length; ! if((signedTickersWithOrWithoutWeights.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 *************** *** 157,161 **** { returnValue[i] = ! Convert.ToDouble( signedTickersWithWeightsArray[i].Split( ConstantsProvider.SeparatorForWeights.ToCharArray() )[1] ); } } --- 187,191 ---- { returnValue[i] = ! Convert.ToDouble( signedTickersWithOrWithoutWeightsArray[i].Split( ConstantsProvider.SeparatorForWeights.ToCharArray() )[1] ); } } *************** *** 182,195 **** } ! private string getSignedTickers( Genome genome ) { string signedTickers = ""; ! foreach ( string geneValue in ((GenomeMeaning)genome.Meaning).Tickers ) ! signedTickers += geneValue + ";"; signedTickers = signedTickers.Substring( 0 , signedTickers.Length - 1 ); return signedTickers; } ! private string getWeights( Genome genome ) { --- 212,225 ---- } ! private string getSignedTickers( string[] signedTickersArray ) { string signedTickers = ""; ! foreach ( string signedTicker in signedTickersArray ) ! signedTickers += signedTicker + ";"; signedTickers = signedTickers.Substring( 0 , signedTickers.Length - 1 ); return signedTickers; } ! private string getWeights( Genome genome ) { *************** *** 200,205 **** return weights; } ! ! // private string getSignedTickersWithWeights( Genome genome ) // { // string signedTickersWithWeights = ""; --- 230,235 ---- return weights; } ! ! // private string getSignedTickersWithWeights( Genome genome ) // { // string signedTickersWithWeights = ""; *************** *** 265,273 **** private void genomeRepresentation( Genome genome , DateTime firstOptimizationDate , DateTime lastOptimizationDate , ! int generationCounter, int eligibleTickers, int halfPeriodDays, PortfolioType portfolioType ) { this.fitness = genome.Fitness; //this.signedTickers = this.getSignedTickersWithWeights( genome ); ! this.signedTickers = this.getSignedTickers( genome ); this.weights = this.getWeights( genome ); this.firstOptimizationDate = firstOptimizationDate; --- 295,305 ---- private void genomeRepresentation( Genome genome , DateTime firstOptimizationDate , DateTime lastOptimizationDate , ! int generationCounter, int eligibleTickers, ! int halfPeriodDays, PortfolioType portfolioType, ! int createdGenerations) { this.fitness = genome.Fitness; //this.signedTickers = this.getSignedTickersWithWeights( genome ); ! this.signedTickers = this.getSignedTickers( ((GenomeMeaning)genome.Meaning).Tickers ); this.weights = this.getWeights( genome ); this.firstOptimizationDate = firstOptimizationDate; *************** *** 277,280 **** --- 309,313 ---- this.halfPeriodDays = halfPeriodDays; this.portfolioType = portfolioType; + this.createdGenerations = createdGenerations; } *************** *** 283,287 **** { this.genomeRepresentation( genome , ! firstOptimizationDate , lastOptimizationDate , -1, -1, -1, PortfolioType.ShortAndLong ); } --- 316,320 ---- { this.genomeRepresentation( genome , ! firstOptimizationDate , lastOptimizationDate , -1, -1, -1, PortfolioType.ShortAndLong, -1 ); } *************** *** 291,297 **** { this.genomeRepresentation( genome , firstOptimizationDate , ! lastOptimizationDate , generationCounter, -1, -1, PortfolioType.ShortAndLong); } public GenomeRepresentation( Genome genome , DateTime firstOptimizationDate , DateTime lastOptimizationDate , --- 324,345 ---- { this.genomeRepresentation( genome , firstOptimizationDate , ! lastOptimizationDate , generationCounter, -1, -1, PortfolioType.ShortAndLong, -1); } + public GenomeRepresentation( BruteForceOptimizableParameters BFOptimizableParamaters , + string[] signedTickersArray, + DateTime firstOptimizationDate , DateTime lastOptimizationDate , + int eligibleTickers ) + { + this.fitness = BFOptimizableParamaters.Fitness; + //this.signedTickers = this.getSignedTickersWithWeights( genome ); + this.signedTickers = this.getSignedTickers(signedTickersArray); + this.weights = null; + this.firstOptimizationDate = firstOptimizationDate; + this.lastOptimizationDate = lastOptimizationDate; + this.eligibleTickers = eligibleTickers; + } + + public GenomeRepresentation( Genome genome , DateTime firstOptimizationDate , DateTime lastOptimizationDate , *************** *** 299,303 **** { this.genomeRepresentation( genome , firstOptimizationDate , ! lastOptimizationDate , generationCounter, eligibleTickers, -1, PortfolioType.ShortAndLong); } --- 347,351 ---- { this.genomeRepresentation( genome , firstOptimizationDate , ! lastOptimizationDate , generationCounter, eligibleTickers, -1, PortfolioType.ShortAndLong, -1); } *************** *** 308,320 **** this.genomeRepresentation( genome , firstOptimizationDate , lastOptimizationDate , generationCounter, eligibleTickers, halfPeriodDays, ! PortfolioType.ShortAndLong); } public GenomeRepresentation( Genome genome , DateTime firstOptimizationDate , DateTime lastOptimizationDate , ! int generationCounter, int eligibleTickers, int halfPeriodDays, PortfolioType portfolioType ) { this.genomeRepresentation( genome , firstOptimizationDate , ! lastOptimizationDate , generationCounter, eligibleTickers, halfPeriodDays, portfolioType); } --- 356,393 ---- this.genomeRepresentation( genome , firstOptimizationDate , lastOptimizationDate , generationCounter, eligibleTickers, halfPeriodDays, ! PortfolioType.ShortAndLong, -1); } public GenomeRepresentation( Genome genome , DateTime firstOptimizationDate , DateTime lastOptimizationDate , ! int generationCounter, int eligibleTickers, ! int halfPeriodDays, PortfolioType portfolioType ) { this.genomeRepresentation( genome , firstOptimizationDate , ! lastOptimizationDate , generationCounter, eligibleTickers, ! halfPeriodDays, portfolioType, -1); ! } ! ! public GenomeRepresentation( Genome genome , ! DateTime firstOptimizationDate , DateTime lastOptimizationDate , ! int generationCounter, int eligibleTickers, ! int halfPeriodDays, PortfolioType portfolioType, int createdGenerations ) ! { ! this.genomeRepresentation( genome , firstOptimizationDate , ! lastOptimizationDate , generationCounter, eligibleTickers, ! halfPeriodDays, portfolioType, createdGenerations); ! } ! ! public GenomeRepresentation( Genome genome , ! DateTime firstOptimizationDate , DateTime lastOptimizationDate , ! int generationCounter, int eligibleTickers, ! int halfPeriodDays, PortfolioType portfolioType, int createdGenerations, ! double oversoldThreshold, double overboughtThreshold) ! { ! this.genomeRepresentation( genome , firstOptimizationDate , ! lastOptimizationDate , generationCounter, eligibleTickers, ! halfPeriodDays, portfolioType, createdGenerations); ! this.oversoldThreshold = oversoldThreshold; ! this.overboughtThreshold = overboughtThreshold; } Index: TestDisplayer.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/LinearCombination/TestDisplayer.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TestDisplayer.cs 7 Aug 2006 21:19:40 -0000 1.10 --- TestDisplayer.cs 17 Sep 2006 21:24:53 -0000 1.11 *************** *** 59,62 **** --- 59,63 ---- private StrategyType selectedStrategyType = StrategyType.OpenToCloseDaily; private System.Windows.Forms.Label labelPortfolioType; + private System.Windows.Forms.RadioButton radioButtonPVO; private System.Windows.Forms.ComboBox comboBoxPortfolioType; *************** *** 97,100 **** --- 98,106 ---- ts.GridColumnStyles.Add(genNumber); + DataGridTextBoxColumn createdGen = new DataGridTextBoxColumn(); + createdGen.MappingName ="CreatedGenerations"; + createdGen.HeaderText = "TotGen"; + ts.GridColumnStyles.Add(createdGen); + DataGridTextBoxColumn eligible = new DataGridTextBoxColumn(); eligible.MappingName ="EligibleTickers"; *************** *** 102,105 **** --- 108,121 ---- ts.GridColumnStyles.Add(eligible); + DataGridTextBoxColumn oversoldThreshold = new DataGridTextBoxColumn(); + oversoldThreshold.MappingName ="OversoldThreshold"; + oversoldThreshold.HeaderText = "OversoldThreshold"; + ts.GridColumnStyles.Add(oversoldThreshold); + + DataGridTextBoxColumn overboughtThreshold = new DataGridTextBoxColumn(); + overboughtThreshold.MappingName ="OverboughtThreshold"; + overboughtThreshold.HeaderText = "OverboughtThreshold"; + ts.GridColumnStyles.Add(overboughtThreshold); + this.dgBestGenomes.TableStyles.Clear(); ts.AllowSorting = true; *************** *** 172,175 **** --- 188,192 ---- this.comboBoxPortfolioType = new System.Windows.Forms.ComboBox(); this.labelPortfolioType = new System.Windows.Forms.Label(); + this.radioButtonPVO = new System.Windows.Forms.RadioButton(); ((System.ComponentModel.ISupportInitialize)(this.dgBestGenomes)).BeginInit(); this.SuspendLayout(); *************** *** 206,210 **** // textBoxDaysFPOscillatorAndRevOneRank // ! this.textBoxDaysFPOscillatorAndRevOneRank.Location = new System.Drawing.Point(320, 176); this.textBoxDaysFPOscillatorAndRevOneRank.Name = "textBoxDaysFPOscillatorAndRevOneRank"; this.textBoxDaysFPOscillatorAndRevOneRank.Size = new System.Drawing.Size(56, 20); --- 223,227 ---- // textBoxDaysFPOscillatorAndRevOneRank // ! this.textBoxDaysFPOscillatorAndRevOneRank.Location = new System.Drawing.Point(472, 128); this.textBoxDaysFPOscillatorAndRevOneRank.Name = "textBoxDaysFPOscillatorAndRevOneRank"; this.textBoxDaysFPOscillatorAndRevOneRank.Size = new System.Drawing.Size(56, 20); *************** *** 263,269 **** // labelDays // ! this.labelDays.Location = new System.Drawing.Point(272, 176); this.labelDays.Name = "labelDays"; ! this.labelDays.Size = new System.Drawing.Size(40, 16); this.labelDays.TabIndex = 9; this.labelDays.Text = "days"; --- 280,286 ---- // labelDays // ! this.labelDays.Location = new System.Drawing.Point(432, 136); this.labelDays.Name = "labelDays"; ! this.labelDays.Size = new System.Drawing.Size(32, 16); this.labelDays.TabIndex = 9; this.labelDays.Text = "days"; *************** *** 288,292 **** // comboBoxPortfolioType // ! this.comboBoxPortfolioType.Location = new System.Drawing.Point(480, 104); this.comboBoxPortfolioType.Name = "comboBoxPortfolioType"; this.comboBoxPortfolioType.Size = new System.Drawing.Size(184, 21); --- 305,309 ---- // comboBoxPortfolioType // ! this.comboBoxPortfolioType.Location = new System.Drawing.Point(472, 80); this.comboBoxPortfolioType.Name = "comboBoxPortfolioType"; this.comboBoxPortfolioType.Size = new System.Drawing.Size(184, 21); *************** *** 296,300 **** // labelPortfolioType // ! this.labelPortfolioType.Location = new System.Drawing.Point(480, 88); this.labelPortfolioType.Name = "labelPortfolioType"; this.labelPortfolioType.Size = new System.Drawing.Size(100, 16); --- 313,317 ---- // labelPortfolioType // ! this.labelPortfolioType.Location = new System.Drawing.Point(472, 64); this.labelPortfolioType.Name = "labelPortfolioType"; this.labelPortfolioType.Size = new System.Drawing.Size(100, 16); *************** *** 302,305 **** --- 319,331 ---- this.labelPortfolioType.Text = "Type of portfolio"; // + // radioButtonPVO + // + this.radioButtonPVO.Location = new System.Drawing.Point(232, 168); + this.radioButtonPVO.Name = "radioButtonPVO"; + this.radioButtonPVO.Size = new System.Drawing.Size(192, 24); + this.radioButtonPVO.TabIndex = 15; + this.radioButtonPVO.Text = "Portfolio Value Oscillator"; + this.radioButtonPVO.CheckedChanged += new System.EventHandler(this.radioButtonPVO_CheckedChanged); + // // TestDisplayer // *************** *** 307,310 **** --- 333,337 ---- this.ClientSize = new System.Drawing.Size(704, 373); this.Controls.AddRange(new System.Windows.Forms.Control[] { + this.radioButtonPVO, this.labelPortfolioType, this.comboBoxPortfolioType, *************** *** 436,439 **** --- 463,468 ---- else if(this.radioButtonImmediateTrendFollower.Checked) this.selectedStrategyType = StrategyType.ImmediateTrendFollower; + else if(this.radioButtonPVO.Checked) + this.selectedStrategyType = StrategyType.PortfolioValueOscillator; } *************** *** 469,472 **** --- 498,506 ---- this.update_selectedStrategyType(); } + + private void radioButtonPVO_CheckedChanged(object sender, System.EventArgs e) + { + this.update_selectedStrategyType(); + } } --- NEW FILE: FixedLevelOscillatorPVOStrategy.cs --- /* QuantProject - Quantitative Finance Library FixedLevelOscillatorPVOStrategy.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; using QuantProject.Scripts.TickerSelectionTesting.EfficientPortfolios; using QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator; namespace QuantProject.Scripts.WalkForwardTesting.LinearCombination { /// <summary> /// Fixed Level Oscillators /// Portfolio Value Oscillator strategy /// </summary> [Serializable] public class FixedLevelOscillatorPVOStrategy : EndOfDayTimerHandlerPVO, IEndOfDayStrategy { public FixedLevelOscillatorPVOStrategy( Account accountPVO , string[] tickers, double[] tickersPortfolioWeights, double oversoldThreshold, double overboughtThreshold, int numDaysForOscillatingPeriod): base("", 0, tickers.Length, 0, accountPVO, 0,0, "^GSPC", 0, 0, 0, 0, 0, 0, 0, PortfolioType.ShortAndLong, 0.5) { this.chosenTickers = tickers; this.chosenTickersPortfolioWeights = tickersPortfolioWeights; this.currentOversoldThreshold = oversoldThreshold; this.currentOverboughtThreshold = overboughtThreshold; this.numDaysForOscillatingPeriod = numDaysForOscillatingPeriod; } public void FiveMinutesBeforeMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) { } protected override void marketCloseEventHandler_closePositionsIfNeeded() { } protected override double getCurrentChosenTickersValue(IndexBasedEndOfDayTimer timer) { double returnValue = 999.0; if(timer.CurrentDateArrayPosition + 2 >= this.numDaysForOscillatingPeriod) { try { DateTime initialDate = (DateTime)timer.IndexQuotes.Rows[timer.CurrentDateArrayPosition - this.numDaysForOscillatingPeriod + 2]["quDate"]; //so to replicate exactly in sample scheme, where only numOscillatingDay - 1 returns //are computed DateTime finalDate = (DateTime)timer.IndexQuotes.Rows[timer.CurrentDateArrayPosition]["quDate"]; returnValue = SignedTicker.GetCloseToClosePortfolioReturn( this.chosenTickers, this.chosenTickersPortfolioWeights, initialDate,finalDate) + 1.0; } catch(Exception ex) { ex = ex; } } return returnValue; } public override void OneHourAfterMarketCloseEventHandler( Object sender , EndOfDayTimingEventArgs endOfDayTimingEventArgs) { } } } |