Discussion of article "Gradient Boosting (CatBoost) in the development of trading systems. A naive approach"

MetaQuotes
Moderator
226549
MetaQuotes  

New article Gradient Boosting (CatBoost) in the development of trading systems. A naive approach has been published:

In this article, we train the CatBoost classifier in Python and export the model to mql5, as well as parse the model parameters and consider a custom strategy tester. The Python language and the MetaTrader 5 library are used for preparing the data and for training the model.

The compiled bot can be tested in the standard MetaTrader 5 Strategy Tester. Select a proper timeframe (which must match the one used in model training) and inputs look_back and MA_period, which should also match the parameters from the Python program. Let us check the model in the training period (training + validation subsamples):

Model performance (training + validation subsamples)

If we compare the result with that obtained in the custom tester, these results are the same, except for some spread deviations. Now, let us test the model using absolutely new data, from the beginning of the year:

Model performance on new data

The model performed worse with new data. Such a result is related to objective reasons, which I will try to describe further.

Author: Maxim Dmitrievsky

clemmo
241
clemmo  
"array out of range in 'cat_model.mqh' (189, 51)"
Testing on EURUSD H1 as per the example case cited in the article.

Perhaps the information here will be of use.
"

Array out of Range

When working with arrays, the access to their elements is performed by the index number, which cannot be negative and must be less than the array size. The array size can be obtained using the

CopyTicks() function tries to store the requested number of ticks to an array, but if there are less ticks than requested, the size of resulting array will be smaller than expected.

Another quite obvious way to get this error is to attempt to access the data of an indicator buffer while its size has not been initialized yet. As a reminder, the indicator buffers are dynamic arrays, and their sizes are defined by the terminal's execution system only after the chart initialization. Therefore, for instance, an attempt to access the data of such a buffer in the OnInit() function causes an "array out of range" error.

A simple example of an indicator that generates this error can be found in Test_Out_of_range.mq5 file. "

The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks, as a small error in the expert or indicator logic can cause losses on the trading account. That is why we have developed a series of basic checks to ensure the required quality level of the Market products. If any errors are identified by the Market...
Maxim Dmitrievsky
21599
Maxim Dmitrievsky  
clemmo:
"array out of range in 'cat_model.mqh' (189, 51)"
Testing on EURUSD H1 as per the example case cited in the article.

Perhaps the information here will be of use.
"

Array out of Range

When working with arrays, the access to their elements is performed by the index number, which cannot be negative and must be less than the array size. The array size can be obtained using the

CopyTicks() function tries to store the requested number of ticks to an array, but if there are less ticks than requested, the size of resulting array will be smaller than expected.

Another quite obvious way to get this error is to attempt to access the data of an indicator buffer while its size has not been initialized yet. As a reminder, the indicator buffers are dynamic arrays, and their sizes are defined by the terminal's execution system only after the chart initialization. Therefore, for instance, an attempt to access the data of such a buffer in the OnInit() function causes an "array out of range" error.

A simple example of an indicator that generates this error can be found in Test_Out_of_range.mq5 file. "

"The look_back and MA_period parameters must be set exactly as they were specified during training in the Python program, otherwise an error will be thrown."
clemmo
241
clemmo  

You are correct, the catboost_learning.py uses a lookback of 250 instead of 50 as configured in the cat_trader.mq5.  A technical obstacle intended to deter the casual onlooker perhaps?

Maxim Dmitrievsky
21599
Maxim Dmitrievsky  
clemmo:

You are correct, the catboost_learning.py uses a lookback of 250 instead of 50 as configured in the cat_trader.mq5.  A technical obstacle intended to deter the casual onlooker perhaps?

no just aticle was for 50 features, for simplicity but then I did for 250

new article on the way also
Mohammad Hashemi
3126
Mohammad Hashemi  
it is fake because you train current year and baktest current year again