Vitaly Muzichenko fill an array up to 100 elements nicely?
Explicitly assign values to the array elements in a string. Then multiply in a loop if you need to change the lot. The cheapest, but longest. If you do it once, it probably makes no difference).
Valeriy Yastremskiy #: Explicitly assign values to array elements in a line. Then multiply in a loop if you need to change the lot. The cheapest, but longest. If you do it once, it makes no difference I guess :)
It is necessary to write each element?
Somehow, it's possible to do it in loops. Yes, it's a one-time thing in OnInit()
Vitaly Muzichenko fill an array up to 100 elements nicely?
Since the indices on which the value of an element changes do not have a simple dependency (like each next 7 more than the previous one), we need to have them in the code. The multiplier that R is multiplied by is an arithmetic progression in increments of 1. So you can implement that code roughly like this:
double R = 0.01;
double Mas[100];
double bounds[] = {18, 27, 35, 42, 48, 55, 60, 64, 67, 69, 71, 100};
for(int i = 0, b = 0, f = 1; i < ArraySize(Mas); i++) {
if(i == bounds[b]) {
f++;
b++;
}
Mas[i] = R * f;
}
ArrayPrint(Mas);
Note that for i < 10 and i < 18 the multiplier does not change, so the number 10 is not included in the bounds array of index bounds.
If the multipliers can change differently, they can be organised as an array too:
For full initialisation, you must either list all 100 values for an array of 100 elements in brackets, or use the ArrayInitialize() function, for example.
But in your task, you don't need to initialise the array because you don't modify the existing initial values, but assign new ones each time.
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.
Thank you!
ObjectsDeleteAll(0,"",0,-1);//---------------------------------------->🔄 ChartRedraw();
Thanks, that's exactly the way the construct worked.
thank you very much :*
Look in PM, I sent the file yesterday.
Thanks, that's exactly how the design worked.
Why not delete by "autotrade" prefix ?
Why not delete by the prefix "autotrade" ?
Tried that, but it didn't delete it
I should have added 0.
Question: how to fill an array up to 100 elements nicely?
It's like this.
The upper numbers are the number of times, but it can vary
Explicitly assign values to array elements in a line. Then multiply in a loop if you need to change the lot. The cheapest, but longest. If you do it once, it makes no difference I guess :)
It is necessary to write each element?
Somehow, it's possible to do it in loops. Yes, it's a one-time thing in OnInit()
Since the indices on which the value of an element changes do not have a simple dependency (like each next 7 more than the previous one), we need to have them in the code. The multiplier that R is multiplied by is an arithmetic progression in increments of 1. So you can implement that code roughly like this:
Note that for i < 10 and i < 18 the multiplier does not change, so the number 10 is not included in the bounds array of index bounds.
If the multipliers can change differently, they can be organised as an array too:
One more thing like this. An array initialisation string of this form:
is guaranteed to initialise only the first element of the array with zero. Try executing this code:
and you will see in the output:
For full initialisation, you must either list all 100 values for an array of 100 elements in brackets, or use the ArrayInitialize() function, for example.
But in your task, you don't need to initialise the array because you don't modify the existing initial values, but assign new ones each time.