Waldor Bray Silva Cubas:
Hello everyone:
I have a question, How pass arguments of any type to a fuction, for example:
string StringConcatenate_MQL5(void arg1, void arg2, void arg3, void arg4){
string result="";
StringConcatenate(result,arg0,arg1,arg2,arg3,arg4);
return result;
}
Call to function:
string Vars = StringConcatenate_MQL5("MACD_TF=",7," Periods=",18);
template<typename T1,typename T2,typename T3,typename T4> string MyString(T1 var1,T2 var2,T3 var3,T4 var4) { return string(var1)+string(var2)+string(var3)+string(var4); }
Ok Thanks,
Can you tell me how assign default values to arguments, for example:
template<typename T1,typename T2,typename T3,typename T4> string MyString(T1 var1=NULL,T2 var2=NULL,T3 var3=NULL,T4 var4=NULL) { return string(var1)+string(var2)+string(var3)+string(var4); }Compilation Error: 'Cannot to apply function template'
template<typename T1> string String(T1 var1) { return string(var1); } template<typename T1,typename T2> string String(T1 var1,T2 var2) { return String(var1)+String(var2); } template<typename T1,typename T2,typename T3> string String(T1 var1,T2 var2,T3 var3) { return String(var1,var2)+String(var3); } ...
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hello everyone:
I have a question, How pass arguments of any type to a fuction, for example:
string StringConcatenate_MQL5(void arg1, void arg2, void arg3, void arg4){
string result="";
StringConcatenate(result,arg0,arg1,arg2,arg3,arg4);
return result;
}
Call to function:
string Vars = StringConcatenate_MQL5("MACD_TF=",7," Periods=",18);