MQL4 Indicator Array Problem

 

Hi there!

I have a MetaStock indicator and I am converting it to MQL4. But I am stuck at addition of elements of arrays with return parameter of a stock indicator. 

For example, I can't do:

array[i] = array2[i] + adxreturn;

How can I do that?

Thanks!

 
TerabyteForever: I can't do:

Of course, you can. You just did:

array[i] = array2[i] + adxreturn;

Show us your attempt (using the CODE button) and state the nature of your problem.
          No free help 2017.04.21

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum 2018.05.12

 
William Roeder:

Of course, you can. You just did:

Show us your attempt (using the CODE button) and state the nature of your problem.
          No free help 2017.04.21

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum 2018.05.12




Thanks for quick reply. However, I can't show you code.


If I write this line of code, it gives array out of range error. 


Thank you so much again, I'll try it once again. Maybe I am making mistake somewhere else.

 
TerabyteForever: I can't show you code.
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. We can't see your broken code.
 
Probably you need ArrayResize(); before assigning the value.
 

Hi there!



Finally, I solved my problem using a variable, not array.


a = array[i] + adxreturn;


I declared a global variable and assigned value to it in for loop, and it solved my problem.



Thank you!