Hi all,
I am using MQL4 and I found out that ObjectGet doesn't support a chartId as you can see from the following screenshot:
and therefore I am not able to use it on charts different than the one the EA is running.
Is there a way to solve this problem?
Thanks in advance.
It's for the current chart only.
But you can do it with the extended calls like,
ObjectGetInteger() ObjectGetDouble()
Fix your code.
Look at the documentation.
Function | Action |
Creates an object of the specified type in a specified chart | |
Returns the name of an object of the corresponding type in the specified chart (specified chart subwindow) | |
Removes the object with the specified name from the specified chart (from the specified chart subwindow) | |
Removes all objects of the specified type from the specified chart (from the specified chart subwindow) | |
Searches for an object with the specified ID by the name | |
Returns the time value for the specified object price value | |
Returns the price value of an object for the specified time | |
Changes the coordinates of the specified object anchor point | |
Returns the number of objects of the specified type in the specified chart (specified chart subwindow) | |
Returns the double value of the corresponding object property | |
Returns the integer value of the corresponding object property | |
Returns the string value of the corresponding object property | |
Sets the value of the corresponding object property | |
Sets the value of the corresponding object property | |
Sets the value of the corresponding object property | |
Sets the font for displaying the text using drawing methods (Arial 20 used by default) | |
Transfers the text to the custom array (buffer) designed for creation of a graphical resource | |
Returns the string's width and height at the current font settings |
bool ray = ObjectGetInteger(ChartID(),"Trend",OBJPROP_RAY);
Oh, I see.
You should be using ObjectGetInteger() and you should be assigning its value to something or checking to see if it is true or not.
Yes I know how to use a result from a function, that code was simply to prove that it doesn't work.
However, I tried with ObjectGetInteger and it works. Thanks for the tip!
But I don't understand how you know it, because from the documentation it says tht OBJPROP_RAY must be used with ObjectGet:
Fix your code.
Look at the documentation.
Function | Action |
Creates an object of the specified type in a specified chart | |
Returns the name of an object of the corresponding type in the specified chart (specified chart subwindow) | |
Removes the object with the specified name from the specified chart (from the specified chart subwindow) | |
Removes all objects of the specified type from the specified chart (from the specified chart subwindow) | |
Searches for an object with the specified ID by the name | |
Returns the time value for the specified object price value | |
Returns the price value of an object for the specified time | |
Changes the coordinates of the specified object anchor point | |
Returns the number of objects of the specified type in the specified chart (specified chart subwindow) | |
Returns the double value of the corresponding object property | |
Returns the integer value of the corresponding object property | |
Returns the string value of the corresponding object property | |
Sets the value of the corresponding object property | |
Sets the value of the corresponding object property | |
Sets the value of the corresponding object property | |
Sets the font for displaying the text using drawing methods (Arial 20 used by default) | |
Transfers the text to the custom array (buffer) designed for creation of a graphical resource | |
Returns the string's width and height at the current font settings |
I looked at the documentation and as you can see from the screenshot, it says that OBJPROP_RAY must be used with ObjectGet. Can you tell me where it is written otherwise, so I won't commit the same error again with another property?
HOwever I tried with ObjectGetInteger and it worked! Thanks for the tip.

- 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 all,
I am using MQL4 and I found out that ObjectGet doesn't support a chartId as you can see from the following screenshot:
and therefore I am not able to use it on charts different than the one the EA is running.
Is there a way to solve this problem?
Thanks in advance.