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

Message ListMessage List     Post MessagePost Message

  About financechart
Posted by moon on Oct-13-2020 16:37
Hi!
My name is youngjoo moon.
I have one question.
When using the finanncechart as follows.

FinanceChart* c = new FinanceChart(600);//1250
c->setData(new_timeStamps, new_highData, new_lowData, new_openData, new_closeData, new_volData, extraPoints);// extralines);
XYChart* mainChart=c->addMainChart(600);

ScatterLayer* buyLayer = mainChart->addScatterLayer(DoubleArray(), DoubleArray(buySignal + m_startIndex,new_closeData.len), "Buy", Chart::ArrowShape(0, 1, 0.4, 0.4), 11, 0x00ffff);

c->addSimpleMovingAvg(1920, 0x663300);

....

when +zoomiing,  the chart doesn't show the avering line.
I think that the chart uses the data in the chart display window.

ScatterLayer doesn,t be affected.

So is there some method like using scatter layer?

vline can be usefull?

if usefull, how can I implement the avering data calculated by my app program....

Thanks a lot.

  Re: About financechart
Posted by Peter Kwan on Oct-14-2020 01:28
Hi moon,

There is a financechart mfc example with zooming and scrolling below:

https://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1579817128#N1579857444

In the above example, the moving average lines display normally after zoom in.

The most important thing is to have sufficient data to compute the moving average. In your code, you are using 1920 session moving average. That means you need at least 1920 extra points. For example, if you want to display 200 session, you need to obtain data for at least 1920 + 200 = 2120 session so that we can compute the 1920 session moving average.

In the above sample code, the extraPoints are set to the maximum moving average (there are 2 moving averages in the above code):

int extraPoints = (m_avgPeriod1 > m_avgPeriod2) ? m_avgPeriod1 : m_avgPeriod2;

It then adjusts the startIndex backwards to include more data for the extraPoints.

// Add the extra points (adjust the extra points if there are insufficient data)
extraPoints = (std::min)(extraPoints, startIndex);
startIndex -= extraPoints;

For your case, please make sure the extraPoints are set to at least 1920, and the startIndex moves back by at least 1920 to obtain enough data points for the moving average.

Regards
Peter Kwan

  Re: About financechart
Posted by moon on Oct-17-2020 21:16
It works well after following your instructions.
Thanks a lot.