Discussing the article: "Wrapping ONNX models in classes"

 

Check out the new article: Wrapping ONNX models in classes.

Object-oriented programming enables creation of a more compact code that is easy to read and modify. Here we will have a look at the example for three ONNX models.

The majority of votes is calculated according to the equation <total number of votes>/2 + 1. For a total of 3 votes, the majority is 2 votes. This is a so-called "hard voting".

The test result is still with the same settings.

Hard voting test results

Let's recall the work of all three models separately, namely the number of profitable and unprofitable trades. First model — 11 : 3, second — 6 : 1, third — 16 : 10.

It seems that we have improved the result with the help of hard voting — 16 : 4. But, of course, we need to look at full reports and test charts.

Author: MetaQuotes

 
Very useful article!

Is ONNX version 1.13.0 or 1.14.0 used by MT5?
 

This is really interesting, thank you very much.

In the attached ML file ONNX.eurusd.D1.30.class.Training.py to the article, there are the following lines of code (line 48 - 59) in def collect_dataset():

    for i in tqdm(range(n - sample_size)):
        w = df.iloc[i: i + sample_size + 1]
        x = w[['close', 'ma_fast', 'ma_slow']].iloc[:-1].values

        delta = x[0][-1] - w.iloc[-1]['close']
        if np.abs(delta)<=0.0001:
           y = 0, 1, 0
        else:
           if delta>0:
              y = 1, 0, 0
           else:
              y = 0, 0, 1

What is the logic behind the highlighted line above please?

The classification is based on the different between the first sample's 'ma_slow' (x[0][-1]) and the new target's 'close' (w.iloc[-1]['close']). Moreover there would have a time different of 'sample_size-1'.

In addition:

if delta>0:
              y = 1, 0, 0

shouldn't this be y = 0,0,1? I.e. a Sell signal.

Likewise to ONNX.eurusd.D1.10.class.Training.py in def collect_dataset(), line45-47:

        x = w[['open', 'high', 'low', 'close']].iloc[:-1].values

        delta = x[3][-1] - w.iloc[-1]['close']
How? The classification is based on the different between the fourth sample's 'close' (x[3][-1]) and the new target's 'close' (w.iloc[-1]['close']); and there would have a time different of 'sample_size-4'.
 
Xiaoyu Huang #:
Very useful article!

Is ONNX version 1.13.0 or 1.14.0 used by MT5?
Can't seem to find the information. Any reason for asking?
Reason: