Searching for an arbitrary pattern using a neural network

 

Suggest any ideas for finding a pattern on a chart. For example "head and shoulders".

I can't understand what kind of data to input and how to teach it, because the pattern may occupy different number of bars and have different shapes.

The only thing that comes to mind is a convolutional net. But what to fold and how to fold it is not clear yet.

 
Anton_M:

Suggest any ideas for finding a pattern on a chart. For example "head and shoulders".

I do not know what data should be input and how to teach it, because the pattern may occupy different number of bars and have different forms.

The only thing that comes to mind is a convolutional net. But exactly what to convolve and how, is not yet clear.

As an alternative, I can suggest the following.

At first, we try to determine this pattern on the chart as clearly as possible using mathematics and conditions. It is natural that even at the maximum we will have a sample where there are true patterns and also false ones that ordinary mathematics and logic could not cut out. Thus we obtained a so called "dirty sample" and here we must use the classification nets to completely cleanse this sample. Or rather to teach the network so that it could make a clean sample from a dirty one, leaving only true head and shoulders to work and rubbish to the trash bin. Alternatively...

 
Anton_M:

Suggest any ideas for finding a pattern on a chart. For example "head and shoulders".

I can't understand what kind of data to input and how to teach it, because the pattern may occupy different number of bars and have different shapes.

The only thing that comes to mind is a convolutional net. But what to fold and how to fold it is not clear yet.

It is possible to make a pattern model and check it with the usual correlation. But for a head and shoulders pattern the model is complicated, it consists of 6 segments, and each segment can be of different length(number of bars).But it is possible to do it automatically. Of course it is much more convenient to gather such a pattern from the portfolio using regression, but this is another issue. Everything depends on the number of patterns we are searching for. And as the saying goes, it is not certain that the ogi will give an advantage in working out.
 
Mihail Marchukajtes:

As an alternative I can suggest the following.

At first, using ordinary mathematics and conditions we try to determine this pattern on the chart as purely as possible. It is natural that even at the maximum we will get a sample containing true patterns as well as false ones that standard mathematics and logic could not cut out. Thus we obtained a so called "dirty sample" and here we must use the classification nets to completely cleanse this sample. Or rather to teach the network so that it could make a clean sample from a dirty one, leaving only true head and shoulders to work and rubbish to the trash bin. Alternatively...

That was the idea. But there's a nuance here, as I understand it, you need to feed some data window to the input (say 200 bars, to make sure the whole pattern fits into it), then:

1) the pattern may be in different parts of the window, and the classifier cannot understand it, because of that the window with the pattern in the left part will be different from the window with the pattern in the right part;

2) the classifier must be self-organizing, because a strict mathematical model, besides false patterns, will also cut off a part of true patterns;

3) self-organisation does not guarantee that any particular pattern will be classified.

 
Anatolii Zainchkovskii:
It is true that for a head and shoulders pattern the model is complicated, it consists of 6 segments, and each segment can be different in length(number of bars).But it is possible to do it automatically. Of course it is much more convenient to gather such a pattern from the portfolio using regression, but this is another issue. Everything depends on the number of patterns we are searching for. And it is not certain that the ogi will give advantages in working out.

The market is fractal and segments of higher levels consist of segments of lower levels, and we can see it as a broken line.

 
Anton_M:

may consist of more segments (we have to define what a segment is), because the market is fractal and the segments of higher levels consist of segments of lower levels, which we can see as a broken line.

That's great. Examples of such broken lines (patterns) can be seen in my account, I've published screenshots. Just to see how much the found market chart differs from the model.
 
Anton_M:

Suggest any ideas for finding a pattern on a chart. For example "head and shoulders".

I can't understand what kind of data it is better to input and how to teach it, because a pattern may occupy different number of bars and have different shapes.

The only thing that comes to mind is the convolution net. But what exactly to convolution and how to do it is not clear yet.

I have a complete system for classifying (recognizing) patterns. It is written completely in MQL5.

If interested, I can post it on the market. Otherwise, too lazy to bother.

 
Dmitriy Skub:

There is a complete system for classifying (recognising) patterns. Written entirely in MQL5.

If interested, I can put it in the market. Otherwise, too lazy to bother.

Put it on the market.

But I personally will not buy it. I am interested in the principle. The topicstarter asked a right question and I am interested.

Are you sure that your classifier meets the needs of the topicstarter and my interests?

 
Sergey Chalyshev:

Put it on the market.

But personally, I won't be buying. I am interested in the principle itself. The topicstarter asked the right question, and I am interested.

Are you sure that your classifier meets the needs of the topicstarter and my interests?

Actually, I have no task to satisfy your needs) DTW method is used for comparison. This method is invariant to "distortions" of patterns vertically/horizontally compared to the original.

It also includes a system for storing and accounting for specified patterns and a system for preliminary checking the trading characteristics of a pattern.

I don't remember anything else - it's been a long time)

 
Dmitriy Skub:

Generally, I have no task to satisfy your requests) The DTW method is used for comparison. This method is invariant to "distortions" of patterns vertically/horizontally compared to the original.

It also includes a system for storing and accounting for specified patterns and a system for preliminary verification of pattern trade-offs.

I don't remember anything else - it's been a long time)

Didn't know about DTW method, thanks!

I haven't understood yet how to apply it better with neural networks. The pattern can not only distort along the axes, but also change its own form (have nesting, variants of development).

 
Anton_M:

Suggest any ideas for finding a pattern on a chart. For example "head and shoulders".

I can't understand what kind of data to input and how to teach it, because the pattern may occupy different number of bars and have different shapes.

The only thing that comes to mind is a convolutional net. But what exactly to wrap and how to wrap it is not clear yet.

A neural network is not necessary for searching for a pattern. It can be searched in an ordinary Expert Advisor. Put a zigzag on it. To detect the presence of a Head-Shoulder pattern, we need to control 1) the position of extrema relative to each other (higher-lower) and 2) (farther away relative to the zero bar) in the condition.

It does not matter how many bars the pattern lasts, it is sufficient to control the position of extrema relative to each other vertically and horizontally.

Reason: