based on MQL5 reference:
when using CopyBuffer, CopyHigh, CopyOpen, CopyClose, CopyLow, CopyTime, CopyRates, etc. :
No matter what is the property of the target array - as_series=true or as_series=false,
Data will be copied so that the oldest element will be located at the start of the physical memory allocated for the array.
So the question is : What's the use of ArraySetAsSeries anyway ?
since all copy functions ignore the as_series state of target array
Re-check :
double test[]; CopyClose(_Symbol,PERIOD_CURRENT,0,3,test); printf("*** Before : Test : - %g - %g - %g",test[0],test[1],test[2]); ArraySetAsSeries(test,true); printf("*** After : Test : - %g - %g - %g",test[0],test[1],test[2]);
Console :
2018.03.17 08:13:51.501 **** EURUSD,H1: uninit reason 1 2018.03.17 08:13:07.957 **** EURUSD,H1: initialized 2018.03.17 08:13:07.957 **** EURUSD,H1: *** After : Test : - 1.22886 - 1.22862 - 1.22837 2018.03.17 08:13:07.957 **** EURUSD,H1: *** Before : Test : - 1.22837 - 1.22862 - 1.22886
Re-check :
Console :
So basically it's just a method for reversing index of one-dimensional arrays.
but there's several threads I found just here on mql5 forums, some reliable coders frown upon using ArraySetAsSeries after filling array (CopyClose ,...)
I guess it was a useful thing to have in Mql4, and apparently older versions of mql5, and now it's just there among other array functions, for no vital reason. :S
So basically it's just a method for reversing index of one-dimensional arrays.
but there's several threads I found just here on mql5 forums, some reliable coders frown upon using ArraySetAsSeries after filling array (CopyClose ,...)
I guess it was a useful thing to have in Mql4, and apparently older versions of mql5, and now it's just there among other array functions, for no vital reason. :S
I found it convenient when it comes to loop. Some may not have, you may not have.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
based on MQL5 reference:
when using CopyBuffer, CopyHigh, CopyOpen, CopyClose, CopyLow, CopyTime, CopyRates, etc. :
No matter what is the property of the target array - as_series=true or as_series=false,
Data will be copied so that the oldest element will be located at the start of the physical memory allocated for the array.
So the question is : What's the use of ArraySetAsSeries anyway ?
since all copy functions ignore the as_series state of target array