Build 4.0.0.82 of xlsgen adds support for moving average charts. Again those charts are not supported by Excel, so the goal of xlsgen is to provide chart for everyday needs.
Moving average (N=5)A moving average chart is a chart where a mathematical figure called average is calculated over time, resulting in a curve in and of itself. A moving average, by its nature, smooths out spikes, making it easier to see trends. This chart is often used in financial trading as a tool for analysis.
The average calculation only takes a fraction, usually small, of past data, a parameter which is called N, which is why the chart is called moving average. By default, N=20, meaning that the point in that curve is defined by 20 older data points. The average, because it smoothens a signal, carries a late effect, which is obvious visually, which grows with the value of N. By opposite, the smaller N is, the tighter the average is to the data signal.
Below are examples of the moving average with two other values of N, respectively 10 and 40.
Moving average (N=10)
Moving average (N=40)C/C++ code |
xlsgen::IXlsWorkbookPtr wbk = engine->Open( L"EURUSD1.csv", L"output.xls" );
xlsgen::IXlsChartPtr chart1 = wbk->WorksheetByIndex[1]->NewChart(xlsgen::charttype_movingaverage, row1, col1, row2, col2); xlsgen::IXlsChartDynamicDataSourceSeriesPtr serie1 = chart1->DynamicDataSource->AddSerie(); serie1->SeriesValuesFormula = L"=R1C3:R100C3"; chart1->SeriesByIndex[1]->DataWindowSelection = 40; // N=40
|
The
DataWindowSelection
property is available in each series of data in order to customize the value of N.