TicksShort - MetaTrader 5 Library | MT5 EA Download - MetaTrader 5 Resources
This library implements work with a tick storage format that has a good performance (read/write) to size ratio.
Only the following fields of original MqlTick are stored :
Structure MQTick { Date time time; // The last price update time doubles the bid; // The current bid doubles the ask; // The current selling price doubles the last; // The current price (Last) of the last transaction Oolong volume; // The trading volume of the current price long time_msc; // Last price update time in milliseconds flags ; // Tick Flags doubled volume_real; // Volume at current price last increased accuracy };
You can view library methods in MetaEditor via the hotkey ALT+M. Here are some examples of their use.
#Property script_show_inputs Input datetime from = D'2024.12.01' ; #include// Short tick storage format. blank start () { MQTick tick[]; // For source ticks. if ( CopyTicksRange ( _token ,ticks, COPY_TICKS_ALL ,( Oolong )inFrom * 1000 ) > 0 ) { FileSave ( "ticks.bin" , ticks); // We saved the normal ticks so we can compare file sizes. TICKS_SHORT::save( "TicksShort.bin" , ticks); // Save quotes in compressed format. MQTick scale 2[]; // Used to squash ticks. TICKS_SHORT::load( "TicksShort.bin" , tick2); // Download quotes in compressed format. print ( "scale=" + double to string (( double ) FileGetInteger ( "ticks.bin" , file size )/ File GetInteger ( "TicksShort.bin" , file size ), 3 )); print ( "correct=" + ( string )TICKS_SHORT::IsEqual(Ticks, Ticks2)); // Comparative. } }
The above script saves quotes to a new format file and loads them from the file.
TicksShort_SaveLoad (EURUSD,M1) ratio = 10.000 TicksShort_SaveLoad (EURUSD,M1) true = true
Output to the log shows a compression ratio of 10x. When uncompressed, the scale matches the original scale.
#Property script_show_inputs Input datetime from = D'2024.12.01' ; #include// Short tick storage format. // Return the size of the array in bytes. Template < type name > Oolong GetSize( constant T&Array[] ) { return (( Oolong ) size (T) * array size (batch)); } // Compression format performance standards. Template < type name T1, type name T2> double standard ( constant T1&decompression[], constant T2&compression[], constant own interval) { Constant double performance = ( double ) array size (decompression) / interval; Return (Performance * (( double )GetSize(decompressed) / GetSize(compressed))); } Blank start () { MQTick tick[]; // For source ticks. if ( copy_ticks ( _token , ticks, COPY_TICKS_ALL , ( Oolong ) in from * 1000 ) > 0 ) { TICK_SHORT Ticks2[]; // For compressed ticks. Oolong interval = get microsecond count (); TICKS_SHORT::Compression(Ticks, Ticks2); // Extrusion. interval = get microsecond count () - interval; Constant double performance = ( double ) array size (ticks) / interval; print ( "Compression Performance:" + Double to String (Performance, 1 ) + "Number of ticks (millions)/second." ); print ( "Compression Performance Standard: " + double to string ( standard (scale, scale2, interval), 1 )); MQTick scale 3[]; // Used to squash ticks. Oolong interval 2 = get microsecond count (); TICKS_SHORT::Unzip(Ticks2, Ticks3); // Not gripped. Interval 2 = Get Microsecond Count () - Interval 2; Constant double performance 2 = ( double ) array size (scale 3) / interval 2; print ( "Decompression performance: " + double to string (( double ) array size (scale 3) / interval 2, 1 ) + "ticks (millions)/second." ); print ( "Decompression performance standard:" + double to string (standard(Ticks3, Ticks2, interval 2), 1 )); print ( "correct=" + ( string )TICKS_SHORT::IsEqual(Ticks, Ticks3)); // Comparative. } }
This script converts the tick source array to a packed array and back. Output performance/efficiency data.
TicksShort_Performance (EURUSD,M1) Compression performance: 67.7 ticks (millions)/second. TicksShort_Performance (EURUSD,M1) Compression performance standard: 677.1 TicksShort_Performance (EURUSD,M1) Decompression performance: 42.1 ticks (millions)/second. TicksShort_Performance (EURUSD,M1) Decompression performance standard: 420.9 TicksShort_Performance (EURUSD,M1) correct = true
Writes and reads are performed at over 40 million ticks per second while preserving original information.
https://www.mql5.com/en/code/30791
Automatic Fibonacci retracement indicator, intelligently detects market fluctuations and draws Fibonacci levels without manual intervention.
Unfortunately, I found that some brokers changed the time on the server a little incorrectly, which I wasn't expecting. This surprised me. Here is a script that anyone can use to check their broker.
The Value Area Retracement Indicator is a powerful tool based on volume profiles designed to identify key trading levels on different time frames - Point of Control (POC), Value Area High (VAH), Value Area Low (VAL) and Profile High/Low. It helps traders spot potential retracement opportunities in POCs, breakout areas, and value areas, making it useful for day trading, swing trading, and position trading.
This expert system can help any trader develop an order grid.
Attachment download
📎ticksshort_saveload.mq5 (1.77 KB)
📎 ticksshort_performance.mq5 (4.58 KB)
📎 tickshort.mqh (6.38 KB)
📎 ticksshort.mqh (20.8 KB)
📎 table.mqh (100 KB)
Source: MQL5 #61126
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •