Hi,
I try to do this code but appear the following errors messages:
- invalid array access
- structure have objects and cannot be copied
I try to do this function :
MqlParam XXXXSystem::GetParamsIndicator(int ind){ MqlParam Param[5]; return (Param); }
Is possible return one Struct variable from Function ?
Regards,
1. Next time, when posting a code, please use SRC button. It will help reading your code much easier.
2. Here the reason for "invalid array access", if - for example - the type of MqlParam is an integer type, you should tell the index of Param object and its struct member names, like this
return (Param[0].interger_value);
Zero in Param[0] is an index for the array, and integer_value is a member of MqlParam
3. I could not correctly give answer for the other error, because you're only posting some part of your code.
Thank you very much for the reply!
I solved the problem redefining my Struct I changed variable where this kept ParamsIndicator to MqlParam! This had them stored in an array but I changed in MqlParam, I think it is better to define it in MqlParam! Easy for access and use variables with IndicatorCreate!
But the problem was commenting if a function can return a different value than (string, number,double... ) for exampel one struct. In this exampel I tried to return all struct variable (Param) . An my question was That is posible?
I'm a rookie in MQL5 programming :).
Regards!
- www.mql5.com
Thank you very much for the reply!
I solved the problem redefining my Struct I changed variable where this kept ParamsIndicator to MqlParam! This had them stored in an array but I changed in MqlParam, I think it is better to define it in MqlParam! Easy for access and use variables with IndicatorCreate!
But the problem was commenting if a function can return a different value than (string, number,double... ) for exampel one struct. In this exampel I tried to return all struct variable (Param) . An my question was That is posible?
I'm a rookie in MQL5 programming :).
Regards!
1. I consider myself a rookie too :). I don't remember all mql5 function and what the purpose of it. So I have to re-read the doc agai and again and re-test and re-experimenting with my MT.
2. Any function can only return one value, though we can manipulate it by passing parameter as reference and not by value (click here) , but since you using a struck, why don't make that struck globally-declared-struck, therefore you can access its member from anywhere.
Yes, I can Do that (2). I can create globally-declared-struck.
But I found that https://www.mql5.com/en/forum/631 this user have sem question.
Now I having solved problem :)
Thanks very much!!
- www.mql5.com
Yes, I can Do that (2). I can create globally-declared-struck.
But I found that https://www.mql5.com/en/forum/631 this user have sem question.
Now I having solved problem :)
Thanks very much!!
jejeje I know that ! But the problem is when use in function return(struct) :/
I had a felling that I should gave an example, but I was busy at that time :(, but anyway, thanks for searching, coz I didn't search :( and gives us that link to old post :).
That was before I become mod.
No problem ! I'm solved problem maybe when you have time can write one exemplel. Thank you very much ! :)
- 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,
I try to do this code but appear the following errors messages:
- invalid array access
- structure have objects and cannot be copied
I try to do this function :
MqlParam XXXXSystem::GetParamsIndicator(int ind){
MqlParam Param[5];
return (Param);
}
Is possible return one Struct variable from Function ?
Regards,