27 lines
1.1 KiB
MQL5
27 lines
1.1 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| sort_MqlRates.mq5 |
|
|
//| Copyright © 2025, Amr Ali |
|
|
//| https://www.mql5.com/en/users/amrali |
|
|
//+------------------------------------------------------------------+
|
|
#include "Introsort.mqh"
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| custom comparison functions Less. |
|
|
//+------------------------------------------------------------------+
|
|
bool Less(MqlRates &a, MqlRates &b)
|
|
{ return a.open < b.open; }
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
void OnStart()
|
|
{
|
|
MqlRates Rates[];
|
|
|
|
CopyRates(_Symbol, PERIOD_CURRENT, 0, 5, Rates);
|
|
ArrayPrint(Rates);
|
|
|
|
Introsort(Rates);
|
|
ArrayPrint(Rates);
|
|
}
|
|
//+------------------------------------------------------------------+
|