GZ I P - Decode
Info
The GZ I P - Decode is a Library for MetaTrader 5 that the library allows you to decrypt gzip archives from *. gz files or responses from sites compressed with this format.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Library works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Libraries folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use GZ I P - Decode
1. Storage: Place library files in the MQL/Libraries directory to ensure they are accessible to your projects.
2. Implementation: Include the library in your code using the #import directive, ensuring you match the exact function names and parameters.
3. Compilation: Ensure the library is present in the directory before you compile your main EA or script, as the compiler links them during this phase.
4. Management: Keep libraries organized in sub-folders if you manage many custom functions to maintain a clean project structure.
Frequently Asked Questions
Q: What is a library file used for? A: Libraries store reusable code modules, allowing you to centralize common logic used by multiple EAs or indicators.
Q: Is a library executable? A: No, libraries are non-executable files containing functions; they must be imported into an EA, indicator, or script to function.
Q: Can I update a library while the platform is running? A: You should compile your EA or script after updating a library to ensure the latest code changes are integrated.
What this tool does
The library allows you to decrypt GZIP archives from *.
Typical Use Case
This Library excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Library works on MetaTrader 5. Place the file in the MQL5/Libraries folder and restart the terminal.
Description & Settings
Related: Trading signals module based on Price Channel Stop indicator - another powerful library for MetaTrader 5 traders.
Also recommended: Developing Multicurrency Expert Advisor - source codes from the article series - similar library with strong performance on MetaTrader 5.
The library allows you to decrypt GZIP archives from *.gz files or responses from sites compressed with this format. Tested on files with up to 0.5 GB of text packed in them.The library can automatically check by the flag in the 4th byte whether the archive is a compressed file or compressed data from the site, in the second case there is no file name in the data.
Input data for decompression should be represented in an array of char type.
The terminal function CryptDecode(CRYPT_ARCH_ZIP, tmp, key, tx) is used for decompression;
The GZIP class contains methods:
- checks against the first three characters of the received data to see if it is compressed in GZIP format.
After this check, one of the overloads of the unGZIP method can be called:
the preferred use case in terms of speed and memory consumption. During decompression, the char array tx is filled. Then data from it can be processed by CSV or JSON parser. This way we get the result without gluing the array into a string and then dividing it by strings or other characters.
If you still need to get a string, you can use one of the overloads:
return true if unpacking is successful, the unpacked string is in the string out
or
return string. If unpacking fails, the string will be empty.
Care should be taken when using concatenation of data into a single string. If you unpacked an archive with 0.5GB of data, the string will require another 0.5GB, then you can split it into an array of strings, which will require another 0.5GB. Plus the time cost of all these operations.
Example use case for reading compressed data from a website and then reading from a file: (this script is attached for download)
This example reads a file from the files folder, and decompresses it into an array. The first and last 100 characters from the unpacked file are printed. The array can then be sent to a CSV or JSON parser. For JSON there is JASON library in kodobase. It can parse data received as a char array.
Example of output when unpacking a compressed CSV file of 120 MB, the source file is 463 MB:
Unpacking took about 1.2 seconds.
You may also like: Memory Mapping - excellent alternative for library users on MetaTrader 5.
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.