MQLArticles/Utils/Bits/HMTest.mq5

50 lines
1.7 KiB
MQL5
Raw Permalink Normal View History

2026-09-03 20:38:40 -05:00
//+------------------------------------------------------------------+
//| Hash.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 "Hash.mqh"
#include <TSN\\GCol\\HashMap.mqh>
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
TSN::CHashMapFastNor<TSN::CBitBuffer, int, TSN::CGenericHash_CBitBuffer> hashmap;
TSN::CBitBuffer key(10);
key.WriteStringWPadd("XAUUSD");
key.WriteInteger(10);
key.WriteInteger(ENUM_APPLIED_PRICE(0));
if(!hashmap.ReserveSlot(key))
{
Print("err");
return;
}
hashmap.m_table[hashmap.m_last_pos_tbl].key.RobarDe(key);
hashmap.m_table[hashmap.m_last_pos_tbl].value = 0x80; // "direccion"
TSN::CBitBuffer key2(4);
key2.WriteStringWPadd("XAUUSD");
key2.WriteInteger(10);
key2.WriteInteger(ENUM_APPLIED_PRICE(0));
int v = 0;
hashmap.TryGet(key2, v);
Print(v);
2026-09-03 20:38:53 -05:00
// 2026.09.03 20:35:43.389 HMTest (EURUSD,H1) 128
2026-09-03 20:38:40 -05:00
}
//+------------------------------------------------------------------+