asynchronous object get values

 

Hi,

In multiple chart applications, how do you get the objects value of a chart other than the current one?!!!

thanks...

 
pouya.star: In multiple chart applications, how do you get the objects value of a chart other than the current one?!!!

By setting the Chart ID parameter in the ObjectGet function.

double  ObjectGetDouble(
   long     chart_id,         // chart identifier
   string   object_name,      // object name
   int      prop_id,          // property identifier
   int      prop_modifier=0   // property modifier, if required
   );
You can use the ChartFirst() and ChartNext() functions to step through the charts and obtain their ID.
ChartFirst - Chart Operations - MQL4 Reference
ChartFirst - Chart Operations - MQL4 Reference
  • docs.mql4.com
ChartFirst - Chart Operations - MQL4 Reference
 
Fernando Carreiro:

By setting the Chart ID parameter in the ObjectGet function.

Hi dear Fernando. Thank you for your reply., my question is about OBJECT VALUE(ObjectGetValueByTime function), not Object Property.

In order to receive the object value  on a different chart which code should be used?

In this link  https://docs.mql4.com/objects/objectgetvaluebytime  written  "a synchronous call is used"....

I don't have any idea about the synchronous call in mql4. do you know what is this? and how can I solve my problem?

I just want to get an object value of a chart from other chart. How can I do it?!(object value, not object property! ------->>>ie. using ObjectGetValueByTime function)

ObjectGetValueByTime - Object Functions - MQL4 Reference
ObjectGetValueByTime - Object Functions - MQL4 Reference
  • docs.mql4.com
When this function is used on the current chart, this chart is accessed directly, while in order to receive the properties of an object on a different chart, a synchronous call is used. The synchronous call means that the function waits for the execution of all commands that have been enqueued for this chart prior to its call, that is...
 
pouya.star:

Hi dear Fernando. Thank you for your reply., my question is about OBJECT VALUE(ObjectGetValueByTime function), not Object Property.

In order to receive the object value  on a different chart which code should be used?

In this link  https://docs.mql4.com/objects/objectgetvaluebytime  written  "a synchronous call is used"....

I don't have any idea about the synchronous call in mql4. do you know what is this? and how can I solve my problem?

I just want to get an object value of a chart from other chart. How can I do it?!(object value, not object property!)

I just used ObjectGetDouble() as an example but the same applies to any other ObjectGet function. My answer is still the same and valid so read it again and follow the links to the documentation and look at the examples:

double  ObjectGetValueByTime(
   long       chart_id,      // chart ID
   string     object_name,   // object name
   datetime   time,          // time
   int        line_id=0      // line ID
   );
 
Fernando Carreiro:

I just used ObjectGetDouble() as an example but the same applies to any other ObjectGet function. My answer is still the same and valid so read it again and follow the links to the documentation and look at the examples:


I have two charts, I run the EA in first and then go to the next chart. when I select the other chart, the function related to" object get value" does not work correctly and return the old value of object when I selected it's chart. So always I have to select one chart? that's not true situation. please help :(

 
pouya.star: I have two charts, I run the EA in first and then go to the next chart. when I select the other chart, the function related to" object get value" does not work correctly and return the old value of object when I selected it's chart. So always I have to select one chart? that's not true situation. please help :(
So then show your code attempt so we can see what might be wrong! Also, show screenshots and explain the situation in more detail.
 
Fernando Carreiro:
So then show your code attempt so we can see what might be wrong! Also, show screenshots and explain the situation in more detail.

Dear Fernando, I found the problem. As I said previously, I'm working with several charts at the same time. There are  several objects(for ex. regression channel or etc.) inside charts and their sub-windows and each object is moving each time a new candle is formed. So object values are updated dynamically with ticks. But there is a problem in getting values. I found out when a chart is minimized in MT4 platform, it's object values are not updated and have their old values as long as the respective chart is minimized. So I can solve this problem with cascaded windows arrangement.

If you have any idea about this problem, please explain for me. 

Thank you for the time you spend for me. :)

Reason: