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

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
Thank you!) From your answer, I conclude that for each type of object I need to make a separate function. I thought that somehow it would be possible to make a separate start of functions to build objects, attached to the loop While main function to read the file. How about Switch?
I probably haven't got into it enough.
The first one, the construction of all the graphical objects, does not cause any problems or questions. But I must have misunderstood the second one. Apparently the question was not about how to organize the work with one button for many types of objects, but one button for one type of objects. In that case, I would make a structure with object parameters and several arrays of structures, one array for each type of object. So, I would bind these structure arrays to buttons of corresponding types.
Then, when you press the button, the corresponding object type will be deleted. And when the button is released, the objects will be restored by the parameters that are in the structure array.
So it will be necessary to read the file only once at startup.
I probably haven't got into it enough.
The first one, the construction of all the graphical objects, does not cause any problems or questions. But I must have misunderstood the second one. Apparently the question was not about how to organize the work with one button for many types of objects, but one button for one type of objects. In that case, I would make a structure with object parameters and several arrays of structures, one array for each type of object. So, I would bind these structure arrays to buttons of corresponding types.
Then, when you press the button, the corresponding object type will be deleted. And when the button is released, the objects will be restored by the parameters that are in the structure array.
Thus, it will be necessary to read the file only once at startup.
Flags are variables. Or bool: false=empty, true=raised or int - then there are many flags in one number at once: 0 - all omitted, 1=lower first, 2=lower second, 3=lower first and second, 4=lower third, 5=lower third and first, 6=lower third and second, 7=lower first, second, third, 8=lower fourth.... Well that's in binary code. How do you find out?
Thanks a lot for the reply, I will try to do both variants, through flags as suggested by STARIJ and your variant is also interesting to try. I will try to ask less questions, it's good to have answers!)
Flags may not be bad, but it misses the point
Forum on trading, automated trading systems & strategy testing
Any questions newbies have on MQL4, help and discussion on algorithms and codes
WinProject, 2018.01.26 18:17
Good evening, once again I'm looking for help. My EA has the main Function in OnInit, which reads the file, and immediately builds different graphical objects according to different conditions. Also on the chart is a button which, when clicked, operates the function to remove these objects, such as text labels. How to make, that after the press of the button has removed text labels, at release of the button it is possible to start not all Function entirely, which will completely construct all objects, but to construct only text labels. The only thing that comes to mind is to create an analogue of the main function separately for each type of object with all the actions associated with opening and reading the file, but I want to use some clever solution, but I do not know which one and how, in the main function or in the functions of the buttons?
Can you tell me how to get the value of the current hour in MQL5 ?
I created an object of MqlDateTime structure, it gives nothing
Can you tell me how to get the value of the current hour in MQL5 ?
I created an object of MqlDateTime structure, it gives nothing
The structure needs to be filled with date-time.
Use TimeCurrent()? I just don't understand how.
use TimeCurrent()? just don't understand how
TimeToStruct()
Ah, got it, it's working, thanks!
https://docs.mql4.com/ru/basis/types/casting
Penultimate example,colour in RGB representation as string."Converting two structures by copying the contents" doesn't work.
The compiler generates the following error... ('=' - illegal operation use test.mq4 34 12 )
Did I copy something wrong or is there an error in the sample? Please, advise me.