Dictionary in mql5
Please use the search engine before posting.
Sidnei Vladisauskis:
Hi everyone,
In an EA using Protrader I have a Dictionary type, that I can store key | value where value can be any type, inclusive arrays.
So, I can do something like this:
How can I do something like that using mql5? I tried using HashMap but unsuccessful.
Thanks
#include <generic/hashmap.mqh> #include <generic/arraylist.mqh> void OnStart() { CHashMap<string, CArrayList<bool>*> dict; bool flags[] = {false, false, true, true}; CArrayList<bool> array_flags(flags); dict.Add("flags", &array_flags); CArrayList<bool> *temp; if(dict.TryGetValue("flags", temp)) { for(int i=0; i<temp.Count(); i++) { bool flag; if(temp.TryGetValue(i, flag)) { Print(flag); } } } }
nicholi shen:
thanks
Hi everyone,
In an EA using Protrader I have a Dictionary type, that I can store key | value where value can be any type, inclusive arrays.
So, I can do something like this:
How can I do something like that using mql5? I tried using HashMap but unsuccessful.
Thanks