Good evening!
is it possible to create an array of OBJ_* (such as OBJ_RECTANGLE, OBJ_TREND) or OBJPROP_* (such as OBJPROP_BACK, OBJPROP_COLOR)?
I could not yet figure out what type the array has to be of, if it is possible at all.
Best!
ENUM_OBJECT objs[7]; objs[0] = OBJ_VLINE; objs[1] = OBJ_HLINE; objs[2] = OBJ_TREND; ...
Big thank you, Anthony! works like a charme. I knew of enums but not of the ENUM_OBJECT enumartion :-)
It's mentioned here (but it's easy to miss):
https://www.mql5.com/en/docs/constants/objectconstants/enum_object
When a graphical object is created using the ObjectCreate() function, it's necessary to specify the type of object being created, which can be one of the values of the ENUM_OBJECT enumeration. Further specifications of object properties are possible using functions for working with graphical objects.
You can also simplify it by using an array initialization list.
ENUM_OBJECT objs[] = { OBJ_VLINE, OBJ_HLINE, OBJ_TREND };
Good morning Nicholi!
I'm not sure what you mean... That's how you should initialize an array when you know all of the values prior to run-time.
It goes for anything...
string working_symbols[] = {"EURUSD", "USDJPY, "GPBUSD"}; ArrayPrint(working_symbols);
well, that is what I meant :-)
oh... lol. Gotcha. :)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Good evening!
is it possible to create an array of OBJ_* (such as OBJ_RECTANGLE, OBJ_TREND) or OBJPROP_* (such as OBJPROP_BACK, OBJPROP_COLOR)?
I could not yet figure out what type the array has to be of, if it is possible at all.
Best!