MetaTrader 4 and MetaTrader 5 Memory and Data Loading Management Comparison - page 9

 
Alain Verleyen:

How serious is that ? You are sarcastic and in the next sentence you ask "politely"... MT5 developers aren't reading this forum fortunately.

I don't want to offend anyone, but really guys all you are demonstrating here is your incompetency to work with mql5. These data you posted are when the platform is started, how much time are you starting your platform ? Anyway it's easy to deal with it.

I don't have time now to answer with objective data and information but I will.


Every one here of course appreciate the new approaches from MetaTrader 5 Platform. So do not get me wrong.

They release a lot of new features every week and every month. That is good thing and respectful.

I will never use any other platform like TradingView or cTrader because they are no where near MetaTrader in term of indicator and tool creation.

As I mentioned, 95% of us here are simple minded not tech savvy.

We just hope MT5 data management is as easy as MT4.

 
Young Ho Seo:


Yes, I tried many different ways too. That is why I made this thread because I suffered with this enough.

Eventually, developing tactics to avoid the empty matrix of data become more work than actually writing the algorithm or coding for the original task.

Another thing is that for different algorithm or task, you have to also change your tactics too. It is not impossible but just time consuming every time dealing with this.


In fact, I set 10 second timer in my code. You can tell that there was 30 seconds waiting for the data loaded fully in MT5.

MT4 was just reliable getting all data in first iteration so 12 seconds it took. This make our coding as developer so much easier.

I am politely asking if MT5 development team can take this point on board.


================================================================================================

This testing results just speaks for it.

A second remark about MT5 when the test is initiated by starting the platform :

2018.12.08 20:19:35.533    293936    Counter: 0, Symbol: CADCHF, M1: -1, M5: -1, M15: -1, M30: -1, H1: -1, H4: -1, D1: -1, W1: -1, MN1: -1
2018.12.08 20:19:35.555    293936    Counter: 0, Symbol: EURGBP, M1: -1, M5: -1, M15: -1, M30: -1, H1: -1, H4: -1, D1: -1, W1: -1, MN1: -1
2018.12.08 20:19:35.561    293936    Counter: 0, Symbol: EURJPY, M1: -1, M5: -1, M15: -1, M30: -1, H1: -1, H4: -1, D1: -1, W1: -1, MN1: -1
2018.12.08 20:19:35.561    293936    Counter: 0, Symbol: EURUSD, M1: 500, M5: -1, M15: -1, M30: -1, H1: -1, H4: -1, D1: -1, W1: -1, MN1: -1
2018.12.08 20:19:35.575    293936    Counter: 0, Symbol: GBPJPY, M1: -1, M5: -1, M15: -1, M30: -1, H1: -1, H4: -1, D1: -1, W1: -1, MN1: -1
2018.12.08 20:19:35.585    293936    Counter: 0, Symbol: GBPUSD, M1: -1, M5: -1, M15: -1, M30: -1, H1: -1, H4: -1, D1: -1, W1: -1, MN1: -1
2018.12.08 20:19:35.593    293936    Counter: 0, Symbol: NZDCAD, M1: -1, M5: -1, M15: -1, M30: -1, H1: -1, H4: -1, D1: -1, W1: -1, MN1: -1
2018.12.08 20:19:35.610    293936    Counter: 0, Symbol: USDCAD, M1: -1, M5: -1, M15: -1, M30: -1, H1: -1, H4: -1, D1: -1, W1: -1, MN1: -1
2018.12.08 20:19:35.622    293936    Counter: 0, Symbol: USDCHF, M1: -1, M5: -1, M15: -1, M30: -1, H1: -1, H4: -1, D1: -1, W1: -1, MN1: -1
2018.12.08 20:19:35.632    293936    Counter: 0, Symbol: USDJPY, M1: -1, M5: -1, M15: -1, M30: -1, H1: -1, H4: -1, D1: -1, W1: -1, MN1: -1

The first iteration only grab some data for the current open chart.

It's only at the 4th iterations, that all data are available. It's clearly a weakness of MT5.

2018.12.08 20:20:05.501    293936    Counter: 3, Symbol: CADCHF, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 143
2018.12.08 20:20:05.501    293936    Counter: 3, Symbol: EURGBP, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 308
2018.12.08 20:20:05.501    293936    Counter: 3, Symbol: EURJPY, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 240
2018.12.08 20:20:05.501    293936    Counter: 3, Symbol: EURUSD, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 240
2018.12.08 20:20:05.501    293936    Counter: 3, Symbol: GBPJPY, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 240
2018.12.08 20:20:05.502    293936    Counter: 3, Symbol: GBPUSD, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 240
2018.12.08 20:20:05.502    293936    Counter: 3, Symbol: NZDCAD, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 137
2018.12.08 20:20:05.502    293936    Counter: 3, Symbol: USDCAD, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 240
2018.12.08 20:20:05.502    293936    Counter: 3, Symbol: USDCHF, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 240
2018.12.08 20:20:05.502    293936    Counter: 3, Symbol: USDJPY, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 240

This clearly doesn't happen on MT4 :

2018.12.08 20:20:12.638    293936 EURUSD,M1: Counter: 0, Symbol: CADCHF, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 256
2018.12.08 20:20:12.638    293936 EURUSD,M1: Counter: 0, Symbol: EURGBP, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 256
2018.12.08 20:20:12.638    293936 EURUSD,M1: Counter: 0, Symbol: EURJPY, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 256
2018.12.08 20:20:12.638    293936 EURUSD,M1: Counter: 0, Symbol: EURUSD, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 256
2018.12.08 20:20:12.638    293936 EURUSD,M1: Counter: 0, Symbol: GBPJPY, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 379, MN1: 88
2018.12.08 20:20:12.638    293936 EURUSD,M1: Counter: 0, Symbol: GBPUSD, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 256
2018.12.08 20:20:12.654    293936 EURUSD,M1: Counter: 0, Symbol: NZDCAD, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 454, MN1: 107
2018.12.08 20:20:12.654    293936 EURUSD,M1: Counter: 0, Symbol: USDCAD, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 256
2018.12.08 20:20:12.654    293936 EURUSD,M1: Counter: 0, Symbol: USDCHF, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 256
2018.12.08 20:20:12.654    293936 EURUSD,M1: Counter: 0, Symbol: USDJPY, M1: 500, M5: 500, M15: 500, M30: 500, H1: 500, H4: 500, D1: 500, W1: 500, MN1: 256

Yeah but with one chart (one symbol, one timeframe), one iteration is enough ; it is downloaded progressively. I didn't work a lot with MT4 but I would say it's likely it downloads the M1 and recalculates everything from it while MT5 really redownloads symbol by symbol, timeframe by timeframe. This needs a fact-check (there's people reading for whom it's a speciality) :)

The timer is definitively the more convenient way to do it, but then it shouldn't stop before all datas are received, recounted and validated - I meant relatively to your example, called at iteration 1 & wait for matrix being fulfilled before iteration 2 otherwise you'll then work with a wild timer which will execute even when not needed - that is expensive in memory. 

 

Metaquotes already worked on speed optimization. I am really happy with it.

Forum on trading, automated trading systems and testing trading strategies

New version of MetaTrader 5 build 1930: Floating graphs and .Net libraries in MQL5

Renat Fatkhullin , 2018.12.10 19:31

New results after today's optimizations, which will be available in the next beta version the other day:

MT4
MT5
Cold start
 5 symbols, 100000 max bars:
    EURUSD
    USDCHF
    USDCAD
    GBPUSD
    USDJPY
Iteration 1 : took 36085 msc for 5 symbols
Iteration 2 : took 155 msc for 5 symbols
...
Iteration 100 : took 138 msc for 5 symbols
Total: 51442 msc

 5 symbols, 100000 max bars:
    EURUSD
    USDCHF
    USDCAD
    GBPUSD
    USDJPY
Iteration 1: took 552687 msc for 5 symbols
Iteration 2: took 307995 msc for 5 symbols
...
Iteration 100: took 125 msc for 5 symbols
Total: 874137 msc  (было 1434053 msc)

Hot start
Iteration 1 : took 235 msc for 5 symbols
Iteration 2 : took 138 msc for 5 symbols
...
Iteration 100 : took 136 msc for 5 symbols
Total: 15524 msc

Iteration 1: took 273 msc for 5 symbols
Iteration 2: took 128 msc for 5 symbols
...
Iteration 100: took 123 msc for 5 symbols
Total: 13772  msc (было 21456 msc)

Hot on CopyRates MT5 overtaken MT4 by 2 ms. optimization succeeded.

I forgot to immediately explain an important feature of data storage bars in MT5. In MT5, bars are stored as separate arrays of Open, High, Low, Close, Volume. This means that in order to create the MqlRates bar in the CopyRates function, we need to assemble the structure of the price bar from a variety of arrays.

This is obviously more expensive than simply issuing a ready bar, as is available in MT4. But we did it faster.


Why do we have data arrays in MT5? Because it is more efficient to work and especially for individual functions CopyClose , CopyHigh, High [], Low [] and so on. There are many places where specific indicators are used without the need to refer to the entire bar.

Let's compare CopyHigh access speed in both systems. We will immediately check the hot caches:

MT4
MT5
Hot Start CopyHigh
10,230 msc
2,862 msc

Here the advantage of Metatrader 5 is clearly visible: it releases data from individual timeseries 3.5 times faster.

Tip: do not copy the bars in the top five, if you want to have only one indicator. Do not translate one to one code of four.


 
Alain Verleyen:

Metaquotes already worked on speed optimization. I am really happy with it.


Exactly that !  

I forgot to immediately explain an important feature of data storage bars in MT5. 
In MT5, bars are stored as separate arrays of Open, High, Low, Close, Volume. 
This means that in order to create the MqlRates bar in the CopyRates function, we need to assemble the structure of the price bar from a variety of arrays.
This is obviously more expensive than simply issuing a ready bar, as is available in MT4. But we did it faster. 
Reason: