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

Message ListMessage List     Post MessagePost Message

  add Polynomial Regression as price chart overlay in FinanceChart
Posted by nyoman on Dec-21-2018 18:49
Hi Peter,
is there any tutorial on how to add polynomial regression as overlay in FinanceChart
thanks

  Re: add Polynomial Regression as price chart overlay in FinanceChart
Posted by Peter Kwan on Dec-23-2018 04:21
Hi nyoman,

A FinanceChart is a container for many charts - the main price chart, and zero or more indicator charts. You can add a polynomial regression line to any of these charts using code similar to the "Parametric Curve Fitting" sample code.

For example in C#, assumg "c" is a FinanceChart object, the code is like:

FinanceChart c = new FinanceChart(.....);
.....

// Add a main price chart to the FinanceChart
XYChart mainChart = c.addMainChart(....);

// Add a polynomial regression line of degree 2 for the closeData to the main price chart
TrendLayer trend0 = mainChart.addTrendLayer2(null, closeData, 0xff0000);
trend0.setLineWidth(3);
trend0.setRegressionType(Chart.PolynomialRegression(2));
trend0.setHTMLImageMap("{disable}");

.....

Hope this can help.

Regards
Peter Kwan