コード例 #1
0
ファイル: KadinaMain.cs プロジェクト: michaelwills/tradelink
 void rightreset(object sender, EventArgs e)
 {
     igridinit = false;
     if (h != null)
     {
         h.Reset();
     }
     msgbox.Clear();
     dt.Clear();
     ptab.Clear();
     ot.Clear();
     ft.Clear();
     tabControl1.Refresh();
     if (it != null)
     {
         it.Clear(); it.Columns.Clear();
     }
     loadfile(tickfile);
     loadfile(responsedll);
     loadboxname(resname);
     if (myres != null)
     {
         myres.Reset();
     }
     status("Reset box " + myres.Name + " " + PrettyEPF());
 }
コード例 #2
0
 public Playback(HistSim simulator)
 {
     h = simulator;
     h.Reset();
     h.Initialize();
     WorkerSupportsCancellation = true;
     WorkerReportsProgress      = true;
 }
コード例 #3
0
        // runs after simulation is complete
        void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            debug(_sb.ToString());
            _sb = new System.Text.StringBuilder(10000000);
            GauntArgs gargs = (GauntArgs)e.Result;

            if (!e.Cancelled)
            {
                List <Trade> list = SimBroker.GetTradeList();
                tradeResults1.NewResultTrades(LogFile("Trades"), list);
                if (gargs.Trades)
                {
                    debug("writing " + list.Count + " trades...");
                    Util.ClosedPLToText(list, ',', LogFile("Trades"));
                }
                if (gargs.Orders)
                {
                    List <Order> olist = SimBroker.GetOrderList();
                    debug("writing " + olist.Count + " orders...");
                    StreamWriter sw   = new StreamWriter(LogFile("Orders"), false);
                    string[]     cols = Enum.GetNames(typeof(OrderField));
                    sw.WriteLine(string.Join(",", cols));
                    for (int i = 0; i < olist.Count; i++)
                    {
                        sw.WriteLine(OrderImpl.Serialize(olist[i]));
                    }
                    sw.Close();
                }
                string msg = "Done.  Ticks: " + gargs.TicksProcessed + " Speed:" + gargs.TicksSecond.ToString("N0") + " t/s  Fills: " + gargs.Executions.ToString();
                debug(msg);
                status(msg);
            }
            else
            {
                debug("Canceled.");
            }
            // close indicators
            if (indf != null)
            {
                indf.Close();
                indf = null;
            }

            // reset simulation
            h.Reset();
            count = 0;
            lastp = 0;
            if (args.isUnattended)
            {
                Close();
                return;
            }
            // enable new runs
            ProgressBar1.Enabled = false;
            ProgressBar1.Value   = 0;
            queuebut.Enabled     = true;
            Invalidate(true);
        }
コード例 #4
0
 void _playback_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Cancelled)
     {
         status("Playback was canceled.");
     }
     else if (e.Error != null)
     {
         status("Playback stopped: " + e.Error.ToString());
     }
     else
     {
         status("Playback completed successfully");
     }
     progressbar.Value = 0;
     h.Reset();
 }
コード例 #5
0
        // runs after simulation is complete
        void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            debug(_sb.ToString());
            _sb = new System.Text.StringBuilder(10000000);
            GauntArgs gargs = (GauntArgs)e.Result;

            if (!e.Cancelled)
            {
                List <Trade> list = SimBroker.GetTradeList();
                updatecompletedtrades(list, gargs.Trades, gargs.Orders);
                string msg = "Done.  Ticks: " + gargs.TicksProcessed + " Speed:" + gargs.TicksSecond.ToString("N0") + " t/s  Fills: " + gargs.Executions.ToString();
                debug(msg);
                status(msg);
            }
            else
            {
                debug("Canceled.");
            }
            // close indicators
            if (indf != null)
            {
                indf.Close();
                indf = null;
            }

            // reset simulation
            h.Reset();
            count = 0;
            lastp = 0;
            if (args.isUnattended)
            {
                Close();
                return;
            }
            // enable new runs
            ProgressBar1.Enabled = false;
            ProgressBar1.Value   = 0;
            queuebut.Enabled     = true;
            Invalidate(true);
        }
コード例 #6
0
 void _playback_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Cancelled)
     {
         status("Playback was canceled.");
     }
     else if (e.Error != null)
     {
         status("Playback stopped, see messages. ");
         debug("Playback stopped: " + e.Error.ToString());
         CrashReport.Report(PROGRAM, string.Empty, string.Empty, _dw.Content, e.Error, null, false);
     }
     else
     {
         status("Playback completed successfully");
     }
     stopbut.Enabled   = false;
     playbut.Enabled   = true;
     trackBar1.Enabled = true;
     progressbar.Value = 0;
     h.Reset();
 }