MQL4 Indicator Array Problem

To add comments, please log in or register
TerabyteForever
21
TerabyteForever  

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!

William Roeder
22698
William Roeder  
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

TerabyteForever
21
TerabyteForever  
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.

William Roeder
22698
William Roeder  
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.
Marco vd Heijden
Moderator
13044
Marco vd Heijden  
Probably you need ArrayResize(); before assigning the value.
TerabyteForever
21
TerabyteForever  

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!

To add comments, please log in or register