[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 353

 
Zhunko:

Optimisation has to be done first. MQL4 speed is suitable for most tasks.

There is an example for DLL in the MT4 folder.


I mean individual tasks, where one run of the script takes several hours. What do you mean by optimization?
 
Well a few hours is a lot, usually there are options to make the calculations work faster by redesigning the calculation algorithm, taking repetitive actions out of the loop, avoiding slow constructions, multidimensional arrays, etc.
 
splxgf:
Well, a few hours is a lot. Usually, there are variants to make calculations faster by modifying the algorithm of calculations, moving repetitive actions out of the loop, avoiding slow constructions, multidimensional arrays, etc.

Do you have an answer to the question: is it better to store characteristics of open orders in a multidimensional array or in several one-dimensional arrays, one per characteristic? I tried it both ways. I did not notice any difference in the speed. Which is the optimum way (different orders, both market and pending, and maybe even differently directed losing orders)?

Probably, "according to the problem's requirements"?

 
splxgf:
Well a few hours is a lot, usually there are options to make calculations work faster by redesigning the calculation algorithm, taking repetitive actions out of the loop, avoiding slow constructions, multidimensional arrays, etc.

If it is not difficult, can you show an example of such optimisation. For example, consider all periods of Alligator indicator iAlligator from 1-100 (7 periods), the mathematical operations themselves are simple (addition, subtraction).

 
snail09:

Do you have an answer to the question: is it better to store characteristics of open orders in a multidimensional array or in several one-dimensional arrays, one per characteristic? I tried it both ways. I did not notice any difference in the speed. Which is the optimum way (different orders, both market and pending, and maybe even differently directed losing orders)?

Probably, it would be "according to the problem statement", wouldn't it?


I haven't encountered it yet, I don't know. But if your code is correct and does the task, then in my opinion, what difference does it make in which array.
 
khorosh:
Is there an equity indicator that would allow setting a date in its external variable, so that all orders opened before that date would not be taken into account when calculating the equity?


Look at these ones... Begin_Monitoring and Draw_Begin...

Files:
 
FelixFX:

I'm referring to individual tasks, where one script execution takes several hours. What do you mean by optimisation?
I mean to modify the code so that it would work faster. There are some special features of MQL4, knowing them, you can accelerate calculations by several times. Without your code, you can't say what can be optimized.
 
Zhunko:
This means modifying the code to make it work faster. There are peculiarities of MQL4, knowing them, you can speed up calculations by several times. Without your code, it's impossible to say what can be optimized.

For example, consider all the periods of the Alligator iAlligator indicator from 1-100 (7 variable parameters), the mathematical operations are simple (addition, subtraction - for example, you can take the sum of differences of maximum and minimum prices of each bar, the closing price of which is higher than all lines of the indicator).
 
FelixFX:

I haven't come across it yet, I don't know. But if your code is correct and does what it is supposed to do, I think it makes no difference in which array.
Both options are correct. That's why I asked. And how do you track "your" orders? Please share.
 
FelixFX:

If it's not difficult, can you show an example of such optimisation. For example, consider all periods of alligator indicator iAlligator from 1-100 (7 periods), the mathematical operations themselves are simple (addition, subtraction).

For example the problem is how many times has the price crossed a given level in the last two years.

1. You can take each level and look through the data for two years. Costs: number of bars multiplied by the number of levels.

2. You can create a separate array of levels. It is enough to review all the bars by checking and incrementing the required elements of the array. In this case the calculations will be faster.

Reason: