MT4-Tester VS MT5-Tester - page 6

 
Alain Verleyen:

But your original version with build 1596 is far slower so your original comparison with MT4 must be updated.

You may be using an old version of the library. You can always find the latest version here.


Converted your code to MT4 through MT5Bridge. MT4build1072

EURUSD,M1: 1865415 tick events (7292 bars, 1865515 bar states) processed in 0:00:07.645 (total time 0:00:08.362)


Original Code

EURUSD,M1: 1865415 tick events (7292 bars, 1865515 bar states) processed in 0:00:03.744 (total time 0:00:04.493)


Results after conversion are identical! Speed has dropped by half.

 
Yuriy Zaytsev:

it makes more sense to write an optimal algorithm!

How?
 
-Aleks-:

How?
Get the required data once per cycle. Cycle only when needed, not on every tick.
 
-Aleks-:

How to do this?
Get the history at the start, once and remember it.
Then , monitor only the orders that come into the history.
 
Artyom Trishkin:
Once per cycle get the necessary data. Cycle only when needed, not on every tick.

My EA only works on opening prices. The bigger the story the slower it works - times slower.

 
Yuriy Zaytsev:
Get the history at startup, once and remember it.
Then , monitor only the orders coming into the history.

The tester has no history at startup...
 
-Aleks-:

When you start, the tester has no history.

If we are talking about the tester only, of course there isn't one.

In any case, you should not go through the whole history on every tick or even on every bar.

If the test is carried out on ticks, then it is enough to select only one order entered into the history.

-Aleks-:

My Expert Advisor works only with opening prices. The larger the history, the slower it works.


If the test is on bars, several orders may have entered the history, which means that only these orders need to be traced.

 
-Aleks-:

My EA only works on opening prices. The bigger the story the slower it works - times slower.

In the history list the more closed positions, the longer the cycle. Limit the cycle to a small enough depth of history.
 
Artyom Trishkin:
The more closed positions in the history list, the longer the cycle. Limit the cycle to a small enough depth of history.


I have a suspicion that the tester starts to slow down not from the orders themselves, but from their modification - this process happens on every bar.


Yuriy Zaytsev:

If we are speaking only about the tester, of course it does not exist.

In any case, you shouldn't go through the entire history on every tick, or even on every bar.

If the test is run on ticks - then it is enough to select only one order entered into the history.


If the test is on bars - several orders may have entered the history, which means that only these orders must be traced.


I seldom go through the history - the slowdown is due to the accumulation of history as such - as I see it.

If you could get information about the order number by its date (the first number in that date), then the large overshoot could be avoided - go through the orders by the number falling within the range.

 
-Aleks-:


I have a suspicion that the tester starts to slow down not because of the orders themselves but because of their modification - this process takes place on each bar.



I rarely go through the history - the slowdown is due to the accumulation of history, as such - to my senses.

If it were possible to obtain information about the order number by its date (the first number in this date), then the large overshoot could be avoided - to search for orders by the number falling within the range.

bool  HistorySelect(datetime  from_date, // с даты 
                    datetime  to_date);  // по дату


Reason: