[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/WeightedPVO/WeightedBalancedPVO
In directory sc8-pr-cvs16:/tmp/cvs-serv3185/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/WeightedPVO/WeightedBalancedPVO
Modified Files:
GenomeManagerWeightedBalancedPVO.cs
Log Message:
Fixed bug in overriden method getTickerWeight
Index: GenomeManagerWeightedBalancedPVO.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/TechnicalAnalysisTesting/Oscillators/FixedLevelOscillators/PortfolioValueOscillator/WeightedPVO/WeightedBalancedPVO/GenomeManagerWeightedBalancedPVO.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** GenomeManagerWeightedBalancedPVO.cs 27 Feb 2007 22:52:40 -0000 1.1
--- GenomeManagerWeightedBalancedPVO.cs 9 Apr 2007 18:00:52 -0000 1.2
***************
*** 115,118 ****
--- 115,119 ----
{
double totalOfWeightsForTickersOfTheSameSign = 0.0;
+ int numOfTickersOfTheSameSign = 0;
for(int j = this.numOfGenesDedicatedToThresholds; j < genes.Length; j++)
{
***************
*** 122,135 ****
//thresholds are asymmetrical and current Index Points To A Ticker Of The Same Sign
//0 has to be avoided !
! totalOfWeightsForTickersOfTheSameSign += Math.Abs(genes[j]) + 1.0;
! else if ( this.numOfGenesDedicatedToThresholds == 1 && j%2!=0 &&
this.getTickerWeight_currentIndexPointsToATickerOfTheSameSign(genes,j+1,tickerPositionInGenes) )
//ticker weight is contained in genes at odd position when
//thresholds are symmetrical and current Index Points To A Ticker Of The Same Sign
//0 has to be avoided !
! totalOfWeightsForTickersOfTheSameSign += Math.Abs(genes[j]) + 1.0;
}
! return ( Math.Abs(genes[tickerPositionInGenes-1]) + 1.0 ) /
! ( 2 * totalOfWeightsForTickersOfTheSameSign );
}
--- 123,148 ----
//thresholds are asymmetrical and current Index Points To A Ticker Of The Same Sign
//0 has to be avoided !
! {
! totalOfWeightsForTickersOfTheSameSign += Math.Abs(genes[j]) + 1.0;
! numOfTickersOfTheSameSign++;
! }
! else if ( this.numOfGenesDedicatedToThresholds == 1 && j%2!=0 &&
this.getTickerWeight_currentIndexPointsToATickerOfTheSameSign(genes,j+1,tickerPositionInGenes) )
//ticker weight is contained in genes at odd position when
//thresholds are symmetrical and current Index Points To A Ticker Of The Same Sign
//0 has to be avoided !
! {
! totalOfWeightsForTickersOfTheSameSign += Math.Abs(genes[j]) + 1.0;
! numOfTickersOfTheSameSign++;
! }
}
! double minimumWeight = 0.75*(0.5/numOfTickersOfTheSameSign);
! //with 0.75 the minimum weight for 4 ticker can be 0.1875 (2 long and 2 short)
! //or 0.125 (3 long and 1 short or viceversa)
! double normalizingWeight = ( ( Math.Abs(genes[tickerPositionInGenes-1]) + 1.0 ) /
! totalOfWeightsForTickersOfTheSameSign ) *
! (0.5 - numOfTickersOfTheSameSign*minimumWeight);
!
! return minimumWeight + normalizingWeight;
}
|