When I need to fill a part of a large array with a single Z-value, I use the construct:
ArrayInitialize(ar,Z); // промежуточный массив размер массива ar = 1000 ArrayCopy(arr,ar,5000); // основной массив заполняется значением Z c 5000 по 5999 элемент
Many traders will say why it is so complicated, it can be simpler:
ArrayFill(arr,5000,1000,Z);
But for some unknown reason, the first variant using an intermediate array runs noticeably faster than the second
2018.09.0411:01:17.222 TestArrayFill (EURUSD,M4) Время заполнения через ArrayFill = 3382018.09.0411:01:17.222 TestArrayFill (EURUSD,M4) Время заполнения через ArrayInitialize + ArrayCopy = 1112018.09.0411:01:18.563 TestArrayFill (EURUSD,M4) Время заполнения через ArrayFill = 3012018.09.0411:01:18.563 TestArrayFill (EURUSD,M4) Время заполнения через ArrayInitialize + ArrayCopy = 1222018.09.0411:01:19.717 TestArrayFill (EURUSD,M4) Время заполнения через ArrayFill = 3342018.09.0411:01:19.717 TestArrayFill (EURUSD,M4) Время заполнения через ArrayInitialize + ArrayCopy = 1422018.09.0411:01:21.095 TestArrayFill (EURUSD,M4) Время заполнения через ArrayFill = 3642018.09.0411:01:21.095 TestArrayFill (EURUSD,M4) Время заполнения через ArrayInitialize + ArrayCopy = 156
I already wrote on this issue to CA a couple of years ago. I got a reply saying that I had found and fixed the problem and it would be ok in the next build.
But the problem persists.
I've got the same test in MT4:
2018.09.0411:08:21.258 TestArrayFill EURUSD,H1: Время заполнения через ArrayInitialize + ArrayCopy = 1132018.09.0411:08:21.258 TestArrayFill EURUSD,H1: Время заполнения через ArrayFill = 78
When I need to fill a part of a large array with a single Z-value, I use the construct:
Many traders will say why it is so complicated, it can be simpler:
But for some unknown reason, the first variant using an intermediate array runs noticeably faster than the second
I already wrote on this issue to CA a couple of years ago. I got a reply saying that I had found and fixed the problem and it would be ok in the next build.
What a peculiarity and subtlety! The important standard function of working with arrays in the world's fastest algorithmic trading language is 4 times slower than in the obsolete MQL4 language. Only here.
It's a clear bogey. Can you imagine how many programs are going to fail when it is fixed?
What a peculiarity and subtlety! The important standard function of working with arrays in the world's fastest algorithmic trading language is 4 times slower than in the outdated MQL4 language. Only here.
It's a clear bogey. Can you imagine how many programs will be affected when it is fixed?
Good.
But as a feature at the moment - is that a bad thing?
But as a feature at the moment - is that a bad thing?
Yes, I probably stated the problem incorrectly. It appeared as if I was talking about its solution.
Of course not. I was trying to formulate the problem. The intermediate array option is not a solution to the problem at all, because it takes longer to execute than it should based on memory logic, and also leads to additional memory consumption.
When I need to fill a part of a large array with a single Z-value, I use the construct:
Many people will say why it's so complicated - it can be simpler:
But for some unknown reason, the first variant using an intermediate array works much faster than the second one
I don't understand! Why did you need to fill part of a large array with a single Z value? Or, what data do you assign to the array, for what purpose? Close, AVG, RSI values? But aren't they present in MetaTrader's memory after the indicator is loaded? I was playing with the array 0 and 1 and finally got the word SOS, i.e. I assigned 0 value to S and 1 to O. Of course, I could enter Help for a better result in the second array size. Then check the filling time for each array's size. Then add everything up and divide by 4.
Bob1Thec: I can't understand! Why did you need to fill part of a large array with a single Z-value? Or, what data do you assign to the array, for what purpose?
The monochrome background (including transparency) of a picture is done this way.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
When I need to fill a part of a large array with a single Z-value, I use the construct:
Many traders will say why it is so complicated, it can be simpler:
ArrayFill(arr,5000,1000,Z);But for some unknown reason, the first variant using an intermediate array runs noticeably faster than the second
I already wrote on this issue to CA a couple of years ago. I got a reply saying that I had found and fixed the problem and it would be ok in the next build.
But the problem persists.
I've got the same test in MT4:
When I need to fill a part of a large array with a single Z-value, I use the construct:
Many traders will say why it is so complicated, it can be simpler:
But for some unknown reason, the first variant using an intermediate array runs noticeably faster than the second
I already wrote on this issue to CA a couple of years ago. I got a reply saying that I had found and fixed the problem and it would be ok in the next build.
But the problem persists.
I've got the same test in MT4:
Maybe this is a good place to check in.
Maybe this is a good place to check in.
What a peculiarity and subtlety!
It's a clear bogey.The important standard function of working with arrays in the world's fastest algorithmic trading language is 4 times slower than in the obsolete MQL4 language.
Only here.
Can you imagine how many programs are going to fail when it is fixed?
What a peculiarity and subtlety!
It's a clear bogey.The important standard function of working with arrays in the world's fastest algorithmic trading language is 4 times slower than in the outdated MQL4 language.
Only here.
Can you imagine how many programs will be affected when it is fixed?
Good.
But as a feature at the moment - is that a bad thing?Good.
But as a feature at the moment - is that a bad thing?Good.
But as a feature at the moment - is that a bad thing?Anecdote.
An old man goes to the doctor. He says:
- Doctor, my back hurts.
- Bend over. Does it hurt?
- It hurts.
- Bend down more!
- There, that feels better...
- There! That's how you walk!
)))))
When I need to fill a part of a large array with a single Z-value, I use the construct:
Many people will say why it's so complicated - it can be simpler:
But for some unknown reason, the first variant using an intermediate array works much faster than the second one
I can't understand! Why did you need to fill part of a large array with a single Z-value? Or, what data do you assign to the array, for what purpose?
The monochrome background (including transparency) of a picture is done this way.
more precisely a gradient background
more precisely a gradient background
I have no idea what filling an array with a single value plays here.