Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

CDictionary - MetaTrader 5 Library | MT5 EA Download - MetaTrader 5 Resources

author EAcpu | 4 reads | 0 comments |

Implementation of dictionary (associative array) data structure in MQL5, based on CArray objects and lists .

 Dictionary *dict= new CDictionary(); //Environment dictionary.Set <string> ( "Co-starring" , "Liquid" );
Dictionary.Set <Double> ( "liquid" , 0.1 ); //Get - variant 1
string variant 1 = dict.Get <string> ( "co-starring" ); print (variant 1); //get-variant 2
double variant 2=0;
Dictionary.Get <Double> ( "liquid" , variant 2); print (variant 2);

It can also store pointers to objects (but not objects or structures):

 dict.Set ( "purpose" , new CObject());



Attachment download

📎dict3.mq5 (3.48 KB)

📎 dictionary.mqh (15.03 KB)

Source: MQL5 #19314

Verification code Refresh