Testing 'CopyTicks' - page 43

 
fxsaber:
Faced with bug when CopyTicksRange returns all requested ticks correctly, but with LastError == ERR_HISTORY_TIMEOUT(4403).


It's not a bug, it's a feature. It's the same with CopyTicks, sometimes. I haven't figured out how to use this "thing" yet.

in the description of the CopyTicksRange function:

ERR_HISTORY_TIMEOUT – время ожидание синхронизации тиков вышло, функция отдала всё что было.

Of course, I would like the developers to explain what this error means when a tick is received with the CopyTicks function. How to handle this error. ps: I call it in an indicator

 

Please advise what data needs to be provided to solve this problem as soon as possible?

void OnStart()
{
  MqlTick Ticks[];

  Print(CopyTicksRange(_Symbol, Ticks, COPY_TICKS_INFO, (ulong)D'2020.04.09 10:40:29' * 1000, (ulong)D'2020.04.11' * 1000)); // 8192
  Print(_LastError); // 4407

  ResetLastError();

  MqlTick Ticks2[];

  Print(CopyTicksRange(_Symbol, Ticks2, COPY_TICKS_INFO, (ulong)D'2020.04.09 10:40:30' * 1000)); // 131066
  Print(_LastError); // 0
}


Tiki is not copying, giving an error.

Constant

Value

Description

ERR_HISTORY_SMALL_BUFFER

4407

Receiving array too small to hold all requested data


It's impossible to work properly with such surprises!


Through the GUI (CTRL+U) the ticks are taken without any problems.

Search string: Oshibka 007.
 
fxsaber:

Please advise what data needs to be provided to solve this problem as soon as possible?

Tiki is not copying, giving an error.

Constant

Value

Description

ERR_HISTORY_SMALL_BUFFER

4407

Receiving array too small to hold all requested data

Tested locally in various ways - so far no playback. Need more details:

1. What version of the terminal?

2. What server are you working with?

3. On which character is the script called?

4. If not called with COPY_TICKS_INFO but with COPY_TICKS_ALL is the error ERR_HISTORY_SMALL_BUFFER also set?

Thank you!

 
Anton:

Tested locally in various ways - so far no playback. Need details:

1. What version of the terminal?

2. What server are you working with?

3. On which character is the script called?

4. If you do not call it with COPY_TICKS_INFO but with COPY_TICKS_ALL will the error ERR_HISTORY_SMALL_BUFFER also be raised?

Thank you!

  1. 2380.
  2. Any server - see point 3.
  3. Custom Symbol.
  4. Flag does not change behavior.

ZS In the trailer is custom. Create symbol from json, import ticks, run script on this symbol's chart. Please write whether or not it reproduced.

Files:
EURUSD.zip  896 kb
 
fxsaber:

Please write whether it played or not.

Yes, it played back on 2380.

Thank you very much! Sorting it out.

 
fxsaber:

  1. 2380.
  2. Any server - see point 3.
  3. Custom symbol.
  4. Flag does not change behaviour.

ZY The trailer is custom. Create symbol from json, import ticks, run script on this symbol's chart. Please write whether it reproduced or not.


Thanks again.

Yes, in 2380 the problem was accidentally introduced and then it was quickly fixed. But it managed to get into build 2380.

Unfortunately since then new builds where all fixed on MetaQuotes-Demo was not yet.

You can either roll back to any previous build or wait for the next build on MetaQuotes-Demo.
 
Anton:
You can either roll back to any previous build or wait for the next build on MetaQuotes-Demo.

Thanks, for now the previous build is for real. The 2380 has done a lot...

 

MT5 latest release build 2361. Attached is a custom symbol. Create a symbol from json, import ticks, run a test on the chart of this symbol.

EA

void OnTick()
{
  MqlTick Tick={0};
  if(SymbolInfoTick(_Symbol,Tick))
  {
    MqlTick OldTicks[];
    Print(CopyTicks(_Symbol,OldTicks,COPY_TICKS_ALL));
    Print(GetLastError());
    Print(CopyTicks(_Symbol,OldTicks,COPY_TICKS_ALL,(ulong)D'2020.04.06 00:00:00' * 1000));
    Print(GetLastError());
  }
  ExpertRemove();
}

Parameters

[Tester]
Expert=test.ex5
Symbol=AUDNZD.RannForex
Period=M1
Optimization=0
Model=4
FromDate=2020.04.08
ToDate=2020.04.09
ForwardMode=0
Deposit=10000000
Currency=USD
ProfitInPips=1
Leverage=100
ExecutionMode=0
OptimizationCriterion=6
Visual=0

1. Netting account.

1.1. With the given dates the output is similar to true: 2000 0 2000 0.

