Discussion of article "Applying OLAP in trading (part 1): Online analysis of multidimensional data"

 

New article Applying OLAP in trading (part 1): Online analysis of multidimensional data has been published:

The article describes how to create a framework for the online analysis of multidimensional data (OLAP), as well as how to implement this in MQL and to apply such analysis in the MetaTrader environment using the example of trading account history processing.

Traders often have to analyze huge amounts of data. These often include numbers, quotes, indicator values and trading reports. Due to the large number of parameters and conditions, on which these numbers depend, let us consider them in parts and view the entire process from different angles. The entire amount of information forms kind of a virtual hypercube, in which each parameter defines its own dimension, which is perpendicular to the rest. Such hypercubes can be processed and analyzed using the popular OLAP ( Online Analytical Processing) technology.

The "online" word in the approach name does not refer to the Internet, but means promptness of results. The operation principle implies the preliminary calculation of the hypercube cells, after which you can quickly extract and view any cross section of the cube in a visual form. This can be compared to the optimization process in MetaTrader: the tester first calculates trading variants (which may take quite a long time, i.e. it is not prompt), and then outputs a report, which features the results linked to input parameters. Starting from build 1860, the MetaTrader 5 platform supports dynamic changes of viewed optimization results by switching various optimization criteria. This is close to OLAP idea. But for a complete analysis, we need the possibility to select many other slices of the hypercube.

We will try to apply the OLAP approach in MetaTrader and to implement multidimensional analysis using MQL tools. Before proceeding to implementation, we need to determine the data to analyze. These may include trading reports, optimization results or indicator values. The selection at this stage is not quite important, because we aim to develop a universal object-oriented engine applicable to any data. But we need to apply the engine to specific results. One of the most popular tasks is the analysis of the trading report. We will consider this task.

Author: Stanislav Korotky 

Applying OLAP in trading (part 1): Online analysis of multidimensional data
Applying OLAP in trading (part 1): Online analysis of multidimensional data
  • www.mql5.com
Traders often have to analyze huge amounts of data. These often include numbers, quotes, indicator values and trading reports. Due to the large number of parameters and conditions, on which these numbers depend, let us consider them in parts and view the entire process from different angles. The entire amount of information forms kind of a...
 

I'm attaching an example of simple wrapper for OLAP classes. The wrapper can be embedded into your EA to analyse instantly trading history at the end of a single pass in the tester.

To choose required analytical sections (selectors) and type of aggregation, the wrapper can be used in EA's OnDeinit, something like this:

void OnDeinit(const int)
{
  OLAPStats stats(SELECTOR_SYMBOL, FIELD_NONE, SELECTOR_PROFITABLE); // choose selectors and fields as required
  stats.setAggregator(AGGREGATOR_COUNT); // choose aggregator, could be e.g.: stats.setAggregator(AGGREGATOR_PROFITFACTOR, FIELD_PROFIT_POINTS);
  stats.setSorting(SORT_BY_VALUE_DESCENDING); // optionally choose sorting order
  // MyOLAPStats callback;      // optional custom implementation of 'display'
  stats.process(/*&callback*/);
}

OLAP is usefull for splitting data by some attributes, which are not provided by standard tester report (for example, profits by symbols, duration, etc).

All dependencies (required header files) can be found in the article. Slightly updated OLAPcube.mqh and Converter.mqh are attached as well.

Files:
OLAPstat.mqh  12 kb
OLAPcube.mqh  42 kb
Converter.mqh  1 kb
Reason: