Dividing open positions into groups

 
Good afternoon, if you can't help, please suggest a script, an advisor, an article, a forum thread. I can't figure it out on my own.
There is a need to divide (on a hedge account) the active (open) positions into groups, depending on certain conditions (lifetime, signals that have been opened, signals on changing market conditions, etc.). We see the use of two-dimensional arrays (ticket, group number). The division of positions into groups is needed to apply different strategies / tactics to different groups.
I would be grateful for any answer, thank you.
 
Sergey Voytsekhovsky:
Good afternoon, if you can't help, please suggest a script, an advisor, an article, a forum thread. I can't figure it out on my own.
Is the comment field not suitable for this?
 
Igor Yeremenko:
Isn't the comment field suitable for that?

I don't understand your question.

Are you against creating a new thread and think it is worth throwing the question into other threads in the form of new comments?

Perhaps you are right, but on the other hand, I have not found any threads with such a focus.

By orientation, I meanthe need to divide (in the hedge account) active (open) positions into groups, depending on certain conditions (life time, signals on which the positions were opened, signals of changes in market conditions, etc.). We see the use of two-dimensional arrays (ticket, group number). Division of positions into groups is needed to apply different strategies/tactics to different groups.

 
I would create an array of structures. The number of elements in the array is equal to the number of open positions. One of the fields of the structure will characterize the structure member's membership in a particular group. In general, this is more flexible compared to a two-dimensional array, because there can be several fields for each element and they can have different data types.
Документация по MQL5: Основы языка / Переменные
Документация по MQL5: Основы языка / Переменные
  • www.mql5.com
Переменные должны быть объявлены перед их использованием. Для идентификации переменных используются уникальные имена. Описания переменных используются для их определения и объявления типов. Описание не является оператором. Индексом массива может быть только целое число. Допускаются не более чем четырехмерные массивы. Нумерация элементов...
 
Grigori.S.B:
I would create an array of structures. The number of elements in the array is equal to the number of open positions. One of the fields of the structure will characterize membership of a structure member in a particular group. In general, this is more flexible compared to a two-dimensional array.

Good afternoon, well that makes two of us who are interested, thanks for your interest.

My coding knowledge is still quite modest, but I'm trying to grow.

Attached a file, it's a template EA that I want to gradually grow to an acceptable level.

Now it is able to open two opposite positions with minimal lot every candle.

I have called it a Sower. That is, it scatters stones, and then we will collect them. There are several strategies.

The first simplest one (nursery) - TakeProfit is set for all junior positions, somewhere near average volatility. A part of positions will be closed on profit, the survived ones should be moved to another group (caste, rank, ....), older, that will be served with more complex and prolonged algorithms.

I believe that this process - the creation of such groups and the allocation of positions to these groups - is the place to start.

Of course fish (billet) will also cause a lot of criticism and will require improvement, so any suggestions are welcome.

Thank you.

Files:
Sower_1_3.mq5  15 kb
 
Sergey Voytsekhovsky:

I don't understand your question.

Are you against creating a new thread and think it is worth throwing the question into other threads in the form of new comments?

Perhaps you are right, but on the other hand, I have not found any threads with such a focus.

By orientation, I meanthe need to divide (in the hedge account) active (open) positions into groups, depending on certain conditions (life time, signals on which the positions were opened, signals of changes in market conditions, etc.). We see the use of two-dimensional arrays (ticket, group number). Division of positions into groups is needed to apply different strategies/tactics to different groups.

Somehow!

 
Nikolay Kositsin:

Something like this!

Good afternoon.

Do I understand correctly? Are you suggesting to use COMMENTARY as an attribute, which will be used in the future to determine whether the position belongs to a group or several groups ???

Do you have any variants of code which would perform this or similar work? If yes, toss up please, in any form convenient for you.

Thanks in advance.

 
<br / translate="no">

Do you have any code that does this or similar work? If so, please give me some, in any form you like.

Just a link to Expert Advisor or script with similar solution.

 
Sergey Voytsekhovsky:

Good afternoon, that makes two of us, who are interested,

Wrong, I'm not interested, just trying to help.

And I wouldn't advise using the comment box. This is of course the easiest way, but at the same time the most unreliable, because this field can be changed by the DC at any time.

 
Sergey Voytsekhovsky:

Good afternoon.

Do I understand this correctly? You propose as an attribute that will be used in the future to determine whether an item belongs to a group or several groups. ???

Do you have variants of the code which is carrying out such or similar work? If yes, toss up please, in any suitable for you form.

In advance I am grateful.

This kind of code is too individual to exist in a ready-made form. The structure is written with ready-made comments for all variants of necessary attributes for positions and orders and the Expert Advisor, which analyses positions and orders and changes these comments. Such things are either written by yourself or commissioned from freelancers.

 
Grigori.S.B:

Wrong, I have no interest here, just trying to help.

I wouldn't advise using the comment field. It is of course the easiest way, but at the same time the most unreliable, because this field can be changed by DC at any time.

Thank you. The desire to help is worth a lot. I've heard about using comments, though they are appealing due to their simplicity, illustrativeness and it's the only thing I possess enough skills for now, maybe that's the reason for not doing it.

You wrote above:"I would create an array of structures..." and "as there may be several fields for each element and they may have different data types...". This is something I've already come across. Is there a chunk, a fragment, a prier, a reference ? Something not very complicated to figure out by example and try to bolt into Sower ,,,???

Reason: