Errors, bugs, questions - page 1564

 
Anton Zverev:

iCustom+IndicatorRelease. It's probably not a crutch solution to produce complex entities on the spot. There's no arguing about tastes. The question is how much such a crutch on multiple agents will go to waste resources.

Well almost everything is cool in 5. Speed is top-notch. And here, sorry, some total hairiness where you wouldn't expect.

Why make a release indicator?

Let it send a chart-event to the expert under test on every new tick.

Creating an indicator on every tick followed by a release - that's where the wasted resources are

 
Anton Zverev:

Vasiliy mentioned that on FORTS (not in the tester) the mechanism works via subscription and BookEvent. This eliminates the need to link the EA to any chart at all.

BookEvent is not yet implemented in the tester
 
Slawa:

Why make a release to an indicator?

Let it send a chart-event to the expert under test on every new tick.

Creating an indicator at every tick and then releasing it - that's a waste of resources

I'm not very good at expressing myself, so you don't understand. Click here for details https://www.mql5.com/ru/code/280

And how many resources does this solution consume to implement such a simple thing!

Мультивалютный обработчик событий OnTick(string symbol)
Мультивалютный обработчик событий OnTick(string symbol)
  • votes: 27
  • 2011.02.01
  • Konstantin Gruzdev
  • www.mql5.com
Упрощенная реализация полноценного мультивалютного режима в MetaTrader 5. Нет необходимости вникать в то, как это работает. Минимум простых настроек. Максимум удобства для пользователей. Работает в тестере.
 
Slawa:
BookEvent has not yet been implemented in the tester
So, what's the use of it in the tester if it doesn't even work in the forex market? Vasiliy made what I think is a sensible suggestion above.
 
Slawa:

And do not loop for a second, but for just under an hour. With obligatory checking of IsStopped()

Sleep, by the way, is mandatory. Otherwise you will hang the tester. And the system's resources will be ravaged during normal operation of the Expert Advisor.

Do not even test your variant

2016.04.26 19:39:05     Core 1  2016.04.25 00:16:48   infinite Sleep loop detected while testing
2016.04.26 19:39:05     Core 1  EURUSD : 2016.04.25 00:00 - 2016.04.26 00:00  1439 minute bars absent in total while real ticks present
2016.04.26 19:39:05     Core 1  EURUSD : real ticks begin from 2016.01.04 00:00:00
2016.04.26 19:39:05     Core 1    SleepPause=10
2016.04.26 19:39:05     Core 1    TimerInterval=1000

Code

sinput uint TimerInterval = 1000; // Через сколько секунд вызывать OnTimer
sinput uint SleepPause = 10;      // На сколько милисекунд делать Sleep
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnInit()
  {
   EventSetTimer(TimerInterval);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTimer()
  {
   const uint Amount=TimerInterval*1000/SleepPause;

   for(uint i=0;(i<Amount) && (!IsStopped()); i++)
      Sleep(SleepPause);
  }
//+------------------------------------------------------------------+
 
Anton Zverev:

Not even to test your option

Code

And what were you testing here?
 
Slawa:
And what were you testing here?
I run that code in the tester. I get a hang withinfinite Sleep loop detectedwhile testing.
 
Anton Zverev:
I launch that code in the tester. I get hangs withinfinite Sleep loop detected while testing.

It has been said many times: "Read the documentation".

Didn't you say, "I've read all the documentation. Several times"?

Have you read this? It seems you haven't...

If the current time in the tester exceeds the end of the testing period when Sleep() function is executed, you will get an error "an infinite loop in Sleep". If such an error occurs, testing results are not discarded, all calculations are performed in full (amount of trades, drawdown, etc.) and the results are passed to the terminal.

 
Slawa:

Have you read this?

I have and I read it very carefully. The point is that if Sleep is used in OnTimer, the programmer cannot determine when he/she leaves the testing interval. IsStopped (I put it into the code at once because of reading the documentation) does not work at the moment of exit. Whose fault is it?
 
Slawa:

And about missing ticks in the loop in OnTimer you need reproducible evidence. Do you have them?

You wrote about it in documentation!

In the tester, Sleep() calls do not delay the testing process. When calling Sleep(), the generated ticks are "played" within the specified delay, as a result of which pending orders, stops and so on can trigger. After Sleep() has been called, the time modeled in the tester is increased by the interval specified in the Sleep function parameter.

So, the Expert Advisor cannot be called at every one of these ticks. Is the proof accepted?

Reason: