Download MetaTrader 5

OnTick and OnCalculate , which be execute first?

To add comments, please log in or register
Have you published a program in the Market? Place it in your blog as well - the widget will help!
HongDi s& t development co.,ltd.
1598
hongbin fei 2010.10.20 09:13 

 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 

hasayama
610
hasayama 2010.10.20 14:48  
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.
HongDi s& t development co.,ltd.
1598
hongbin fei 2010.10.21 09:21  
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.
Rashid Umarov
Admin
11812
Rashid Umarov 2010.10.21 09:57  

Put function Print in both program and see log.

HongDi s& t development co.,ltd.
1598
hongbin fei 2010.10.21 19:04  
Rosh:

Put function Print in both program and see log.

I use pring(TimeCurrent), they always same value printed
Slawa
Moderator
6839
Slawa 2010.10.21 19:36  

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

Use GetTickCount()

Second. Which print is first? From what program?

Alexey Da
Moderator
6599
Alexey Da 2010.10.21 19:38  
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.
hasayama
610
hasayama 2010.10.21 21:53  
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.
To add comments, please log in or register