Bayesian regression - Has anyone made an EA using this algorithm? - page 50

 
Dr.Trader:

The patterns are time dependent. Train on a separate classifier for each day of the week, or try adding the phase of the moon (I'm serious), or time of day to the raw data, I don't know what to do exactly, but it's very important.

Alexey Burnakov:

2) Yes, I've already done that. I have a big dataset - I can share it right here - where I added to the price data:

- hour

- minute

- day of the week

- month

- day of the month.

Of course this is important. But we should determine not the day or time of day when the TS is successful, but the nature of the market when the TS is successful - trend, flat, seasonal patterns. The nature of the market determines the nature of data, and not the day of the week or the broker's tricks. The nature of the market can be determined on history, but to determine it on real account, as Dmitry Fedoseyev wrote: "The main problem of the analysis and trading is the identification of the trend.

For example, TS is considered to be successful in flat. Are there any indicators that predict a flat?

 
Yuri Evseenkov:

Of course this is important. Only it is necessary to identify not the day or time of day when the TS is successful, but the nature of the market when the TS is successful - trend, flat, seasonal patterns. The nature of the market determines the nature of data, and not the day of the week or the broker's tricks. The nature of the market can be determined on history, but to determine it on real account, as Dmitry Fedoseyev wrote: "The main problem of the analysis and trading is the identification of the trend.

For example, TS is considered to be successful in flat. Are there any indicators that predict the flat?

The point is that you can determine the day and time of day in advance, but trend and flat cannot.

If you know how to identify the trend and flat in advance, then you do not need anything else - the grail is in your face.

 
Yuri Evseenkov:

Are there any indicators that predict a flat?

You can also make a classifier for that, through trees and R, like in Alexey's blog. We need to collect several years of bar history, then manually or using some indicator to specify which time intervals were flat and which were not, and teach the model. To teach the model, do not use the price increase of the next period as in the example, but specify the flat/trend values (e.g. 0 and 1 correspondingly). And we will obtain the indicator.

But in general if one makes a classifier from zero which predicts future price increase - the classifier itself should learn to distinguish a flat from a trend. Its logic will not contain such clear notions, but conceptually it must learn to distinguish different market characters and change the forecast depending on them. An adequate classifier must not work only in some certain periods of time, its task is to work always in profit.

 
Dr.Trader:

We can also make a classifier for that, through trees and R, as in Alexey's blog. We need to collect several years of bar history, then manually or using some indicator specify which time intervals were flat and which were not, and teach the model. To teach the model, do not use the price increase of the next period as in the example, but specify the flat/trend values (e.g. 0 and 1 correspondingly). And we will obtain the indicator.

It's not an indicator but a classifier - it doesn't predict but classifies. Roughly speaking, having studied a part of history, it can tell if this part is a trend or a flat.

But the problem is that I can do it by eye as well - I don't need an indicator.

 
Дмитрий:

Not an indicator, but a classifier - it does not predict, it classifies. So, roughly speaking, having studied a part of the history, it can say whether this part is a trend or a flat.

But the problem is that I can do it by eye - I don't need the indicator.

The practice tells us about something else. It depends on what you teach.

If you simply classify the past, yes.

But if you shift the teacher, i.e. the past values of the predictors correspond to the current value of the teacher, then you predict the future. For example, you shift by 1 bar. So when a new bar arrives, you calculate all your predictors and then use the PAST-trained model to predict your flip-trends. You can teach it with a shift of more than 1. The great thing about prediction models that extrapolate past bars is that the error adds up (at best) as the prediction horizon increases, this is not the case with classification. So when forecasting on H1: error on +1 = 30% (the real figure), on +2 slightly more, and on +4 almost 30%.

Not only that, if you start making friends with Burnakov houses, you can find shifts into the future that have about the same prediction error as the +1 bar.

 
Dr.Trader:

We can also make a classifier for that, through trees and R, as in Alexey's blog. We need to collect several years of bar history, then manually or using some indicator specify which time intervals were flat and which were not, and teach the model. To teach the model, do not use the price increase of the next period as in the example, but specify the flat/trend values (e.g. 0 and 1 correspondingly). And we will obtain the indicator.

