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
You cannot resize an array that was created static. You can only resize a dynamic array. ArrayResize() has a return value, check it to detect errors.
Actually you can
Actually you can
Interesting to know. It's somewhat contradicting the mql reference:
Note
The function can be applied only to dynamic arrays.
yea i understund what you tell but , my case is different i know that array start the count 0 to end and i if i create Array [2] ,resize it, and with(WindowFirstVisibleBar() + 5)and cicle for insert inside of array with for(int i=WindowFirstVisibleBar(); i>=0; i--) , i aspect the script runn good , but return the same2020.05.15 23:19:13.116 candle-body-size USDCHF,H1: array out of range in 'candle-body-size.mq4' (60,29)
example if WindowFirstVisibleBar() is equal = 100 and i resize in 105 , if for start to 0 or 1 for me is no problem i have 5 position plus
Sorry, english is not my first language, so I don't quite get what you don't understand.
Basics are simple:
Finally:
Useful links:
read all about Array functions.
use ArraySize() function and print out actual array size before you try to access array elements. Make sure that you resized your array correctly.
Interesting to know. It's somewhat contradicting the mql reference:
Note
The function can be applied only to dynamic arrays.
I know, I can't say it has always be like that, but it is at least for the last 6 years. And it will not change because MT4/mql4 is "frozen".
sorry but i continue to not undesrtund i can create static array double array[10] or dinamic array double array[] but after with dinamic i must resize with arrayresize(array,1000),
now i correct the script with dinamic array but return me the same problem
the problem is not resize because the print after resize return me this
2020.05.17 21:50:41.781 candle-body-size USDCHF,H1: visiblebar 653 dimention array 658
now if i do a for with WindowFirstVisibleBar and is 653 if i have array of 658 why go in dimention excide?????
the for do only 653 cicle and arry is 658 how is possible??
i find a problem is allert
//Alert("Plus ", aBodyCount[i]," pt.");