Hi
If an indicator uses multiple classes and functions, as one might have if writing a non-simplistic indicator, then the lack of support for array pointers makes it necessary to pass references to data arrays from class to class and function to function for every class and function that needs to process price data - starting from OnCalculate(). Is there really no other way?
I have tried using CopyOpen(), CopyHigh(), CopyLow(), CopyClose() instead to fetch price data, but this is apparently too slow for Strategy Tester.
Thank you.
There is no difference between a reference and an array pointer in MQL.
What are you expecting as "other way" ?
There is no difference between a reference and an array pointer in MQL.
What are you expecting as "other way" ?
There is no difference between a reference and an array pointer in MQL.
What are you expecting as "other way" ?
Thanks Alain for your reply.
OK, suppose you're writing a complex indicator, one that requires many functions and classes, and you try to follow best programming practices. How would you give access to your various functions and classes that require the price data, the OHLC and time arrays passed to your indicator in OnCalculate()? By passing them as arguments from class to class and function to function?
Rob
Thanks Alain for your reply.
OK, suppose you're writing a complex indicator, one that requires many functions and classes, and you try to follow best programming practices. How would you give access to your various functions and classes that require the price data, the OHLC and time arrays passed to your indicator in OnCalculate()? By passing them as arguments from class to class and function to function?
Rob
If mql would support reference variables, it would be possible to pass the array as reference to the constructor and store it in a member variable. This way the object would be attached to the external array.
Also pointer arithmetic like in c/c++ is not available in mql.
If that were possible, we could create objects that do fancy stuff with externally assigned memory.
I know but it's recurring issue triggering from time to time since years. You will never have that in MQL.
In the meantime we have to deal with how it is, not how we would like it to be.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
If an indicator uses multiple classes and functions, as one might have if writing a non-simplistic indicator, then the lack of support for array pointers makes it necessary to pass references to data arrays from class to class and function to function for every class and function that needs to process price data - starting from OnCalculate(). Is there really no other way?
I have tried using CopyOpen(), CopyHigh(), CopyLow(), CopyClose() instead to fetch price data, but this is apparently too slow for Strategy Tester.
Thank you.