
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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