A1exPit: I meant that when data is passed into an array, it will fill in sequentially, i.e. array1[] = x; in which cell will value x be written if the cell number is not specified directly?
If you want to write different values, use the loop sequentially. If you need to write to a specific cell, specify its address.
Thank you,
Here's another question: through ArrayCopy, will I be able to create a new array with size equal to the number of filled cells in the previous one? Or should I create a second array first, and only then copy?
intArrayCopy( void& dst_array[], // куда копируем constvoid& src_array[], // откуда копируем int dst_start=0, // с какого индекса пишем в приемник int src_start=0, // с какого индекса копируем из источника int count=WHOLE_ARRAY// сколько элементов );
Here's another question: with ArrayCopy, can I create a new array with the same size as the number of filled cells in the previous one? Or do I have to create a second array first and then copy?
intArrayCopy( void& dst_array[], // куда копируем constvoid& src_array[], // откуда копируем int dst_start=0, // с какого индекса пишем в приемник int src_start=0, // с какого индекса копируем из источника int count=WHOLE_ARRAY// сколько элементов );
Spread = MarketInfo(Symbol(),MODE_SPREAD); if ( Spread >= 0 ) ExtSpread [x] = Spread; if ( TimeCurrent() - iTime( NULL, 0, 0) >= 60 ){ int Spread2[x]; ArrayCopy( Spread2[],ExtSpread[],0,0, WHOLE_ARRAY);} x=x+1; if (x > 1000) x = 0;
Like this, I write the Spread value to ExtSpread[] and when the one-minute bar is over, I move it to another array - which should, in theory, survive to the next bar.
Size ExtSpread[1000]
One more question: if the array is numbered starting from zero, then, if its size is 1000, its last cell will be 999 ?
Spread = MarketInfo(Symbol(),MODE_SPREAD); if ( Spread >= 0 ) ExtSpread [x] = Spread; if ( TimeCurrent() - iTime( NULL, 0, 0) >= 60 ){ int Spread2[x]; ArrayCopy( Spread2[],ExtSpread[],0,0, WHOLE_ARRAY);} x=x+1; if (x > 1000) x = 0;
Like this, I write the Spread value to ExtSpread[] and when the one-minute bar is over, I move it to another array - which should, in theory, survive to the next bar.
Size ExtSpread[1000]
One more question: if the array is numbered starting from zero, then, if its size is 1000, its last cell will be 999 ?
Then it is correct: x++ and if ( x > 999 ) x=0;
Spread = (int)MarketInfo(Symbol(),MODE_SPREAD); if ( Spread >= 0 ) ExtSpread [x] = Spread; if ( TimeCurrent() - iTime( NULL, 0, 0) >= 60 ){ int Spread2[];ArrayInitialize (Spread2,EMPTY_VALUE); ArrayResize( Spread2,x,0); ArrayCopy( Spread2,ExtSpread,0,0, WHOLE_ARRAY);} x=x+1; if (x > 999) x = 0;
Good afternoon! could you please tell me, I downloaded the mt4 636 version on android, but it does not see the list of brokers. Is the terminal version no longer supported?(( If so, where can i download a working one?
During compilation an error will pop up. What is the problem? Help me solve it!
ArrayInitialize(max,0) =>ArrayInitialize(arr,0);
for(int a=1;a<=pr;a++) =>for(int a=1;a<pr;a++)
This is a very-very non-optimal code, the terminal hangs for a few minutes when launching it, and then it will be very slow, and if you run it on several charts, then it will not work at all
This is a very-very non-optimal code, the terminal hangs for a few minutes when launching it, and then it will be very slow, and if you run it on several charts, then it will not work at all
Yes, thanks, fixed everything, no errors. Lags, yes, very. Could you tell me in what direction to move to optimize, or will I have to rewrite everything?
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.
I meant that when data is passed into an array, it will fill in sequentially, i.e. array1[] = x; in which cell will value x be written if the cell number is not specified directly?
No. If you want to fill all cells with the same value , use ArrayInitialize().
If you want to write different values, use the loop sequentially. If you need to write to a specific cell, specify its address.
No. If you want to fill all cells with the same value , use ArrayInitialize().
If you want to write different values, use the loop sequentially. If you need to write to a specific cell, specify its address.
Thank you,
Here's another question: through ArrayCopy, will I be able to create a new array with size equal to the number of filled cells in the previous one? Or should I create a second array first, and only then copy?
void& dst_array[], // куда копируем
const void& src_array[], // откуда копируем
int dst_start=0, // с какого индекса пишем в приемник
int src_start=0, // с какого индекса копируем из источника
int count=WHOLE_ARRAY // сколько элементов
);
Thank you,
Here's another question: with ArrayCopy, can I create a new array with the same size as the number of filled cells in the previous one? Or do I have to create a second array first and then copy?
void& dst_array[], // куда копируем
const void& src_array[], // откуда копируем
int dst_start=0, // с какого индекса пишем в приемник
int src_start=0, // с какого индекса копируем из источника
int count=WHOLE_ARRAY // сколько элементов
);
Create first, of course.
if ( Spread >= 0 ) ExtSpread [x] = Spread;
if ( TimeCurrent() - iTime( NULL, 0, 0) >= 60 ){
int Spread2[x];
ArrayCopy( Spread2[],ExtSpread[],0,0, WHOLE_ARRAY);}
x=x+1;
if (x > 1000) x = 0;
Like this, I write the Spread value to ExtSpread[] and when the one-minute bar is over, I move it to another array - which should, in theory, survive to the next bar.
Size ExtSpread[1000]
One more question: if the array is numbered starting from zero, then, if its size is 1000, its last cell will be 999 ?
Then it is correct: x++ and if ( x > 999 ) x=0;
if ( Spread >= 0 ) ExtSpread [x] = Spread;
if ( TimeCurrent() - iTime( NULL, 0, 0) >= 60 ){
int Spread2[x];
ArrayCopy( Spread2[],ExtSpread[],0,0, WHOLE_ARRAY);}
x=x+1;
if (x > 1000) x = 0;
Like this, I write the Spread value to ExtSpread[] and when the one-minute bar is over, I move it to another array - which should, in theory, survive to the next bar.
Size ExtSpread[1000]
One more question: if the array is numbered starting from zero, then, if its size is 1000, its last cell will be 999 ?
Then it is correct: x++ and if ( x > 999 ) x=0;
if ( Spread >= 0 ) ExtSpread [x] = Spread;
if ( TimeCurrent() - iTime( NULL, 0, 0) >= 60 ){
int Spread2[];ArrayInitialize (Spread2,EMPTY_VALUE); ArrayResize( Spread2,x,0);
ArrayCopy( Spread2,ExtSpread,0,0, WHOLE_ARRAY);}
x=x+1;
if (x > 999) x = 0;
Postponed:
scomoroh, 2016.12.04 18:58
An error pops up when compiling. What is the problem? Help to solve it!Postponed:
scomoroh, 2016.12.04 18:58
During compilation an error will pop up. What is the problem? Help me solve it!ArrayInitialize(max,0) =>ArrayInitialize(arr,0);
for(int a=1;a<=pr;a++) =>for(int a=1;a<pr;a++)
This is a very-very non-optimal code, the terminal hangs for a few minutes when launching it, and then it will be very slow, and if you run it on several charts, then it will not work at all
ArrayInitialize(max,0) =>ArrayInitialize(arr,0);
for(int a=1;a<=pr;a++) =>for(int a=1;a<pr;a++)
This is a very-very non-optimal code, the terminal hangs for a few minutes when launching it, and then it will be very slow, and if you run it on several charts, then it will not work at all