Custom symbol creation results in large hcc file

 

I've been testing some simple code, which creates custom symbol. Code also calculates 300 bars and saves them -> updates rates.

Every bar is saved as MqlRates structure, which should hold 60 bytes of data (8 bytes datetime, OHLC 4x8 bytes, tickvolume 8 bytes, spread 4 bytes, real volume 8 bytes).

When I execute my code, 300 test bars/candles is successfully saved. I have manually checked custom symbol in the symbol list and everything is correct.

The problem is the size of the .hcc history file, which is created for custom symbol. The file was the size of 1.92 Mb.

The size is 100x more then it should be. Real size should be -> 60 x 300 = 18000 ->  0.018 MB + a couple hundred bytes of data for file header.

This specific example only saves 300 bars, if I was saving 10000 or more, the size would be in hundreds of MB or even GB.

I am aware, that file size is reduced, after the creation of cache for M1. Cached M1.hc file size is correct size of about 0.018 MB.


Is there some step I am missing in the process of custom symbol creation or is this massive error in MQL language?

The size of this temp .hcc files is unacceptable, unnecessary and dangerous for disk health, if used on regular basis.

 

I was wrong, the file remains the same size, even after cache for M1 is created.

Why is 100 times more data being saved for each bar and what is even being saved? 

One bar has 60 bytes of information, yet 600 bytes is saved. What is even in that additional 540 bytes?

There is clearly some error with CustomRatesUpdate().

Reason: