Try printing b[0][1], b[0][2]...
I get it! Thank you!
On the other hand, a new problem comes!
//+------------------------------------------------------------------+ //| 1_1a_testing.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "" #property link "" #property indicator_chart_window int a[1][1][6] = {21,22,23,24,25,26}; int b[4][2][6] = {1,2,3,4,5,6,7,8,9,10,11,12,0,0,0,0,0,18,0,0,0,0,0,0}; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- Alert("----------------------------------------------------------"); ArrayCopy(b,a,11,0,4); Alert("after, b0= "+b[0][0][0]+", b1= "+b[0][0][1]+", b2= "+b[0][0][2]+", b3= "+b[0][0][3]+", b4= "+b[0][0][4]+", b5= "+b[0][0][5]); Alert("after, b6= "+b[0][1][0]+", b7= "+b[0][1][1]+", b8= "+b[0][1][2]+", b9= "+b[0][1][3]+", b10= "+b[0][1][4]+", b11= "+b[0][1][5]); Alert("after, b12= "+b[1][0][0]+", b13= "+b[1][0][1]+", b14= "+b[1][0][2]+", b15= "+b[1][0][3]+", b16= "+b[1][0][4]+", b17= "+b[1][0][5]); //---- return(0); } //+------------------------------------------------------------------+
I do hope that the answer should be {1,2,3,4,5,6,7,8,9,10,11,21,22,23,24,0,0,18,0,0,0,0,0,0} but all values in the array didn't change.
Does anybody know how to correct it?
Thank you!
wing
On the other hand, a new problem comes!
I do hope that the answer should be {1,2,3,4,5,6,7,8,9,10,11,21,22,23,24,0,0,18,0,0,0,0,0,0} but all values in the array didn't change.
Does anybody know how to correct it?
What answer did you get ?
"all values in the array didn't change"
"all values in the array didn't change"
I do hope that the answer should be {1,2,3,4,5,6,7,8,9,10,11,21,22,23,24,0,0,18,0,0,0,0,0,0} but all values in the array didn't change.
Does anybody know how to correct it?
"all values in the array didn't change"
The code that you have posted (reproduced below with some cosmetic changes) compiles but produces a runtime error (code 4056).
int a[1][1][6] = {21,22,23,24,25,26}; int b[4][2][6] = {1,2,3,4,5,6,7,8,9,10,11,12,0,0,0,0,0,18,0,0,0,0,0,0}; ArrayCopy(b,a,11,0,4); Print ("Error Code = ", GetLastError()); Print (b[0][0][0], ", ", b[0][0][1], ", ", b[0][0][2], ", ", b[0][0][3], ", ", b[0][0][4], ", ", b[0][0][5], ", ", b[0][1][0], ", ", b[0][1][1], ", ", b[0][1][2], ", ", b[0][1][3], ", ", b[0][1][4], ", ", b[0][1][5], ", ", b[1][0][0], ", ", b[1][0][1], ", ", b[1][0][2], ", ", b[1][0][3], ", ", b[1][0][4], ", ", b[1][0][5]);
The code that you have posted (reproduced below with some cosmetic changes) compiles but produces a runtime error (code 4056).
but MT4 did it successfully in case of arraycopy for 1 dimension to 2 dimension array.
//+------------------------------------------------------------------+ //| 1_1b_testing.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "" #property link "" #property indicator_chart_window int a[1][6] = {21,22,23,24,25,26}; int b[2][6] = {1,2,3,4,5,6,7,8,9,10,11,12}; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators ArrayCopy(b,a,5,0,4); Alert ("Error Code = ", GetLastError()); Alert("after, b0= "+b[0][0]+", b1= "+b[0][1]+", b2= "+b[0][2]+", b3= "+b[0][3]+", b4= "+b[0][4]+", b5= "+b[0][5]); Alert("after, b6= "+b[1][0]+", b7= "+b[1][1]+", b8= "+b[1][2]+", b9= "+b[1][3]+", b10= "+b[1][4]+", b11= "+b[1][5]); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- //---- return(0); } //+------------------------------------------------------------------+
Does it mean that MT4 cannot perform arraycopy on 1 to 3 dimension array?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear all
here is my code:
I don't understand, all result shown are 0!
Can anybody tell me why?
Thx a lot!
wing