Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 783

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
Is it possible to create one template and apply it to multiple functions?
If variables of the same type are used, it would be very useful to know if it is possible to use one template for several functions.
Hello, could you please tell me how to add quotes for oil, indices and metals?
It depends firstly on whether the office broadcasts them or not. It also depends on the terminal in which you work. If the office broadcasts them, then you need to know on what accounts and under what conditions these quotes are broadcasted, perhaps you just need to open the list of instruments and these instruments are there. If the office broadcasts them on conditions that are impossible for you, you have to create a chart with these quotes and update them every time. Do you know for sure that your brokerage firm will broadcast Oil?
Is it possible to create one template and apply it to multiple functions?
If variables of the same type are used, it would be very useful to know if it is possible to use one template for several functions.
No. A complete description of each function must be given separately. Otherwise you won't be able to read your own code later.
No. A full description of each function must be given separately. Otherwise you won't be able to read your own code after a while.
That's a pity. You won't be able to read your own code anyway if you don't do it. I just want to write compact programs, because you often use variables of the same type in functions, that's why I asked. I thought it would be possible to use "classes", but I'm still not familiar with them. So I'll know if I have to make templates for many functions.
Who can tell me why this entry doesn't work. I want to access the fields of structures that store an array and rotate it depending on which condition is fulfilled.Execution of the condition depends on theArrayDimension function.
Eventuallyit gets in the first loop despite the fact that this conditionif(r==1)is false, why it gets there if the rank is 2um, how it despite the false gets into the body where something is executed.
Pity. You won't be able to read your own code anyway if you don't do it or if you don't do it. I just want to write compact programs, because you often use variables of the same type in functions, that's why I asked. I thought it would be possible to use "classes", but I'm still not familiar with them. So I'll know if I have to make templates for many functions.
I can't grasp the essence of how compactness would be achieved. In the example above it saves 2 lines. If you want to save them so much, you can write a macrosubstitution and use it in the line before the function
Is it necessary to writetempl(T1) in front of each functionand it will take a variable or the required argument? Why istempl(T) declaredandtempl(T1) called, should I add a number before each function(templ(T1)templ(T2)templ(T3)) or should I writetempl(T1) everywhere?And if several parameters are scored intemplate<typename T>then how would it be, like thistemplate<typename T,typename P,typename Q>-templ(T,P,Q).