Timer - page 5

 
Yedelkin:
Oh, light at the end of the tunnel! You should call the EventSetTimer() inside of OnTimer() itself? I will definitely try it when I get to the terminal. Thanks for the smart solution!

I've seen this solution all along.

I just haven't tried the best way to

EventKillTimer() or EventSetTimer(0); to kill the timer.

 
MetaDriver:

Milliseconds is very much desired. I join in the wishes.

It's dangerous in Expert Advisor now. For example, the synchronous MessageBox() function may quickly queue up when the user leaves the terminal (of course, you may say that the timer can be disabled before such functions).

But if they made interrupt handling...

Документация по MQL5: Общие функции / MessageBox
Документация по MQL5: Общие функции / MessageBox
  • www.mql5.com
Общие функции / MessageBox - Документация по MQL5
 
stringo:

It's no longer possible to go to milliseconds.

How many Expert Advisors that have already been written will start generating 1000 times more timer events than intended by the author?

No, no... You don't need to change it like that. You just need to add a new function EventSetTimerMS(long ms);

It is necessary to leave the old one, just for compatibility. (It can be easily emulated by calling EventSetTimerMS(1000); )

Документация по MQL5: Работа с событиями / EventSetTimer
Документация по MQL5: Работа с событиями / EventSetTimer
  • www.mql5.com
Работа с событиями / EventSetTimer - Документация по MQL5
 
Yurich:

This is now dangerous in the Expert Advisor. For example, synchronous MessageBox() function can quickly queue up when the user leaves the terminal (of course, you can say that the timer can be disabled before such functions).

If only they made interrupt handling...

Don't use interruptions. I don't know what you mean though, maybe it's a good one... :)

About queues - seconds can also be used, if you go to sleep. :) Don't use it if you don't know how to process consequences - it's a simple recipe and universal.

 
Yurich:

......... The synchronous MessageBox() function, for example, can quickly queue up when the user steps away from the terminal.(Of course, you can say that you can disable the timer before such functions) ........

Of course I will. ;)
 
With milliseconds you could try to measure the time between ticks, if less than 500 ms the market is about to start moving.
 
stringo:

How many already written EAs will start generating 1000 times more timer events than the author intended?

Just an opinion: and if there is the very possibility to add milliseconds for those who want it, and the snag is only in old EAs, then why not introduce a new function

   bool EventSetTimer(
                    int  seconds,            // количество секунд для OnTimer
                    bool переключатель=false // переключатель: false - период измеряется в секундах, true - в миллисекундах
                   );

Make everything multi-second, and if the switch==false, multiply the value of seconds once by 1000 (for old EAs, for example).

 
Yurich:

This is now dangerous in the Expert Advisor. For example, synchronous MessageBox() function can quickly queue up when the user leaves the terminal (of course, you can say that the timer can be disabled before such functions).

But if they made interrupt handling...


OnTimer, OnTick, OnTrade... These are the interrupts.

 
pusheax:

OnTimer, OnTick, OnTrade... These are interruptions.

An interrupt is when OnTick is executing and a more important event, such as OnTimer, has arrived. OnTick is paused, OnTimer code is executed and then OnTick continues to run again.
 
Yurich:
An interruption is when OnTick is being executed and a more important event, such as OnTimer, has arrived. OnTick is paused, OnTimer code is executed, then OnTick continues to run again.
This is how it works.
Reason: