Machine learning in trading: theory, models, practice and algo-trading - page 2956
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
And here is my implementation of the EA on my own neuronics
I wonder what kind of library this is?
The OnnxTypeInfo help lacks explanations about the dimensions[] field. It would be nice to explain the meaning of this array at least on the example of ONNX.Price.Prediction project, where (MT5 version 3621) it turns out like this:
In python terms, this is the shape of the object.
In python terms, this is the shape of the object.
Then negative numbers and the fact that the length of the array is one unit greater than the number of dimensions of the parameters are confusing.
Besides, the shape for parameters is set in the script, not taken from the model properties. Is this a bug or a feature?
Then negative numbers and the fact that the length of the array is one unit greater than the number of parameter measurements are confusing.
Besides, the shape for the parameters is set in the script, not taken from the model properties. Is this a bug or a feature?
Yes, I forgot about negative values. I'll check.
Hello everyone!
I manage to trade with some success in manual trading mode, but would still like to automate the process. Thinking about it, I decided to try to consult on the issue of machine learning. Who uses what models and with what success? The way I see the problem is as follows:
The fundamental idea is that it is not the direction of the trend that needs to be predicted, but the three points: buy, sell and wait. That is 1 (buy), -1 (sell), 0 (hold the current deal if there is one or do nothing if there are no deals). It is desirable to work with time series on minutes, which I haven't figured out yet. It is important that the time series for some number of past bars is taken into account, so that the indicators on the history are taken into account, otherwise their dynamics will not be clear. I have about 30 of them, it is probably difficult to keep in my mind, but still somehow I manage to trade with my hands.
As I understood, in machine learning there are classification tasks, for example, whether the trend will be up or down, or predicting a specific value like the price will be here with such an error. But in financial markets the task is a bit different - maximising profit while minimising drawdowns. And I have not seen this kind of models of small learning.
That is more profit when its size is maximised for each possible trade and losses are minimised, high accuracy of entering and exiting a trade:
Profit = positive trades - losing trades, when taking into account the spread,
where the sum on positive deals should tend to the maximum, and the sum on losing deals should tend to zero. Then the profit will tend to the maximum by definition, other things being equal (e.g. lot size).
That is, in my opinion, there should be such a model, then inputs and outputs will be more accurate.
Then negative numbers and the fact that the length of the array is one unit greater than the number of parameter measurements are confusing.
Besides, the shape for the parameters is set in the script, not taken from the model properties. Is this a bug or a feature?
Negative value of dimension means that this dimension is not fixed and is set through an external parameter. Therefore, the script should explicitly specify the dimensionality
It is clear that the example of using the ONNX model in MQL5 is only an illustration of this and nothing more. But still, I would like to draw attention to a very important mistake. In machine learning, the first stage is preprocessing. This includes a lot of things from trivial normalisation to dimensionality reduction and other engineering tricks. The main rule of any predictor and target transformation at this stage is that all transformation parameters (such as mean, median, sd, mad, etc.) are calculated on the training set. The test set and new data are processed using the parameters obtained on the train set.
So in the example it was necessary to calculate mean/sd on the train, pass this data to the part where the predicate is made, process the new data with these parameters. After that, denormalise and get the real values of the predicted price. This sequence is important.
It is clear that nobody feeds real prices to the input of the model, but this is already specific.
Good luck
A negative dimension value means that this dimension is not fixed and is set via an external parameter. Therefore, the script must explicitly specify the dimensionality
Thanks, it's clearer now.
As I understand it, in machine learning there are classification tasks, for example, whether the trend will be up or down, or predicting a specific value like the price will be here with such and such error. But in financial markets the task is a bit different - maximising profits while minimising drawdowns. And I haven't seen this kind of Raspberry learning models.
This problem is solved by using an appropriate loss function when training MO models. There are two problems associated with this. First, technical - standard loss functions in MO packages are related to profit maximisation only indirectly, which leads to the need to create custom ones. This is quite difficult to do - you need to have a good understanding of MO packages at the code level. If this problem is solved, there may be a second, mathematical problem where the custom loss function is bad for model training.
If someone solves such a difficult problem, they are unlikely to share the solution.