Are you using buffers or arrays ? if using arrays you need to declare the array with the number of elements or do an ArrayResize . . . if you are using buffers then you need to use them properly . . .
galcades:
PS, do not worry about the code efficiency and the fact that there are no arrays assigned to the buffers.
That's your problem. Your arrays have no size (Aver_Bar[]), you can not use it/them until they do, either by explicit compile time size, dynamic resize, or implicitly via setIndicatorBuffer
PS, do not worry about the code efficiency and the fact that there are no arrays assigned to the buffers.
RaptorUK:
Are you using buffers or arrays ? if using arrays you need to declare the array with the number of elements or do an ArrayResize . . . if you are using buffers then you need to use them properly . . .
Are you using buffers or arrays ? if using arrays you need to declare the array with the number of elements or do an ArrayResize . . . if you are using buffers then you need to use them properly . . .
Thanks a lot, I am starting with mql4 and didn't know I had to declare the array with the number of elements. Now it works smoothly.
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
Hi there,
I am trying to program an custom indicator but I cannot manage to assign values to an array. In my example, I am just trying to calculate the average value between the High and the Low of each bar and assign to an array for subsequent calculations. I used the Alert() function to find out the value of the Array components once assigned (just for bars from 1 to 5). The Alert() function always gave the value 0 as an outcome. However, if I use the same code with normal variables instead of an Array everything works, but it's not very useful when I want to do it for a large number of Bars. Could anyone help? Why the values are not assigned to the Array?Thank you
PS, do not worry about the code efficiency and the fact that there are no arrays assigned to the buffers.