[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample PairsTr
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2008-03-13 19:39:11
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv16984/b7_Scripts/WalkForwardTesting/PairsTrading/InSample Modified Files: PairsTradingFitnessEvaluator.cs Log Message: The maxCorrelationAllowed parameter has been added Index: PairsTradingFitnessEvaluator.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/PairsTrading/InSample/PairsTradingFitnessEvaluator.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PairsTradingFitnessEvaluator.cs 27 Feb 2008 21:15:05 -0000 1.1 --- PairsTradingFitnessEvaluator.cs 13 Mar 2008 19:38:42 -0000 1.2 *************** *** 38,41 **** --- 38,42 ---- public class PairsTradingFitnessEvaluator : IFitnessEvaluator { + private double maxCorrelationAllowed; public string Description *************** *** 47,52 **** } ! public PairsTradingFitnessEvaluator() { } #region GetFitnessValue --- 48,55 ---- } ! public PairsTradingFitnessEvaluator( ! double maxCorrelationAllowed ) { + this.maxCorrelationAllowed = maxCorrelationAllowed; } #region GetFitnessValue *************** *** 100,104 **** --- 103,113 ---- // for the current optimization's candidate, // all positions's tickers are distinct + { fitnessValue = this.getFitnessValue( weightedPositions , returnsManager ); + if ( fitnessValue > this.maxCorrelationAllowed ) + // the two positions are too correlated. They may represent + // the same instrument + fitnessValue = -0.4; + } return fitnessValue; } |