Download MetaTrader 5

Question about multi-currency EAs. Why are there so few robots based on the event OnTimer()?

To add comments, please log in or register
Jordi Bassaganas
3532
Jordi Bassaganas 2013.08.30 10:19 
Is it a good idea developing an EA relying on this event? There is not much documentation explaining this. Maybe it's not ok? Thks.
Ubzen
5394
Ubzen 2013.08.30 15:59  
laplacianlab: Is it a good idea developing an EA relying on this event? There is not much documentation explaining this. Maybe it's not ok? Thks.
Probably because not allot of people create multi-currency experts.
Jordi Bassaganas
3532
Jordi Bassaganas 2013.08.30 16:18  
Ubzen:
Probably because not allot of people create multi-currency experts.

Thks! Ok I see.. I ask because if you read the article The Implementation of a Multi-currency Mode in MetaTrader 5 it seems that maybe the OnTimer() function is not ok. Indeed, all multi-currency examples I've seen here use some other event handlers discussed in that article (OnChartEvent(), OnChartCalculate(), etc.). Is there some multi-currency example working with OnTimer()? Is that a good approach? I think that it may be a good approach because multi-currency EAs are distributed by definition. Why should you make depend your EA design on one of the Symbols that your robot may work with? Maybe if you have a good reason to do that..

HongDi s& t development co.,ltd.
1605
hongbin fei 2013.08.30 16:42  
I think it is also same as alone pair.
Uwe Goetzke
1484
Uwe Goetzke 2013.08.30 17:00  

I think that depends on the type of logic you like to implement. If your requirements are ticks for all symbols this might get tricky.

With OnTick I would just collect the ticks for the symbols which may be up to 5 a second for one currency.

From the docs: "All new quotes that are received while the program is running are ignored until the OnTick() is completed. After that the function will run only after a new quote is received."
I assume this is also correct for the OnCalculate indicator way of doing a multi currency EA.

With OnTimer you get regular time slice which gives you control every "x" seconds if your program logic execution time is faster than "x".
From the docs: "If the Timer event is present in the queue or is being processed, the new Timer event will not be placed in the queue of the mql5 program."
This could be the place for the more advanced control logic.


Alain Verleyen
Moderator
31133
Alain Verleyen 2013.08.30 17:27  
codeidea:
I think it is also same as alone pair.
I agree with codeidea, why do you link OnTimer() event handler with multi-currency specifically ?
Simon Gniadkowski
Moderator
18002
Simon Gniadkowski 2013.08.30 18:13  
codeidea:
I think it is also same as alone pair.

You should read the article in the link,  it explains the reason for the question.

New hope with the OnTimer() function

The new capability of the MQL-program to generate the Timer event and the OnTimer() standard event handler, gave hope for the emergence of new types of multi-currency systems. This is due, on the one hand, to the fact that now the multi-currency Expert Advisor/indicator could become independent of the receipt of ticks by the symbol of the current chart, and on the other hand, by the fact that we could monitor the work of the EA by time. But ...

This partially solves the problems described in paragraph 1 of the previous section and, of course, gives some advantages. But just like when you receive the NewTick event, with the receipt of the Timerevent it is necessary to sequentially inquire all of the currency pairs in an attempt to track the changes. Sometimes this has to be done quite often, which can significantly increase the use of resources of the MQL5-programs. 

The issues identified in paragraphs 2 and 3, remain at the same solution level. In addition to this, it is necessary to solve the issues that are specific to the OnTimer() function. For example, the issues of initialization/deinitialization of the timer, its work during weekends, etc.

Without belittling the obvious advantages of the OnTimer() event handler, it must be noted that it still does not allow to implement a full multi-currency mode.

Alain Verleyen
Moderator
31133
Alain Verleyen 2013.08.30 18:52  
RaptorUK:

You should read the article in the link,  it explains the reason for the question.

I read this article. But still the question remains, why OnTimer() would be useful for multi-currency EA only ? In my opinion OnTimer isn't related to multi-currency. The author of this article explore this possibility but came to the conclusion that

it must be noted that it still does not allow to implement a full multi-currency mode.

Some one can also explore the use of OnChartEvent() for multi-currency or any other mql5 capabilities. What should be done is the reverse, which strategy could be based on (or use) OnTimer().

Simon Gniadkowski
Moderator
18002
Simon Gniadkowski 2013.08.30 19:53  
angevoyageur:

I read this article. But still the question remains, why OnTimer() would be useful for multi-currency EA only ? In my opinion OnTimer isn't related to multi-currency. The author of this article explore this possibility but came to the conclusion that

Some one can also explore the use of OnChartEvent() for multi-currency or any other mql5 capabilities. What should be done is the reverse, which strategy could be based on (or use) OnTimer().

The relevance of OnTimer() with multi-currency is because ticks arrive at different times for different symbols,  if the multi-currency EA is put on a symbol that happens to have few ticks during a certain time of day ticks on the other symbols being traded will be missed,  so the OnTimer() event would help address this issue by replacing the need for ticks . . .  although from what is written it doesn't seem to be the desired solution.
Alain Verleyen
Moderator
31133
Alain Verleyen 2013.08.30 20:27  
RaptorUK:
The relevance of OnTimer() with multi-currency is because ticks arrive at different times for different symbols,  if the multi-currency EA is put on a symbol that happens to have few ticks during a certain time of day ticks on the other symbols being traded will be missed,  so the OnTimer() event would help address this issue by replacing the need for ticks . . .  although from what is written it doesn't seem to be the desired solution.

Yes I understood, but that seems to me a weird idea. Either you have a strategy based on tick, and you need ticks for each symbol, either you have a strategy based on new bar and you need to know new bars for each symbol. For multi-currency strategies I found this article a much more interesting solution, at least technically.

Honestly I don't see how OnTimer() could be used advantageously for trading (single or multi currency). What is a strategy based on OnTimer(), how can it work ? It could be very interesting if someone can develop ideas on this base.

Simon Gniadkowski
Moderator
18002
Simon Gniadkowski 2013.08.30 22:50  
angevoyageur:


Honestly I don't see how OnTimer() could be used advantageously for trading (single or multi currency). What is a strategy based on OnTimer(), how can it work ? It could be very interesting if someone can develop ideas on this base.

OnTimer() can be called for each second,  if ticks of the other Symbols are less frequent than that then their ticks will not be missed . . .  I think that is the idea.  I'm not sure it's a good idea but I think that was the plan . . .  or something similar.
12
To add comments, please log in or register