public Optimization(string[] basket, string TimeFrame)
        {
            #region Initialize data
            Symbol1   = basket[0];
            Symbol2   = basket[0];
            timeframe = TimeFrame;
            n_data    = Global.Instance.TotalBars[timeframe];

            Date1 = new DateTime[n_data];
            Date2 = new DateTime[n_data];
            Pair1 = new double[n_data];
            Pair2 = new double[n_data];
            Ratio = new double[n_data];

            resolution    = new double[2];
            resolution[0] = (Symbol1.Contains("JPY")) ? 0.01 : 0.0001;
            resolution[1] = (Symbol2.Contains("JPY")) ? 0.01 : 0.0001;


            #endregion
            #region load data
            using (StreamReader reader = new StreamReader(Global.Instance.data_folder_path + "\\" + timeframe + "\\" + Symbol1 + ".csv"))
            {
                string line = null;
                int    i    = 0;
                while ((line = reader.ReadLine()) != null)
                {
                    string[] ext = line.Split(',');
                    Date1[i] = DateTime.Parse(ext[0] + " " + ext[1]);
                    Pair1[i] = double.Parse(ext[2]);
                    i++;
                }
                reader.Close();
            }
            using (StreamReader reader = new StreamReader(Global.Instance.data_folder_path + "\\" + timeframe + "\\" + Symbol2 + ".csv"))
            {
                string line = null;
                int    i    = 0;
                while ((line = reader.ReadLine()) != null)
                {
                    string[] ext = line.Split(',');
                    Date2[i] = DateTime.Parse(ext[0] + " " + ext[1]);
                    Pair2[i] = double.Parse(ext[2]);
                    i++;
                }
                reader.Close();
            }
            for (int i = 0; i < n_data; i++)
            {
                Ratio[i] = Pair1[i] / Pair2[i];
            }
            #endregion
            #region Work on pip costs

            pipCostSeries = new double[Global.Instance.counterCurrencies.Count, n_data];

            Symbol1CounterIndex = Global.Instance.counterCurrencies.IndexOf(Symbol1.Substring(3, 3));
            Symbol2CounterIndex = Global.Instance.counterCurrencies.IndexOf(Symbol2.Substring(3, 3));


            for (int i = 0; i < Global.Instance.counterCurrencies.Count; i++)
            {
                if (Global.Instance.counterCurrencies[i] == "USD") //For USD countercurrency, pip cost is always 1
                {
                    for (int j = 0; j < n_data; j++)
                    {
                        pipCostSeries[i, j] = 1;
                    }
                }
                else
                {
                    if (File.Exists(Global.Instance.data_folder_path + "\\" + timeframe + "\\" + Global.Instance.counterCurrencies[i] + "USD" + ".csv"))  //If the currency is XXXUSD
                    {
                        using (StreamReader reader = new StreamReader(Global.Instance.data_folder_path + "\\" + timeframe + "\\" + Global.Instance.counterCurrencies[i] + "USD" + ".csv"))
                        {
                            string line = null;
                            int    j    = 0;
                            while ((line = reader.ReadLine()) != null)
                            {
                                string[] ext = line.Split(',');
                                pipCostSeries[i, j] = Math.Round(double.Parse(ext[2]), 1);
                                j++;
                            }
                            reader.Close();
                        }
                    }
                    else
                    {
                        using (StreamReader reader = new StreamReader(Global.Instance.data_folder_path + "\\" + timeframe + "\\USD" + Global.Instance.counterCurrencies[i] + ".csv"))
                        {
                            string line = null;
                            int    j    = 0;
                            while ((line = reader.ReadLine()) != null)
                            {
                                string[] ext = line.Split(',');
                                if (Global.Instance.counterCurrencies[i] == "JPY") //For XXXJPY based
                                {
                                    pipCostSeries[i, j] = Math.Round(100 / double.Parse(ext[2]), 1);
                                }
                                else
                                {
                                    pipCostSeries[i, j] = Math.Round(1 / double.Parse(ext[2]), 1);
                                }
                                j++;
                            }
                            reader.Close();
                        }
                    }
                }
            }

            #endregion
        }