![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Can it be used for MQLRates too?
No. Besides I think there is no need to compress rates.
No. Besides I think there is no need to compress rates.
i tried. its working
There is need to compress rates because i receive them live from websocket instead of tick
https://www.mql5.com/en/code/38047
i tried. its working
There is need to compress rates because i receive them live from websocket instead of tick
https://www.mql5.com/en/code/38047
Actually, this is another script you crafted yourself, not the tick compressor ;-)
Conversions between double and float DO NOT round-trip, the original ticks will not recovered after decompression.
Conversions between double and float DO NOT round-trip, the original ticks will not recovered after decompression.
It depends on price values. This was already discussed above.
Forum on trading, automated trading systems and testing trading strategies
Scripts: TickCompressor
Stanislav Korotky, 2021.03.27 22:44
Yes, this is inevitable side-effect of the compression, based on type size reduction. A citation:
Float values have between 6 and 9 digits of precision, with most float values having at least 7 significant digits. Double values have between 15 and 18 digits of precision, with most double values having at least 16 significant digits
It depends on price values. This was already discussed above.
mmm, the prices that I compressed were the terminal prices (3 or 5 digits max).
To demonstrate it better:
So, float type cannot be used to pack / restore prices with 5 or less digits that were originally encoded in double-precision. This conversion causes unrecoverable loss of the mantissa bits.
Edit:
For simple calculations on prices, that may not make much difference at the end.
Thanks Stanislav.
mmm, the prices that I compressed were the terminal prices (3 or 5 digits max).
To demonstrate it better:
So, float type cannot be used to pack / restore prices with 5 or less digits that were originally encoded in double-precision. This conversion causes unrecoverable loss of the mantissa bits.
Edit:
For simple calculations on prices, that may not make much difference at the end.
Thanks Stanislav.
In your example, the restored price normalized to number of digits in price is equal to original value (I hope you do not compare doubles with simple '==' operator? this is a wrong approach).
What you're talking about is the fact that all floating point numbers (including double) are stored with limited precision, so even with double you can get incorrect price after simple arithmetic calculations.
There is no such thing like decimal numeric type (with fixed precision) in MQL5.
In your example, the restored price normalized to number of digits in price is equal to original value (I hope you do not compare doubles with simple '==' operator? this is a wrong approach).
What you're talking about is the fact that all floating point numbers (including double) are stored with limited precision, so even with double you can get incorrect price after simple arithmetic calculations.
There is no such thing like decimal numeric type (with fixed precision) in MQL5.
Thanks for the clarification.