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

 
Arty G #:

So we define a set of predictors, cluster them all together into different clusters, then build a model that tells us which settings for which cluster will give the highest probability of profitable trading. This is where the clustering layer comes in from my original idea - we hope that by clustering the mode-determining features into clusters, it will be easier for the model to train itself to identify profitable combinations of parameters?

After clustering, you simply calculate the probability of a favourable outcome in each cluster for each combination of settings. Either save the settings by the number of clusters and calm down, or save the metrics for the best N variants and, let's say, randomly take them then for application within a minute.

You should experiment with the number of clusters.

You can build a cluster model several times (on the same data or not - with excluding predictors or strings) - also calculate statistics, but apply the settings only if two clusters have a combination of settings that exceeds a given threshold of a favourable outcome.

Arty G #:

Meaning regression of parameters for profitable trading, roughly as discussed a couple of posts above? I tried to train RandomForestRegressor, to which I feed minute predictors as features, as well as the profit received for a minute in the form of just a sign for now, and as dependent value two parameters for the TS, strongly influencing the behaviour of the TS. I haven't run it in the backtester yet, but I can't see yet, the distributions of predictions for positive and negative trading are very different.

Regression can work if there is a functional dependence of settings on predictors, if there is not, it is better to try multiclassification. And I don't understand how you can feed the financial result as a predictor - it won't be known to the model....

Arty G #:

Yes, it is - I'm talking about the data for the backtester. The data is initially downloaded in CSV format from the data vendor and then converted to the Numpy library data format - npz, and stored there. It is a ZIP archive, but the data is not compressed.

Try feather - it loads fast and the data is somewhat compressed relative to csv, you can change the data type before saving to reduce the size.

 
Arty G #:

Have you come across any useful articles on this topic that you could point to for enlightenment? I would be grateful.

There were - my browser glitched and everything was lost, unfortunately. But you can find it if you want.

 
Arty G #:

Got it, thanks. Basically, it's labelling by modes where we either trade or don't trade at all. I want to go a bit further and somehow select more optimal (from the ML model's point of view) parameters for the next minute of trading.

Yes,

There is such an implementation, not in public yet. It uses 2 (one trade/don't trade, the other buy/sell) models and a sort of correspondence matrix between them. They are trained in turn and as if exchange errors, each trying to minimise its own, throwing out part of bad examples into the training dataset of the other model. And so on for n iterations. Ideally there should be good accuracy in each of them after several re-training. It's pretty crude so far, haven't finalised it yet.

Plus in the last article the dataset for the main model is also cleaned through bad samples book, i.e. the final model is trained only on those examples that it classifies well. As a result, you can achieve 0.99 accuracy when training it. And the second model defines the current cluster, so its accuracy or F1 (F1 is better for unbalanced classes) is also 0.99.

It turns out that both models with 0.99. This is an interesting effect. Now it remains to choose the cluster that provides good "support" for the first model. That is, on which it earns better.

And the results are sometimes interesting too. To the right of the vertical OOS line (just an example. There are better/worse pictures):


 
Aleksey Vyazmikin #:

Transferred the ZZ code to MQL5.

In general, the trick of this ZZ is to ignore outliers.

Exactly - the algorithm should be reproduced from different places!

cool!

The last extremum is redrawn, formed when?

 
mytarmailS #:

Made for shopping.

Well, it's a buy, but for a good reason, volatility.

If the candle on which the signal was triggered was abnormally volatile, the entry on the opening gets the hell out of there.


But if the volatility is normal and the market is calm, the entry is normal.


It so happened that 4 out of 5 triggers were on extreme volatility....

So for now... we have to normalise the signal strength to volatility...


Also an interesting picture if we switch from m1 to m15 and increase the entry threshold.


More than a year ago I made a TS, which had exactly the same defect: opened a deal to the wrong side before a big movement. And in the run for a year (several hundred trades) the TS collected almost all such cases: as a movement of more than 100 pips in one H1 candlestick, it necessarily opens in the opposite direction! During the year it was not possible to overcome this defect. With such a defect, even with a classification error of about 10%, it is impossible to build a profitable TS.

 
Renat Akhtyamov #:

cool!

The last extremum is redrawn, formed when?

It is redrawn when a new extremum appears, it does not change the vector.

This ZZ works with the generated data as a linear approximator.

The formation conditions are the algorithm on which the ZZ construction works - I'll tell you about it when I play with it :). Nothing complicated there.

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

More than a year ago I made a TS, which had exactly the same defect: it opened a deal to the wrong side before a big movement. Moreover, in the run for a year (several hundred trades) the TS collected almost all such cases: as a movement of more than 100 pips in one H1 candlestick, it necessarily opens in the opposite direction! During the year it was not possible to overcome this defect. With such a defect, even with a classification error of about 10%, it is impossible to build a profitable TS.

What if we reverse the trade?
 
mytarmailS #:
What if you reverse the trade?
Then the forex will be broken.
 
Ivan Butko #:
Then the forex will break
That's how it works.
 
Aleksey Vyazmikin #:

It is redrawn when a new extremum appears, the vector does not change.

This ZZ works with generated data as a linear approximator.

The formation conditions are the algorithm on which the ZZ construction works - I'll tell you about it when I play with it :). Nothing complicated there.

ok, don't forget to tell ;)

I am of the same opinion, that it is very useful to know the background of maths and not to use ready-made bits

I've been following the attacks on you for a long time, but I'm on your side.

bravo!

Reason: