Non-Linear Time?

 
I need to program time intervals in a non-linear fashion. A linear example would be measuring blocks of 10 candles at a time therefore it would look like this:
[ 10 ] [ 10 ] [ 10 ]
whereby interval 1 to 10 then 11 to 20 then 21 to 30


Whereas I need a non-linear fashion where every single candle is taken into account from the first to the maximum interval that is set, i.e.
interval 1
interval 1 to 2
interval 1 to 3
interval 1 to 4
interval 1 to 5
all the way up the maximum interval set at 10

How do I go about doing this?

Thanks.
 

i assume you want do this trough an array?

if not you can simply use a loop:

double analyze_data(int from, int to){
 //DO THE MATH
}

double results[]
for(int i=1;i<=10;i++){
result[i]=analyze_data(1,i);
}
 
zzuegg:

i assume you want do this trough an array?

if not you can simply use a loop:


ok great, thanks for your help.
 
I don't understand these two lines:

double analyze_data(int from, int to){

and

result[i]=analyze_data(1,i);


I know what double means but what is the purpose for these two lines?


Also I realised that the main purpose behind searching the time series is to measure price distance. Therefore I need to identify the current price, i.e. i

Then I need to identify the price of i++, then get the difference of the two to make it match the condition of the minimum price distance movement, i.e.:

(Pi - Pi++) >= PD

Whereby:
P is Price

PD is Price Distance


How do I do this? My programming skills are somewhat sub-par.

Thanks.

 
hh11:
I don't understand these two lines:

double analyze_data(int from, int to){

and

result[i]=analyze_data(1,i);

double analyze_data(int from, int to){

/*
 With this line you declare a function. in this example the name of the function is analyze_date, 
which returns a double value. as parameters you have to integer variables, form and to. so within
 your code you can call this function with the statement analyze_data(4,5) for example and the function 
will return a double. of course you have to retrun a value. so the complete function (without the math) 
would be something like:
*/

double analyze_data(int from, int to){
  double retval;
  //MATH
  return (retval);
}
result[i]=analyze_data(1,i);

//in this line the above function is called and the result stored in an array..
 
zzuegg:


Thanks, so if I want to get the price high of i and the price low of i++ from the array how would I do this? So that it can match the condition of minimum price distance movement, i.e:


(Pi - Pi++) >= PD


Whereby:
P is Price

PD is Price Distance

Reason: