I would like to store values from a dataseries in 2 arrays. The code looks like this :
private DataSeries Value1 ;
private double[] jj ;
private double[] vv ;
protected override void Initialize()
{
Value1 = new DataSeries (this) ;
jj = new double[period];
vv = new double[period];
}
protected override void OnBarUpdate()
{
if (CurrentBar<1) {return;}
Value1.Set(Math.Sign(Close[0]-Close[1]));
if (CurrentBar>period)
{
for (int k =1;k==period;k++)
{
jj[k]=Value1[k-1];
vv[k]=Value1[k];
}
}
No problem compiling, no error in the log but when I run the indicator and try random values for jj or vv it always return 0.
What am I doing wrong ?
Comment