Wishes for MT5 - page 39

 
sergey1294:

I wrote this code to catch this situation, but in the tester it categorically refuses to work, while on a demo account it works fine

Let me disbelieve you. Your function will always return true. You can check it, form it as a script and run it right now (at weekend) on any instrument, you will get true.

To make it work as you want, you should replace TimeCurrent() with TimeTradeServer(). Then it will also work in the tester.

But still it does not solve the problem of a closed market, since there are also holidays. For example, the first week finishes at 22:00, the second week at 23:00, while the specs show trading end at 24:00.

 
Valmars:

Let me disbelieve you. Your function will always return true. You can check it, make it as a script and run it right now (on weekend) on any instrument, it will return true.

To make it work as you want, you should replace TimeCurrent() with TimeTradeServer(). Then it will also work in the tester.

But still it does not solve the problem of a closed market, since there are also holidays. For example, the first week finishes at 22:00, the second week at 23:00, and the specification contains the trading end at 24:00.

I agree with you that the completely given example does not solve the problem with the closed market. Of course, I want to have a standard property for the symbol of a closed market to ease writing checks in this direction. I hope the developers will add this feature.
 

I would like to be able to run several timers in one Expert Advisor.

To improve EventSetTimer() so that besides frequency there is timer name, and OnTimer() has a timer name parameter.

Thus it would be possible to call several OnTimer().

 
Urain:

I would like to be able to run several timers in one Expert Advisor.

To improve EventSetTimer() so that besides frequency there is timer name, and OnTimer() has a timer name parameter.

Thus it would be possible to call several OnTimer().


This is nonsense. Set the timer for 1 second and after any intervals you need from the OnTimer distribute the custom events using the EventChartCustom function.

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

This is nonsense. Set the timer to 1 second and from the OnTimer hand out custom events at any desired time intervals using the EventChartCustom function

Hmmm, thanks for the tip.
 
stringo:

This is nonsense. Set the timer to 1 second and distribute the custom events from the OnTimer at any desired time intervals using the EventChartCustom function

No, one OnTimer() will be processed by one thread and several threads by several,

You can cram any long calculations in it and parallel them at that.

 
Urain:

No, one OnTimer() will be handled by one thread and several threads,

You can cram any long calculations into it and still parallelize them.

It will not work. The Expert Advisor will rotate in one and the same thread picking events from the queue. Unlike in Fours where every time a thread was created, a start was executed and then the thread was killed.

Parallelize calculations between different EAs.

 

For example, there are two independent events, one counts for 10 seconds and the other for 15 seconds.

What should one event wait for the other one to count?

Of course, you can put everything in the indicator, but the indicator does not work with a timer,

If you were to introduce a timer-driven indicator, the question would be solved.

I have an idea that allows to choose whether to use OnTick or OnTimer in an indicator.

 
Urain:

You could, of course, put everything in the indicator, but the indicator does not work with the timer,

If you could make the indicator work with a timer, that would solve the problem.

Just do it. Try it.
 
Urain:

For example, there are two independent events, one counts for 10 seconds and the other for 15 seconds.

What do you want one event to wait for the other to count?


Actually, synchronisation has not been cancelled. You do the job, you send the message, "Shew, it's done."