1.2. When the dates are changed to 07.04.2020-08.04.2020 the output becomes strange: -1 4004 1 0.

Firstly, why does the error appear in the first case? Secondly, why does the second case take only 1 tick? The date of the tick request has not changed.

2. Hedge account.

2.1. With the given dates the output becomes strange: 2000 0 1 0.

Why does the second case only take 1 tick? The date of the tick request has not changed.

2.2. When the dates changed to 07.04.2020-08.04.2020 the output will stop strange, but the same: 2000 0 1 0.


Hence questions: why CopyTicks with fixed parameters depends not only on test dates, but also on account type? Or I don't understand something and I'm doing something wrong?

This makes it very difficult to work, please correct if possible. Have you managed to reproduce it? Anything else you need from me to reproduce? Thank you.

Files:
AUDNZD.zip  2448 kb
 
traveller00:

Hence the questions: why does CopyTicks with fixed parameters depend not only on test dates, but also on account type? Or am I misunderstanding something and doing something wrong?

Dependence on account type - you can roughly imagine the reasons. I would not say it is correct. Exchange symbols with last history - the developers need to think well once there, what to do with them on the hedge, etc.

I don't use CopyTicks myself in Tester. The first 24 hours are not important. If you really need clear trading signals, then do not trade the first day.

 
traveller00:

MT5 latest release build 2361. Attached is a custom symbol. Create a symbol from json, import ticks, run the EA on a chart of this symbol.

EA

Parameters

1. Netting account.

1.1. With the given dates the output is similar to true: 2000 0 2000 0.

1.2. When the dates are changed to 07.04.2020-08.04.2020 the output becomes strange: -1 4004 1 0.

Firstly, why does the error appear in the first case? Secondly, why does the second case take only 1 tick? The date of the tick request has not changed.

2. Hedge account.

2.1. With the given dates the output becomes strange: 2000 0 1 0.

Why does the second case only take 1 tick? The date of the tick request has not changed.

2.2. When dates change to 07.04.2020-08.04.2020 the output will stop strange, but the same: 2000 0 1 0.


Hence questions: why CopyTicks with fixed parameters depends not only on test dates, but also on account type? Or I don't understand something and I'm doing something wrong?

This makes it very difficult to work, please correct if possible. Have you managed to reproduce it? Anything else you need from me to reproduce? Thank you.

The very first run. Looking at the tester logs.

2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex: symbol to be synchronized
2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex: symbol synchronized, 3720 bytes of symbol info received
2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex: load 23 Kb of history data to synchronize in 0:00:00.009
2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex: history synchronized from 2020.04.06 to 2020.04.08
2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex: ticks synchronization started
2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex: load 567 Kb of tick data to synchronize in 0:00:00.031
2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex: history ticks synchronized from 2020.04.08 to 2020.04.08
2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex,M1: history cache allocated for 3897 bars and contains 2868 bars from 2020.04.06 00:05 to 2020.04.07 23:59
2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex,M1: history begins from 2020.04.06 00:05
2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex,M1 (MetaQuotes-Demo): generating based on real ticks
2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex,M1: testing of Experts\test.ex5 from 2020.04.08 00:00 to 2020.04.09 00:00 started
2020.04.21 10:53:10.573 Core 01 AUDNZD.RannForex : real ticks begin from 2020.04.08 00:00:00
2020.04.21 10:53:10.573 Core 01 2020.04.08 00:01:11   -1
2020.04.21 10:53:10.573 Core 01 2020.04.08 00:01:11   4004
2020.04.21 10:53:10.573 Core 01 2020.04.08 00:01:11   1
2020.04.21 10:53:10.573 Core 01 2020.04.08 00:01:11   0
2020.04.21 10:53:10.573 Core 01 2020.04.08 00:01:11   ExpertRemove() function called
2020.04.21 10:53:10.573 Core 01 removed itself within OnTick

The tester synchronised the ticks for just one day, for 8 April. That is, there are no ticks before April 8.

At the beginning we got error 4004 (not enough memory for the requested ticks). This is an invalid message, we'll look into it. It seems to be because the request with default parameters is on the boundary of existing ticks

The next query quite rightly gave you 1 tick. Because from 2020.04.06 00:00:00 until the current tester, when the first tick arrived, there is only one existing tick.

Let's adjust the EA a little bit

void OnTick()
  {
   MqlTick Tick= {0};
   if(SymbolInfoTick(_Symbol,Tick))
     {
      MqlTick OldTicks[];
      Print(CopyTicks(_Symbol,OldTicks,COPY_TICKS_ALL));
      if(GetLastError()!=0)
         return;
      Print(GetLastError());
      Print(CopyTicks(_Symbol,OldTicks,COPY_TICKS_ALL,(ulong)D'2020.04.06 00:00:00' * 1000));
      Print(GetLastError());
     }
   ExpertRemove();
  }

