[Quantproject-developers] QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOs
Brought to you by:
glauco_1
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25974/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/InSampleChoosers Added Files: PVO_CTOCorrelationChooser.cs PVO_OTOCorrelationChooser.cs Log Message: Added choosers for the PVO strategy based on CTO and OTO (OpenToOpen) correlations --- NEW FILE: PVO_CTOCorrelationChooser.cs --- /* QuantProject - Quantitative Finance Library PVO_CTOCorrelationChooser.cs Copyright (C) 2008 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.ADT; using QuantProject.ADT.Messaging; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.TickersRelationships; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator.InSampleChoosers; namespace QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator.InSampleChoosers { /// <summary> /// PVO_CTOCorrelationChooser to be used for /// in sample optimization /// By means of correlation, the AnalyzeInSample method returns the /// requested number of PVOPositions (positions for the PVO strategy) /// </summary> public class PVO_CTOCorrelationChooser : PVOCorrelationChooser { private float minimumAbsoluteReturnValue; private float maximumAbsoluteReturnValue; //correlation is computed only for returns //between minimum and maximum /// <summary> /// PVO_CTOCorrelationChooser to be used for /// in sample optimization /// </summary> /// <param name="numberOfBestTestingPositionsToBeReturned"> /// The number of PVOPositions that the /// AnalyzeInSample method will return /// </param> public PVO_CTOCorrelationChooser(int numberOfBestTestingPositionsToBeReturned, double maxCorrelationValue, bool balancedWeightsOnVolatilityBase, float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue, string benchmark) : base(numberOfBestTestingPositionsToBeReturned, 1, maxCorrelationValue, balancedWeightsOnVolatilityBase, IntervalsType.CloseToOpenIntervals, benchmark) { this.minimumAbsoluteReturnValue = minimumAbsoluteReturnValue; this.maximumAbsoluteReturnValue = maximumAbsoluteReturnValue; } protected override void setCorrelationProvider(EligibleTickers eligibleTickers , ReturnsManager returnsManager) { this.correlationProvider = new CloseToOpenCorrelationProvider(eligibleTickers.Tickers, returnsManager, this.minimumAbsoluteReturnValue , this.maximumAbsoluteReturnValue); } } } --- NEW FILE: PVO_OTOCorrelationChooser.cs --- /* QuantProject - Quantitative Finance Library PVO_OTOCorrelationChooser.cs Copyright (C) 2008 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.ADT; using QuantProject.ADT.Messaging; using QuantProject.Business.Strategies; using QuantProject.Business.Strategies.TickersRelationships; using QuantProject.Business.Strategies.Eligibles; using QuantProject.Business.Strategies.ReturnsManagement; using QuantProject.Business.Strategies.ReturnsManagement.Time; using QuantProject.Business.Strategies.OutOfSample; using QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator.InSampleChoosers; namespace QuantProject.Scripts.TechnicalAnalysisTesting.Oscillators.FixedLevelOscillators.PortfolioValueOscillator.InSampleChoosers { /// <summary> /// PVO_OTOCorrelationChooser to be used for /// in sample optimization /// By means of correlation, the AnalyzeInSample method returns the /// requested number of PVOPositions (positions for the PVO strategy) /// </summary> public class PVO_OTOCorrelationChooser : PVOCorrelationChooser { private float minimumAbsoluteReturnValue; private float maximumAbsoluteReturnValue; //correlation is computed only for returns //between minimum and maximum /// <summary> /// PVO_OTOCorrelationChooser to be used for /// in sample optimization /// </summary> /// <param name="numberOfBestTestingPositionsToBeReturned"> /// The number of PVOPositions that the /// AnalyzeInSample method will return /// </param> public PVO_OTOCorrelationChooser(int numberOfBestTestingPositionsToBeReturned, int openToOpenReturnIntervalLength, double maxCorrelationValue, bool balancedWeightsOnVolatilityBase, float minimumAbsoluteReturnValue, float maximumAbsoluteReturnValue, string benchmark) : base(numberOfBestTestingPositionsToBeReturned, openToOpenReturnIntervalLength, maxCorrelationValue, balancedWeightsOnVolatilityBase, IntervalsType.OpenToOpenIntervals, benchmark) { this.minimumAbsoluteReturnValue = minimumAbsoluteReturnValue; this.maximumAbsoluteReturnValue = maximumAbsoluteReturnValue; } protected override void setCorrelationProvider(EligibleTickers eligibleTickers , ReturnsManager returnsManager) { DateTime firstDate = returnsManager.ReturnIntervals[0].Begin.DateTime; DateTime lastDate = returnsManager.ReturnIntervals.LastEndOfDayDateTime.DateTime; this.correlationProvider = new OpenToOpenCorrelationProvider(eligibleTickers.Tickers, firstDate, lastDate, this.numDaysForOscillatingPeriod, minimumAbsoluteReturnValue, maximumAbsoluteReturnValue, this.benchmark); } } } |