Function | Action |
---|---|
Returns the name of an object of the corresponding type in the specified chart (specified chart subwindow) | |
Returns the number of objects of the specified type in the specified chart (specified chart subwindow) |
Perhaps you should read the manual. ObjectsTotal - Object Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Perhaps you should read the manual. ObjectsTotal - Object Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Ok I find the solution on another topic.
The function ObjectName of the MQL5 documentation work in MQL4... But it's not documented on the MQL4 doc..
That is incorrect! On MQL4+ It works just like in MQL5. Just make sure to use the MQL4+ version of ObjectsTotal.
int ObjectsTotal( long chart_id, // chart identifier int sub_window=-1, // window index int type=-1 // object type );
Also, next time, please post in the correct MQL4 section at the end of the forum.
It is documented in the MQL4 documentation (see the following MQL4 links). You just did not update your reading. It's also in MetaEditor when you hit F1..
Function
Action
Returns the name of an object by its index in the objects list
Returns the number of objects of the specified type
It is documented in the MQL4 documentation (see the following MQL4 links). You just did not update your reading. It's also in MetaEditor when you hit F1..
Function
Action
Returns the name of an object by its index in the objects list
Returns the number of objects of the specified type
Yes the function objectName work in mql4, but in this doc, it only take an index in parameter and not a chartId :
string ObjectName( int object_index // object index );
So according to this, this function only works in the current chart, and not in another. (If my EA is attached to EURUSD, and I need to get the name of an object in the USDJPY chart, it's not possible).
Until I discovered that this works :
string ObjectName( long chart_id, // chart identifier int pos, // number in the list of objects int sub_window=-1, // window index int type=-1 // object type );
But this is the mql5 documentation.
Sorry if my explanation were not enough precise.
Yes next time I'll post in the good section.
To my knowledge, first reported seven (7) years ago. Object creation on different charts - MQL4 programming forum (2016)
Because, to get information of an object in a different chart, the only solution is to use ObjectGetString, ObjectGetInteger,... functions, but all of these functions take in parameter only an object name, and not an index.
bool ObjectGetString( long chart_id, // chart identifier string name, // object name ENUM_OBJECT_PROPERTY_STRING prop_id, // property identifier int prop_modifier, // property modifier string& string_var // here we accept the property value );
Not too long ago, this confused me too: click
- 2023.01.02
- www.mql5.com
- 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 have an expert attach to a chart. It need to iterate through all other opened charts, and iterate through objects in all of this charts.
I iterate through charts without problems, but I don't know how to iterate through objects in another chart than the one where the expert is attached.
Because, to get information of an object in a different chart, the only solution is to use ObjectGetString, ObjectGetInteger,... functions, but all of these functions take in parameter only an object name, and not an index.
But of course, I don't have objects names of another chart.
So is it possible and how to get all objects of a another chart ?
Thanks in advance