Download MetaTrader 5

How can I convert mql4 from c #?

To add comments, please log in or register
Mehmet Bastem
658
Mehmet Bastem  

Dictionary<string, List<string>> dic = new Dictionary<string, List<string>>();
            List<string> myValues1 = new List<string>();
            for (int i = 0; i < 50; i++)
            {
                myValues1.Add("KeyA" + i);
            }

            List<string> myValues2 = new List<string>();
            for (int i = 0; i < 50; i++)
            {
                myValues2.Add("KeyB" + i);
            }


            List<string> myValues3 = new List<string>();
            for (int i = 0; i < 50; i++)
            {
                myValues3.Add("KeyC" + i);
            }



            dic.Add("A", myValues1);
            dic.Add("B", myValues2);
            dic.Add("C", myValues3);

            foreach (KeyValuePair<string, List<string>> pair in dic)
            {
                string pk = pair.Key.ToString();

                if (pair.Key == "A")
                {
                    foreach (string d in pair.Value)
                    {
                        MessageBox.Show("Key:" + pair.Key.ToString() + "      Değeri: " + d.ToString());
                    }
                }


            }

Ex Ovo Omnia
3355
Ex Ovo Omnia  
Mehmet Bastem:

Dictionary<string, List<string>> dic = new Dictionary<string, List<string>>();
            List<string> myValues1 = new List<string>();
            for (int i = 0; i < 50; i++)
            {
                myValues1.Add("KeyA" + i);
            }

            List<string> myValues2 = new List<string>();
            for (int i = 0; i < 50; i++)
            {
                myValues2.Add("KeyB" + i);
            }


            List<string> myValues3 = new List<string>();
            for (int i = 0; i < 50; i++)
            {
                myValues3.Add("KeyC" + i);
            }



            dic.Add("A", myValues1);
            dic.Add("B", myValues2);
            dic.Add("C", myValues3);

            foreach (KeyValuePair<string, List<string>> pair in dic)
            {
                string pk = pair.Key.ToString();

                if (pair.Key == "A")
                {
                    foreach (string d in pair.Value)
                    {
                        MessageBox.Show("Key:" + pair.Key.ToString() + "      Değeri: " + d.ToString());
                    }
                }


            }


You might look into the standard libraries if you find Dictionary and List equivalents implemented (I do not know the standard library). If not, you have to implement yours like many did. Below there is your example with use of my implementation.


whroeder1
16058
whroeder1  
  1. Don't
paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it

  2. Not MQL4 code
  3. No question asked
  4. You have only four choices: We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using SRC) and the nature of your problem.
Mehmet Bastem
658
Mehmet Bastem  
Ex Ovo Omnia:


You might look into the standard libraries if you find Dictionary and List equivalents implemented (I do not know the standard library). If not, you have to implement yours like many did. Below there is your example with use of my implementation.



 too long code ?.

 string b11[20];

   string SeyranGrup[20]={"aa","bb","cc","dd"};

   b11[2]="Seyran"+"Grup[2]";

   Alert(b11[2]);

result is SeyranGrup[2], i want to  result is "cc".

Ex Ovo Omnia
3355
Ex Ovo Omnia  
Mehmet Bastem:


 too long code ?.

 string b11[20];

   string SeyranGrup[20]={"aa","bb","cc","dd"};

   b11[2]="Seyran"+"Grup[2]";

   Alert(b11[2]);

result is SeyranGrup[2], i want to  result is "cc".


It does not look like C# code. You should open a new thread. Those, who could answer your query, would not enter a C# related thread.
Abejorro
184
Abejorro  
Mehmet Bastem:

 

result is SeyranGrup[2], i want to  result is "cc".


"execute a string" -> https://www.mql5.com/en/forum/151309

Execute a string as a method?
Execute a string as a method?
  • 2014.04.27
  • www.mql5.com
How to execute a string as a method...
To add comments, please log in or register