Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1427

 
Aleksei Stepanenko:

So I didn't write anything else, I just repeated your code.

Visually arranged the numbers incorrectly, and you thought that's what you needed.

Most likely, you need to assign 0.5555 to the loop instead of ArrayFill. Give it a try.

Thank you. I hope to learn new information quickly.

 
You're welcome, as long as it works :)
 
Aleksei Stepanenko:
You're welcome, as long as it works :)
I just wanted to clarify the moment.... Perhaps a loop instead of ArrayFill() will slow down the program, especially if there's a lot of data in the array, and if the enumeration range is large, and if the loop will not work with just one array. Some posts above in this threadMaxim Kuznetsov told me, that there is some optimal algorithm, that converts LoY[2][31] into LoY[31][2]. Maybe this algorithm won't slow down the program as a loop, or will slow but to a lesser extent. If you are acquainted with this algorithm, I'll be grateful if you tell me what you think about it and maybe even demonstrate it in my code.
Once again thank you very much for your informational support.
 
ANDREY:
maybe a loop instead of ArrayFill() will slow down the program

All code consumes resources. ArrayFill or loop-fill costs about the same.

But sorting, or completely rewriting the array costs time. Therefore, it is better to find other solutions, for example, to think about data storage and preparation, to do pre-calculations and other options.

 
Aleksei Stepanenko:

All code consumes resources. ArrayFill or loop-fill costs about the same.

But sorting, or completely rewriting the array costs time. That's why it's better to find other solutions, e.g. data preparation, preliminary calculations and other options.

Got it. Thank you.

 
In your case, it is interesting to answer the main question: Why is it necessary to do the sorting every minute? How can your idea be implemented in a more economical way?
 
ANDREY:

Got it. Thank you.

Sorry to interrupt, maybe sorting isn't necessary? Maybe only the maximum (minimum) value should be determined?

 

The documentation for one of the languages is very good and detailed, time-consuming of course, but it helps programmers

---

Less costly would be to fill in correctly at the beginning and if possible try not to dabble with an array in five knees: fill, sort, add, sort and add again.

Avoid unnecessary actions if possible.

---

In mql there is a function: StringConcatenate, it is super expensive, but it is used because of its presence in the language, although it can be easily avoided and write "light" codes.

 
Luchezar Shalomaev:

Sorry to interrupt, maybe sorting is not necessary? Maybe only determine the maximum (minimum) value?

Thanks for your input. It's sorting that's needed.... At least at this stage of my understanding of my design. Perhaps later I will have a rethink and look for some sorting alternatives. Regarding the minimum and maximum I already know that there are functions that determine them and that it's less expensive.

 
Vitaly Muzichenko:

The documentation for one of the languages is very good and detailed, time-consuming of course, but it helps programmers

---

Less costly would be to fill in correctly at the beginning and if possible try not to dabble with an array in five knees: fill, sort, add, sort and add again.

Avoid unnecessary actions if possible.

---

There is a function in mql: StringConcatenate, it is super expensive, but it is used because of its presence in the language, although it can be easily avoided and write "light" codes.

The general idea is understood... as it seems to me. Thanks for the tip. If you don't mind telling me what dollar sign means before array name $ array[] and before value $var It seems to me that it's not from mql at all.

Reason: