Machine learning in trading: theory, models, practice and algo-trading - page 1550

 
forexman77:

Served just prices to learn random forest. Got the forecast red line. I noticed that when the trend sections, the forecast line does not hit at all.


All right, think about why

 
Maxim Dmitrievsky:

That's right, think why

Why, as I understand and so know. I would like to hear what others think about it?

 
forexman77:

Why, as I understand it, I already know. I would like to hear what others think about it?

because the forest does not know how to extrapolate

You have to scale the data, e.g. the increments.

Or take some flat markets, if just the price will be like a chip
 
Maxim Dmitrievsky:

because the old forest does not know how to extrapolate

Do you mean like ARIMA when several values are predicted ahead?

I have each prediction, only one bar forward (aware that the forest doesn't work with time series). I tried to do the following way: the predicted bar was added and one bar from the old ones was subtracted from the back and I looped it in such a way to

predict a few bars ahead by a sliding window with a period, replacing the bar dropped out by the predicted one.

In this way the first and second predicted bars are repeated.

That's how it's trained, what's on the picture:

    def on_press(self, event):
        if event.xdata!=None and event.xdata>=1:
           index = int(event.xdata)
           index_ = ind[index:index + 30]
           if self.ln != 0:
               self.ln.remove()
           X = z[index - 31:index]
           X1 = z[index-1:index + 29]
           X=X.reshape(-1, 1)
           X1 = X1.reshape(-1, 1)
           y = z[index - 30:index + 1]
           regr = RandomForestRegressor(max_depth=5, random_state=0, n_estimators=10)
           regr.fit(X, y)
           y_1 = regr.predict(X1)

           self.ln, = self.ax.plot(index_, y_1, color='red')
 
forexman77:

Do you mean like ARIMA, where multiple values are predicted ahead?

In regression models, the signs are simply dominated by the coefficients, so everything works when the training data is out of bounds

The forest splits leaves that have marginal values both above and below, over the range of the training data. If the new data goes out of that range, the forest shows the values of the extreme leaves it knows.

so you have a straight line, because the forest shows the extreme values it knows
 
Maxim Dmitrievsky:

Why not just get a tester of some kind, like a zipline? What's the advantage?

You don't need to run anything in MT5, and you don't need a dll

MLflow is already in Python. You can store the result of thezipline in it.

You will check the trading strategy in the MT5 tester anyway, because it has more possibilities.

 
Maxim Dmitrievsky:

in regression models, the attributes are simply multiplied by the coefficients, so everything works when the training data is out of bounds

The forest splits leaves that have marginal values, both above and below, over the range of the training data. If the new data goes out of that range, the forest shows the values of the extreme leaves it knows.

That's why you have a straight line, because the forest shows the extreme values it knows

Well, yes in principle, as an option to predict increments and add them to the initial bar and so go to the desired depth.

Why did I ask, because the forest does not need to normalize the data, but that's how it turns out.

 
forexman77:

Well, yes, in principle, as an option to predict the increments and add them to the initial bar and so go to the desired depth.

Why I asked, because the forest does not need to normalize the data, but it's how it turns out.

Well in case of non-stationary time series it is necessary, at least to lead them to some reasonable range, which they will not go out of for some time

but you need to take into account that the stronger the differentiation, the greater the loss of information

so this is a double-edged sword - both the initial series are not very suitable and the increments with a single lag are not very good, because a lot of information is lost

information is lost precisely about the shift in the average in time, and nothing else. In my super maternity posts I try to explain it in understandable language

 
Roffild:

MLflow is already in Python. You can store the result of thezipline in it.

The trading strategy will still be checked in the MT5 tester, because it has more features.

I may need it later, thank you.

 
1