and we see, that from the second tick, the ticks have started to be picked up. In both cases it is 2 ticks.

2020.04.21 11:14:13.256 Core 01 AUDNZD.RannForex : real ticks begin from 2020.04.08 00:00:00
2020.04.21 11:14:13.256 Core 01 2020.04.08 00:01:11   -1
2020.04.21 11:14:13.256 Core 01 2020.04.08 00:01:19   2
2020.04.21 11:14:13.256 Core 01 2020.04.08 00:01:19   0
2020.04.21 11:14:13.256 Core 01 2020.04.08 00:01:19   2
2020.04.21 11:14:13.256 Core 01 2020.04.08 00:01:19   0
2020.04.21 11:14:13.256 Core 01 2020.04.08 00:01:19   ExpertRemove() function called

That is, the assumption of the request error at the tick boundary has proven to be correct.

Let's change the start date to April 7.

2020.04.21 11:18:17.775 Core 01 AUDNZD.RannForex: history ticks synchronized from 2020.04.07 to 2020.04.08
2020.04.21 11:18:17.775 Core 01 AUDNZD.RannForex,M1: history cache allocated for 3486 bars and contains 1429 bars from 2020.04.06 00:05 to 2020.04.06 23:59
2020.04.21 11:18:17.775 Core 01 AUDNZD.RannForex,M1: history begins from 2020.04.06 00:05
2020.04.21 11:18:17.775 Core 01 AUDNZD.RannForex,M1 (MetaQuotes-Demo): generating based on real ticks
2020.04.21 11:18:17.775 Core 01 AUDNZD.RannForex,M1: testing of Experts\test.ex5 from 2020.04.07 00:00 to 2020.04.09 00:00 started
2020.04.21 11:18:17.775 Core 01 AUDNZD.RannForex : real ticks begin from 2020.04.07 00:00:00
2020.04.21 11:18:17.775 Core 01 2020.04.07 00:01:28   -1
2020.04.21 11:18:17.775 Core 01 2020.04.07 00:01:28   4004
2020.04.21 11:18:17.775 Core 01 2020.04.07 00:01:28   1
2020.04.21 11:18:17.775 Core 01 2020.04.07 00:01:28   0
2020.04.21 11:18:17.775 Core 01 2020.04.07 00:01:28   ExpertRemove() function called
2020.04.21 11:18:17.775 Core 01 removed itself within OnTick

All the same, except for the fact that the ticks are synchronized for 2 days already - the tester database contains ticks for April 7 and 8.

We set the start date back to April 8. And we see the expected result

2020.04.21 11:20:51.257 Core 01 AUDNZD.RannForex: load 47 bytes of history data to synchronize in 0:00:00.000
2020.04.21 11:20:51.257 Core 01 AUDNZD.RannForex: history synchronized from 2020.04.06 to 2020.04.08
2020.04.21 11:20:51.257 Core 01 AUDNZD.RannForex: ticks synchronization started
2020.04.21 11:20:51.257 Core 01 AUDNZD.RannForex: load 54 bytes of tick data to synchronize in 0:00:00.000
2020.04.21 11:20:51.257 Core 01 AUDNZD.RannForex: history ticks synchronized from 2020.04.07 to 2020.04.08
2020.04.21 11:20:51.257 Core 01 AUDNZD.RannForex,M1: history cache allocated for 3897 bars and contains 2868 bars from 2020.04.06 00:05 to 2020.04.07 23:59
2020.04.21 11:20:51.257 Core 01 AUDNZD.RannForex,M1: history begins from 2020.04.06 00:05
2020.04.21 11:20:51.257 Core 01 AUDNZD.RannForex,M1 (MetaQuotes-Demo): generating based on real ticks
2020.04.21 11:20:51.257 Core 01 AUDNZD.RannForex,M1: testing of Experts\test.ex5 from 2020.04.08 00:00 to 2020.04.09 00:00 started
2020.04.21 11:20:51.257 Core 01 AUDNZD.RannForex : real ticks begin from 2020.04.07 00:00:00
2020.04.21 11:20:51.257 Core 01 2020.04.08 00:01:11   2000
2020.04.21 11:20:51.257 Core 01 2020.04.08 00:01:11   0
2020.04.21 11:20:51.257 Core 01 2020.04.08 00:01:11   2000
2020.04.21 11:20:51.257 Core 01 2020.04.08 00:01:11   0
2020.04.21 11:20:51.257 Core 01 2020.04.08 00:01:11   ExpertRemove() function called
2020.04.21 11:20:51.257 Core 01 removed itself within OnTick

Because there are more ticks in the tester than in the very first run. And it has nothing to do with hedging and netting.

Reason: