Would it be possible in iCompta to graph not only the point value in time of an account (or a set of accounts) but also the Simple moving average to these values (http://en.wikipedia.org/wiki/Moving_average). As an example, a SMA30 or SMA45 are used by some financial institutions to evaluate whether you're a good or bad customer, so i'd like to know how I rank
//A nice array that contains all the money values for everyday with now being MAX_DAYS
float money_per_day[MAX_DAYS];
// returns the SMA value for this_day averaged over days_average
float SMA(int this_day, int days_average) {
// if the asked day is smaller than the averaging period before it, then return a fake one. another solution is to return 0.0 as it might be disturbing to have wrong averages.
if this_day<days_average {return SMA(this_day,this_day)}
float sum=0.0;
for (int i=0; i<days_average;i++) {
sum+=money_per_day[this_day-i];
}
return (sum/days_average);
}
float SMA45(int this_day) {return SMA(this_day,45);}