I translated your SpearmanRanksCorrelation into VB.
Using this indicator on a quick chart it seems to work fine but when using it in a system it always return NaN.
I learned that if we use an indicator in a system the index value in the CalcNewValue function is always 0 right?
The following code snipped shows the beginning of the CalcNewValue function of the SpearmanRanksCorrelation indicator you have posted here http://www.rightedgesystems.com/forums/Topic128-10-1.aspx?
Protected Overrides Function CalcNewValue(ByVal index As Integer) As Double
Dim ranks As New List(Of RankData)
For i As Integer = index - _periods + 1 To index
If i < 0 Then
Dim data As New RankData()
data.S1 = inputs(0).LookBack(i)
data.S2 = inputs(1).LookBack(i)
If Double.IsNaN(data.S1) OrElse Double.IsNaN(data.S2) Then
If index is 0 then i will always be negative and NaN will be returned always. Is this your intention?
Friday December 30 2011 by