First post from me, but can anyone tell me if ArrayCopy() has altered. It just doesn't seem to make any sense to me anymore.
Please use the SRC button when you post code.
Have you read the first post of the topic ?
Changed ArrayCopyRates() behavior - in the old MQL4 version, this
function copied price series to double[][6] array. Now, the array from
MqlRates structure elements should be used in order to receive time
series:
//Structure for storing data on prices, volumes and spread.structMqlRates
{
datetime time; // period start timedouble open; // Open pricedouble high; // High price for the perioddouble low; // Low price for the perioddouble close; // Close pricelong tick_volume; // tick volumeint spread; // spreadlong real_volume; // exchange volume
};
The new format of the function also performs virtual copying. In
other words, the actual copying is not performed. When the copied values
are appealed to, the price data is accessed directly.
In order to maintain compatibility with old MQL4 applications,
the old call format is also preserved. However, a real copying of data
to double type array is now performed.
This means that the necessary data should be copied to
dest_array[][] again when changing values in time series (adding new
bars, restructuring or updating the last bar's Close price). In this
case, the receiver array will be automatically distributed according to
the necessary amount of the copied bars even if it has been declared
statically.
I have noticed some bugs in the compiler. It sometimes shows wrong line numbers in the include files, so that the error is very hard to find, but I also doubt that there is an error at all, because one error has been eliminated by removing an unused variable and this shouldn't generate any error.
...If someone from MetaQuotes development team is interested, I can send the full code in a private email. It has been working in MT4 quite well.
Please use the SRC button when posting code.
Can you please send code that compiles, I can try to help you ? (I am not from Metaquotes dev. team though).
All these changes for developers, why can't you add more timeframes like MT5 has for the user. I must run extra charts/resources just to get 8 and 12 hour charts which is such a pain and cumbersome.
Why not switch to MT5?? - because my my indicators do not work in MT5 and there is no halfway house, MT4.5 one day ?
Remove or comment the line
It is property of scripts so the new compiler decides that it is a script
Hello,
I've removed the property line. It works now as expert.
Thanks for your help.
Oliwand
Hi there
I have an indicator which is not compiling after the new build. Can anyone help?
There is a lot of little errors to correct. Please this post https://www.mql5.com/en/forum/149271 and try to correct them.
If you can't please create your own topic, some people will help you.
Hi all,
First post from me, but can anyone tell me if ArrayCopy() has altered. It just doesn't seem to make any sense to me anymore.
// declare arrays
double i[][4];
double j[][4];
// Size and fill i[] with some data
ArrayResize(i, 2);
i[0][0] = 1;
i[0][1] = 2;
i[0][2] = 3;
i[0][3] = 4;
i[1][0] = 5;
i[1][1] = 6;
i[1][2] = 7;
i[1][3] = 8;
// resize array j[] - is this required?, cant find any documentation on this but experementation seems to show it is not.
ArrayResize(j, 2);
// Copy from i to j, starting at 0 for both and copy the first 4 elements
Print(ArrayCopy(j,i,0,0,4)); // Output: 2 - Surely 4 should be returned?
Print(j[0][0]); // Output: 1 - ok
Print(j[0][1]); // Output: 2 - ok
Print(j[0][2]); // Output: 3 - ok
Print(j[0][3]); // Output: 4 - ok
Print(j[1][0]); // Output: 5 - wrong?
Print(j[1][1]); // Output: 6 - wrong?
Print(j[1][2]); // Output: 7 - wrong?
Print(j[1][3]); // Output: 8 - wrong?
// Populate i[] with new data
i[1][0] = 9;
i[1][1] = 10;
i[1][2] = 11;
i[1][3] = 12;
// copy from i[] to j[], to the 5th element of j[] from the 5th element of i[] for a count of 4 elements
Print(ArrayCopy(j,i,4,4,4)); //2014.02.06 19:34:29.868 Access violation write to 0x06D86000 in 'C:\Users\.....'; ... and crash.
// following doesn't now execute
Print(j[0][0]);
Print(j[0][1]);
Print(j[0][2]);
Print(j[0][3]);
Print(j[1][0]);
Print(j[1][1]);
Print(j[1][2]);
Print(j[1][3]);
To create new programs which way should be followed? I could not understand
Hi all,
First post from me, but can anyone tell me if ArrayCopy() has altered. It just doesn't seem to make any sense to me anymore.
Please use the SRC button when you post code.
Have you read the first post of the topic ?
Changed ArrayCopyRates() behavior - in the old MQL4 version, this function copied price series to double[][6] array. Now, the array from MqlRates structure elements should be used in order to receive time series:
The new format of the function also performs virtual copying. In other words, the actual copying is not performed. When the copied values are appealed to, the price data is accessed directly.
In order to maintain compatibility with old MQL4 applications, the old call format is also preserved. However, a real copying of data to double type array is now performed.
This means that the necessary data should be copied to dest_array[][] again when changing values in time series (adding new bars, restructuring or updating the last bar's Close price). In this case, the receiver array will be automatically distributed according to the necessary amount of the copied bars even if it has been declared statically.I have noticed some bugs in the compiler. It sometimes shows wrong line numbers in the include files, so that the error is very hard to find, but I also doubt that there is an error at all, because one error has been eliminated by removing an unused variable and this shouldn't generate any error.
...If someone from MetaQuotes development team is interested, I can send the full code in a private email. It has been working in MT4 quite well.
Please use the SRC button when posting code.
Can you please send code that compiles, I can try to help you ? (I am not from Metaquotes dev. team though).
Please use the SRC button when you post code.
Have you read the first post of the topic ?
Thanks angevoyageur - i will use the SRC button in the future.
Regarding the ArrayCopy(), I dont see how ArrayCopyRates() is relevant. If I have got this wrong, then please point me in the right direction.
Kind regards - mfp
All these changes for developers, why can't you add more timeframes like MT5 has for the user. I must run extra charts/resources just to get 8 and 12 hour charts which is such a pain and cumbersome.
Why not switch to MT5?? - because my my indicators do not work in MT5 and there is no halfway house, MT4.5 one day ?
Sigh...
PG
Thanks angevoyageur - i will use the SRC button in the future.
Regarding the ArrayCopy(), I dont see how ArrayCopyRates() is relevant. If I have got this wrong, then please point me in the right direction.
Kind regards - mfp