add constant value to user define array

 

Hi FX maniacs :)


I am trying to make a function to calculate some statistic analysis. So I want to have a two dimension array with close price (Close[i]) and a calculated second dimension. So I think everything is OK but actually it isn't. The problem is that i can't put value of constant "c" i the array. Here is the code:

int i;

double a;

double b;

double c;

double StdDevData[40][2];


for (i=1;i<=scale;i++)

{

c=a+b*i;

Print("c=",c);

StdDevData[i][1]=Close[i];

StdDevData[i][2]=c;

Print("1=",StdDevData[i][1],"---","2=",StdDevData[i][2]);

}


the print of c gives that there is the value of c! but StdDevData[i][2] is still 0.


Can somebody help me on this?


Thank you

 

//?????????????????????????????

StdDevData[i][2]={c};



StdDevData[i][2]=c;

 
abstract_mind:


//?????????????????????????????

StdDevData[i][2]={c};



StdDevData[i][2]=c;

Thank you for response abstract_mind!


This is not the issue. It didn't work with "=c" to. The "{}" I put after reading of a post and forgot to remove before this post. This is not the problem :(. Could you propose something else? Here is the tester output:


2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: 1=1.4576---2=0

2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: c=1.522

2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: 1=1.4575---2=0

2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: c=1.5091

2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: 1=1.4575---2=0

2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: c=1.4962

2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: 1=1.4575---2=0

2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: c=1.4833

2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: 1=1.457---2=0

2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: c=1.4704

2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: b=0.0129

2009.11.06 15:08:11 2009.09.14 01:00 Chenal_01 EURUSD,M5: a=1.4575



Thank you

 
I just edit the post to make it corect
 
//In "C" language index of arrays start from 0 to arraySize-1. Therefore,
//the condition for the loop "for" must be from 0 to scale-1. See the corrections:

for (i=0;i<scale;i++)
{
   c=a+b*i;
   Print("c=",c);
   StdDevData[i][0]=Close[i];
   StdDevData[i][1]=c;
   Print("1=",StdDevData[i][0],"---","2=",StdDevData[i][1]);
}
 

thank you abstract_mind!


Good luck and take care !

Reason: