ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  financial chart addSimpleMovingAvg
Posted by Steve on May-26-2011 05:38
Hi Peter,

When I use addSimpleMovingAvg on a dataset that has Chart.NoValue in the array (to indicate holidays), it also leaves a space in the moving average line.  Is there a way to keep the moving average line solid even if there is a NoValue in the array?

Thanks,
Steve

  Re: financial chart addSimpleMovingAvg
Posted by Peter Kwan on May-26-2011 12:58
Hi Steve,

Note in standard financial charts, the x-axis should be the "trading session". So it should only include trading days. For example, the timeStamps array should not include Sat and Sun or national holidays or other non-trading days (such as non-trading days due to unpredictable natural phenomena like typhoon or hurricane).

Whereas you can include holidays in the timeStamps array, and then insert NoValue points for the data, such charts are not useful for technical analysis. For example, the trend line (I mean a line that joins the "peaks" or "troughs" that is often drawn manually) will not be accurate because the data points are not in the correct positions suitable for drawing such lines (the data points are stretch further part by the NoValue points).

So to plot a financial chart, you just need to obtain data and plot them. There is no need to insert artificial NoValue points. If you have NoValue points due to holidays, you may remove them before passing them to ChartDirector. This will solve the problem.

If you still want to use NoValue points and to join them, you may use LineLayer.setGapColor. See the sample code "Missing Data Points" for some examples. In a FinanceChart, it is like (in C#/Java):

LineLayer layer = c.addSimpleMovingAvg(.....);
layer.setGapColor(Chart.SameAsMainColor);

Hope this can help.

Regards
Peter Kwan