Download MetaTrader 5

OnTick and OnCalculate , which be execute first?

To add comments, please log in or register
HongDi s& t development co.,ltd.
1606
hongbin fei  

 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
617
hasayama  
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.
1606
hongbin fei  
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
12164
Rashid Umarov  

Put function Print in both program and see log.

HongDi s& t development co.,ltd.
1606
hongbin fei  
Rosh:

Put function Print in both program and see log.

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

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

Use GetTickCount()

Second. Which print is first? From what program?

Alexey Da
Moderator
6601
Alexey Da  
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
617
hasayama  
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