Build 4.0.0.87 of xlsgen adds support for the exponential moving average trendline.
The exponential moving average, as the name suggests, is an exponentially decreasing moving average which means recent data in the moving window has more weight than older data.
The exponential moving average is closer visually to the series data than the regular moving average and reveals trends like the moving average. It can improve the decision based on the trend analysis.
Exponential moving average (N=20 values in the data window) versus moving averageCreating the trendline is straight forward :
C/C++ code |
xlsgen::IXlsWorkbookPtr workbook = engine->Open( L"EURUSD1.csv", L"exponential_moving_average.xls" );
xlsgen::IXlsChartPtr chart = workbook->WorksheetByIndex[1]->NewChart(xlsgen::charttype_line2D, 1, //row1 2, //col1 28, //row2 15 //col2 );
xlsgen::IXlsChartDynamicDataSourceSeriesPtr serie001s0ss0 = chart->DynamicDataSource->AddSerie(); serie001s0ss0->SeriesValuesFormula = L"=R1C3:R100C3";
chart->SeriesByIndex[1]->TrendLines[1]->Show = xlsgen::charttrendline_exponentialmovingaverage; // exponential moving average trendline chart->SeriesByIndex[1]->TrendLines[1]->MovingAveragePeriods = 20; // N=20
workbook->WorksheetByIndex[1]->Export->ExportAsPDF(L"exponential_moving_average.pdf"); // ask xlsgen to compute and render it
workbook->Close();
|