Eugene, I can use your help. I think my problem is something I'm doing in c#
I wrote the following code
CODE:
Please log in to see this code.
I ran this on 2000 bars of GLD and also did the math in Excel
The code produces changing values for bars (bar3,bar2,bar1) but bar3=bar2=bar1 ??
Here is what I get in Excel and by hand. I get the right result.
myPivots bar3 bar2 bar1
11/23/2012 1999 1999 1995 1989
11/21/2012 1994 1994 1989 1985
11/20/2012 1994 1994 1989 1985
11/19/2012 1994 1994 1989 1985
11/16/2012 1994 1994 1989 1985
11/15/2012 1994 1994 1989 1985
11/14/2012 1990 1990 1985 1983
11/13/2012 1990 1990 1985 1983
11/12/2012 1990 1990 1985 1983
11/9/2012 1990 1990 1985 1983
11/8/2012 1985 1985 1983 1980
Here is what the code produces. I think the logic is correct. Could it be something with Dataseries objects or casting in C#?
1999 11/23/2012 1999 1999 1999 1999
1998 11/21/2012 1994 1994 1994 1994
1997 11/20/2012 1994 1994 1994 1994
1996 11/19/2012 1994 1994 1994 1994
1995 11/16/2012 1994 1994 1994 1994
1994 11/15/2012 1994 1994 1994 1994
1993 11/14/2012 1990 1990 1990 1990
1992 11/13/2012 1990 1990 1990 1990
1991 11/12/2012 1990 1990 1990 1990
1990 11/9/2012 1990 1990 1990 1990
1989 11/8/2012 1985 1985 1985 1985
Oddly, if I supply PTBars instead of my own calculated pivots, the code works, hand checked with the same Excel program which leads me to believe it is something with C# or the way I am using the DataSeries object
Thanks for your help. Hope it is something obvious to you.