private void MainForm_Load(object sender, EventArgs e)
        {
            WebSettings.GetSettings();
            var start = new LoadingStartupEvent();
            start.Progress = 10;
            onStartupLoad(this, start);

            CheckForIllegalCrossThreadCalls = false;
           //  Debug.WriteLine("Time Synched " + DoStuff.SynchronizeTime());
            _Interval = GlobalObjects.TimeInterval.Minute_5;

            start.Progress = 10;
            onStartupLoad(this, start);
            PopulateControls();

            start.Progress = 20;
            onStartupLoad(this, start);

            U5 = new UpdateTimer(_Interval);
            p = new PrepareForTrade(_Interval, WebSettings.General.HISAT_INST, GetParameters(), WebSettings.General.LIVE_START_DATE);
            marketOrder = new MarketOrder();


            p.onPriceSync += new PrepareForTrade.PricesSynced(p_onPriceSync);
            U5.onStartUpdate += new UpdateTimer.StartUpdate(U5_onStartUpdate);
            U5.OnManualCloseTrigger += new UpdateTimer.ManualCloseTrigger(U5_OnManualCloseTrigger);
            U5.OnConnectionExpired += new UpdateTimer.ConnectionExpired(U5_OnConnectionExpired);
            marketOrder.onOrderSend += new MarketOrder.OrderSend(marketOrder_onOrderSend);
            marketOrder.onOrderMatch += new MarketOrder.OrderMatch(marketOrder_onOrderMatch);
            _Stats.OnStatsCaculated += new Statistics.StatsCalculated(_Stats_OnStatsCaculated);


            start.Progress = 30;
            onStartupLoad(this, start);

            feed = new AlsiTrade_Backend.HiSat.LiveFeed(WebSettings.General.HISAT_INST);

            start.Progress = 60;
            onStartupLoad(this, start);

            BuildListViewColumns();

            start.Progress = 70;
            onStartupLoad(this, start);


            p._LastTrade = DoStuff.GetLastTrade(GetParameters(), _Interval);

            start.Progress = 80;
            onStartupLoad(this, start);


          
            Debug.WriteLine("LAST TRADE : " + p._LastTrade.TimeStamp + "   " + p._LastTrade);
            service = new WebUpdate();


            start.Progress = 100;
            onStartupLoad(this, start);

            WebUpdate.SetManualTradeTrigger(false);


            //test
            comboBox1.Items.Add(Trade.Trigger.None);
            comboBox1.Items.Add(Trade.Trigger.OpenLong);
            comboBox1.Items.Add(Trade.Trigger.OpenShort);
            comboBox1.Items.Add(Trade.Trigger.CloseLong);
            comboBox1.Items.Add(Trade.Trigger.CloseShort);

            comboBox2.Items.Add(Trade.BuySell.None);
            comboBox2.Items.Add(Trade.BuySell.Buy);
            comboBox2.Items.Add(Trade.BuySell.Sell);

           //Genetic plugin
            gb = GeneticBackend.GetSingletonGB();
            gb.Mf = this;
            gb.onUpdate += gb_onUpdate;
            gf.Show();
        }
 void U5_OnConnectionExpired(object sender, UpdateTimer.ConnectionExpiredEventArgs e)
 {
     feed = new AlsiTrade_Backend.HiSat.LiveFeed(WebSettings.General.HISAT_INST);
     Debug.WriteLine("RE-CONNECTING TO HI SAT");
 }