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
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. "
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
Please enable the necessary setting in your browser, otherwise you will not be able to log in.