MQLArticles/Utils/EnumsStr/Test.mq5

70 satır
2,2 KiB
MQL5
Ham Kalıcı Bağlantı Normal Görünüm Geçmiş

2026-06-28 13:19:00 -05:00
//+------------------------------------------------------------------+
//| Test.mq5 |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com/"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "Loader.mqh"
2026-06-30 11:39:34 -05:00
#include "..\\Dict\\DictT.mqh"
2026-06-28 13:19:00 -05:00
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
const string values[3]
{
"PERIOD_M10",
"PERIOD_M5",
"PERIOD_MN1"
};
ulong a = GetMicrosecondCount();
for(int i = 0; i < 10000; i++)
{
const int r = MathRand() % 3;
2026-06-28 16:04:40 -05:00
TSN::CEnumRegBasis::GetVal<ENUM_TIMEFRAMES>(values[r], PERIOD_CURRENT);
2026-06-28 13:19:00 -05:00
}
ulong b = GetMicrosecondCount() - a;
2026-06-30 11:39:34 -05:00
Print("Time PH: ", b);
CDictSValue<int> dict;
dict.Add("PERIOD_M1", PERIOD_M1);
dict.Add("PERIOD_M2", PERIOD_M2);
dict.Add("PERIOD_M3", PERIOD_M3);
dict.Add("PERIOD_M4", PERIOD_M4);
dict.Add("PERIOD_M5", PERIOD_M5);
dict.Add("PERIOD_M10", PERIOD_M10);
dict.Add("PERIOD_M6", PERIOD_M6);
dict.Add("PERIOD_MN1", PERIOD_MN1);
int sd;
a = GetMicrosecondCount();
for(int i = 0; i < 10000; i++)
{
const int r = MathRand() % 3;
dict.TryGet(values[r], sd);
}
b = GetMicrosecondCount() - a;
Print("Time Dict: ", b);
2026-06-28 13:19:00 -05:00
// Fast...
/*
2026-06-30 11:39:34 -05:00
2026.06.30 11:34:22.050 Test (EURUSD,M5) Time Dict: 503
2026.06.30 11:34:22.390 Test (EURUSD,M5) Time PH: 281
2026.06.30 11:34:22.391 Test (EURUSD,M5) Time Dict: 512
2026.06.30 11:34:22.745 Test (EURUSD,M5) Time PH: 282
2026.06.30 11:34:22.746 Test (EURUSD,M5) Time Dict: 528
2026-06-28 13:19:00 -05:00
*/
}
//+------------------------------------------------------------------+