Simple Moving Average on graphs

Discussions about iCompta on macOS
Post Reply
Aqntbghd
Posts: 4
Joined: 21 May 2012, 13:48

Simple Moving Average on graphs

Post by Aqntbghd »

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 :)

thanks,
User avatar
Angeman
Administrateur
Posts: 2369
Joined: 28 December 2008, 21:28
Location: Toulouse, France
Contact:

Re: Simple Moving Average on graphs

Post by Angeman »

Yes I'll take a look at it and maybe I'll add it in a future release.
Aqntbghd
Posts: 4
Joined: 21 May 2012, 13:48

Re: Simple Moving Average on graphs

Post by Aqntbghd »

Thanks :) I will be very happy to code it if its just a engineer-time restriction :)

ps: lyricapps est-elle une société française ?
User avatar
Angeman
Administrateur
Posts: 2369
Joined: 28 December 2008, 21:28
Location: Toulouse, France
Contact:

Re: Simple Moving Average on graphs

Post by Angeman »

Aqntbghd wrote:Thanks I will be very happy to code it if its just a engineer-time restriction
Yes it would help a lot if you could work on the algorithm ;)
Aqntbghd wrote:ps: lyricapps est-elle une société française ?
Oui, il y a d'ailleurs un forum dédié en français : http://forums.lyricapps.fr/
Aqntbghd
Posts: 4
Joined: 21 May 2012, 13:48

Re: Simple Moving Average on graphs

Post by Aqntbghd »

Angeman wrote:
Aqntbghd wrote:Thanks I will be very happy to code it if its just a engineer-time restriction
Yes it would help a lot if you could work on the algorithm ;)
easy/facile :)

Code: Select all

//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);}
ps: french version available on request ;)
User avatar
Angeman
Administrateur
Posts: 2369
Joined: 28 December 2008, 21:28
Location: Toulouse, France
Contact:

Re: Simple Moving Average on graphs

Post by Angeman »

Thanks
Aqntbghd
Posts: 4
Joined: 21 May 2012, 13:48

Re: Simple Moving Average on graphs

Post by Aqntbghd »

Any news on that feature request ? :)
User avatar
Angeman
Administrateur
Posts: 2369
Joined: 28 December 2008, 21:28
Location: Toulouse, France
Contact:

Re: Simple Moving Average on graphs

Post by Angeman »

It won't be included in iCompta 5 sorry but maybe in a 5.x update.
Post Reply