But in general if one makes a classifier from zero which predicts future price increase - the classifier itself should learn to distinguish a flat from a trend. Its logic will not contain such clear notions, but conceptually it must learn to distinguish different market characters and change the forecast depending on them. An adequate classifier shouldn't work only in some certain periods of time, its task is to work in profit every time.

Alexey's blog, model training, classification is too complicated for my task and myself. I want something simpler for predicting the flat with a certain probability.

Something like ADX. And in MQL4 that would be understandable for traders, economists and philosophers, and not only for experts in mathematical packages and programming languages R, Python, etc.

 
Dr.Trader:

We can also make a classifier for that, through trees and R, as in Alexey's blog. We need to collect several years of bar history, then manually or using some indicator specify which time intervals were flat and which were not, and teach the model. To teach the model, do not use the price increase of the next period as in the example, but specify the flat/trend values (e.g. 0 and 1 correspondingly). And we will obtain the indicator.

But in general if one makes a classifier from zero which predicts future price increase - the classifier itself should learn to distinguish a flat from a trend. Its logic will not contain such clear notions, but conceptually it must learn to distinguish different market characters and change the forecast depending on them. An adequate classifier must not work only in some certain time intervals, its task is to work in profit every time.

I seem to have a classifier that learns it.

Look, this is the input data schema.

I'm giving the machine

the difference with the moving average

the difference with the moving high

also with a minimum

spread of the data

standard deviation

and simply the difference between the prices taken with a lag.

Now imagine that this window still varies from 2 to 724 minutes - there are 18 sets of such predictors.

That should be enough to distinguish a trend movement from a flat. At the very least, the difference between prices with a lag and the spread of the data (and the standard deviation) tells it.

I also wanted to take the slope of the linear regression for the price window. Also with a variable window. But it's the same eggs. One can try it though.

So, the classifier steadily highlights the difference with the moving average as the most important predictor, as well as the differences between prices and including spreads and standard deviations. Everything is used by it.

 
СанСаныч Фоменко:

Practice tells a different story. It depends on what you teach.

If you simply classify the past, then yes.

But if you are shifting teachers, i.e. past predictor values correspond to the current teacher value, then you are predicting the future. For example, you shift by 1 bar. So when a new bar arrives, you calculate all your predictors and then use the PAST-trained model to predict your flip-trends. You can teach it with a shift of more than 1. The great thing about prediction models that extrapolate past bars is that the error adds up (at best) as the prediction horizon increases, this is not the case with classification. So when forecasting on H1: error on +1 = 30% (the real figure), on +2 slightly more, and on +4 almost 30%.

Not only that, if you start making friends with Burnakov houses, you can find shifts in the future that have about the same prediction error as the +1 bar.

Yeah. It's not like I'm predicting one step ahead, like ARIMA, for example. With Arima the error grows exponentially because what is predicted one step forward starts to be used as a predictor and this is repeated as many times as forward is to be predicted.

I initially had 18 target variables, for which I train the models one by one (going through the training parameters and stopping at the best combination). And this way I can see for which horizon everything is better predicted.

My training for all targets lasts about a day. But this is not the limit either. A multilayer neural network on GPU can train for a week for one target.

 
Alexey Burnakov:

I initially had 18 target variables, for which I train the models one by one (going through the training parameters and stopping at the best combination).

How do you determine the "best" combination?
 
Alexey Burnakov:

Yes. It's not like I'm predicting one step ahead, like ARIMA. With Arima, the error grows exponentially, because what is predicted one step ahead starts to be used as a predictor and this is repeated as many times as it needs to be predicted ahead.

I initially had 18 target variables, for which I train the models one by one (going through the training parameters and stopping at the best combination). And this way I can see for which horizon everything is better predicted.

My training for all targets lasts about a day. But this is not the limit either. A multilayer neural network on GPU can train for a week for one target.

That was my understanding of your activity
Reason: