Page 1 of 1
problem with Moving average
Posted: Tue Jan 15, 2008 11:51 am
by developer78
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!!!!!
Posted: Mon Feb 11, 2008 4:43 pm
by gerlun
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.
Hello..
Posted: Tue Feb 12, 2008 9:55 am
by developer78
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!!
Posted: Tue Feb 12, 2008 6:35 pm
by gerlun
hmm...I never use XYDataset...
maybe I'll try it later...