MA
    
        
            Sort results high to low
            
                 13 Feb 2020, 22:12
            
                    
Hi Ctrader Community,
I need some help sorting some results. I want to print, export (filewrite) and email the results from High to Low.
Can anyone give me a solution or advise how to do this? Would like to have them sorted in all 3 export ways.
Thanks!
            _fileWriter.WriteLine("{0}; EUR; USD; GBP; CHF; AUD; CAD; NZD", DateTime.Now);
            _fileWriter.WriteLine("{0}; {1}; {2}; {3}; {4}; {5}; {6}; {7}", DateTime.Now, H4_EURJPYresult, H4_USDJPYresult, H4_GBPJPYresult, H4_CHFJPYresult, H4_AUDJPYresult, H4_CADJPYresult, H4_NZDJPYresult);
            Print("EUR = {0}", H4_EURJPYresult);
            Print("USD = {0}", H4_USDJPYresult);
            Print("GBP = {0}", H4_GBPJPYresult);
            Print("CHF = {0}", H4_CHFJPYresult);
            Print("AUD = {0}", H4_AUDJPYresult);
            Print("CAD = {0}", H4_CADJPYresult);
            Print("NZD = {0}", H4_NZDJPYresult);
            var emailBody = string.Format("EUR = {0}\nUSD = {1}\nGBP = {2}\nCHF = {3}\nAUD = {4}\nCAD = {5}\nNZD = {6}", H4_EURJPYresult, H4_USDJPYresult, H4_GBPJPYresult, H4_CHFJPYresult, H4_AUDJPYresult, H4_CADJPYresult, H4_NZDJPYresult);
            Notifications.SendEmail("email", "email", "Results", emailBody);

firemyst
14 Feb 2020, 18:19
Add them to a Dictionary<string,double> object (assuming the results are doubles), sort the dictionary, and then loop over it.
Examples:
@firemyst