problem with Moving average

Discussion about JFreeChart related to stockmarket charts.
Locked
developer78
Posts: 15
Joined: Fri Jan 11, 2008 10:58 am

problem with Moving average

Post by developer78 » Tue Jan 15, 2008 11:51 am

:?
:?
Hello???
I'm working with candleStick chart and want to create moving average of 13 days.the chart is working fine but my problem with moving average. how can i create an moving average of a specific period( ie. 13 days)?????
plz help!!!!!

gerlun
Posts: 9
Joined: Mon Feb 11, 2008 4:32 pm

Post by gerlun » Mon Feb 11, 2008 4:43 pm

I created my line chart as shown below:
ts = new TimeSeries("Stock", Minute.class);

And I created the 10-day moving average as below:
TimeSeries ma10 = MovingAverage.createMovingAverage(ts, "10 day", 14400, 0);

14400 is the no. of minutes in 10 days
It seems the graph is correct.

Please notify me if my method is wrong.

developer78
Posts: 15
Joined: Fri Jan 11, 2008 10:58 am

Hello..

Post by developer78 » Tue Feb 12, 2008 9:55 am

Hello gerlun:
Thanks for ur reply, My problem is.. I'm using createMovingAverage() method that returns XYDataset. I did something like this...

dataset= MovingAverage.createMovingAverage(dataset, "Moving Avg", 60*24*14,0);
plot.setDataset(1,dataset2);

but as per ur example, this method returns TimeSeries...
is there any way to do with the TimeSeries!!
please help!!

gerlun
Posts: 9
Joined: Mon Feb 11, 2008 4:32 pm

Post by gerlun » Tue Feb 12, 2008 6:35 pm

hmm...I never use XYDataset...
maybe I'll try it later... :wink:

Locked