OnTick and OnCalculate , which be execute first?

 

 If I call an indicator form an expect, the event OnTick of the expert and  OnCalculate of the indicator , which be execute first?

 thanks

 

hongbin.fei 

 
codeidea:

 If I call an indicator form an expect, the event OnTick of the expert and  OnCalculate of the indicator , which be execute first?

 thanks

 

hongbin.fei 

I believe that when you call indicator from expert it will be calculated independently from any indicator on the chart right at the moment of call. So, you'll get data which is accurate for the moment of your call.
How to call indicators in MQL5
  • 2010.03.12
  • KlimMalgin
  • www.mql5.com
With new version of MQL programming language available not only the approach of dealing with indicators have changed, but there are also new ways of how to create indicators. Furthermore, you have additional flexibility working with indicator's buffers - now you can specify the desired direction of indexing and get exactly as many indicator's values as you want. This article explains the basic methods of calling indicators and retrieving data from the indicator's buffers.
 
hasayama:
I believe that when you call indicator from expert it will be calculated independently from any indicator on the chart right at the moment of call. So, you'll get data which is accurate for the moment of your call.
my indicator draws object only , not use buffer not all, so I must need know who is first be executed.
 

Put function Print in both program and see log.

 
Rosh:

Put function Print in both program and see log.

I use pring(TimeCurrent), they always same value printed
 

TimeCurrent() returns last known server time. TimeLocal() is useless too.

Use GetTickCount()

Second. Which print is first? From what program?

 
codeidea:
I use pring(TimeCurrent), they always same value printed
Add something into output that helps you to understand which line was printed by indicator and which line was printed by EA.
 
I tried to test with print messages, it looks like Indicator is first to be called. And I believe it is the right way to handle this, indicators information always should be up to date.