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

 

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

 
"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...
 
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."
 

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?

 
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
 
it is fake because you train current year and baktest current year again

 
This is completely wrong approach . You can't generate a model based on the same training and testing  dataset  then say it is working that's useless and baseless. Its called Curve fitting the model . Such models look good on paper but will never work in real world. Please use correct approach to machine learning , there are several ways to do it but yours is completely wrong. 
 
Jacob James:
This is completely wrong approach . You can't generate a model based on the same training and testing  dataset  then say it is working that's useless and baseless. Its called Curve fitting the model . Such models look good on paper but will never work in real world. Please use correct approach to machine learning , there are several ways to do it but yours is completely wrong. 

I think you both just completely wrong, guys. The aritcle marked as 'naive approach' as introduction to CatBoost model. No one forbids you to test the model on new data. Also at the and of the article you can see test on new data + learning period.

Just read an articles more carefully, because next part on the way.
 
I used it, either I make it myself, or I use what you provide.  There are the following errors.  



 
Thank you.
 
Yu Zhang #:
I used it, either I make it myself, or I use what you provide.  There are the following errors.  



I think you have different number of features in python and mql, something wrong 

Reason: