Ejemplo n.º 1
0
        private void NextInQueue()
        {
            Console.WriteLine("Showing Next");
            if (ChartQueue.Count == 0)
            {
                form1.Close();
                return;
            }
            ActiveResult    = ChartQueue.Dequeue();
            queueLabel.Text = string.Format("{0} in Queue{1}", ChartQueue.Count, doneProc ? " (Done Processing)" : "");
            decimal ret = ActiveResult.PositionReturn;

            totalCapital    += (totalCapital * ret);
            profitLabel.Text = string.Format("({0:P2}) {1:C0}", ret, totalCapital);
            this.chartMin    = Decimal.ToDouble(ActiveResult.Low);
            this.chartMax    = Decimal.ToDouble(ActiveResult.High);
            chart.Series["Series1"].XValueMember = "Date";
            chart.ChartAreas[0].AxisX.Title      = ActiveResult.StartTime.ToString("yyyy-MM-dd");
            chart.Titles[0].Text = ActiveResult.Symbol.ToUpper();
            chart.Series["Series1"].YValueMembers    = "High, Low, Open, Close";
            chart.Series["Series1"]["ShowOpenClose"] = "Both";
            chart.ChartAreas[0].AxisY.Maximum        = Math.Round(chartMax, 4);
            chart.ChartAreas[0].AxisY.Minimum        = Math.Round(chartMin, 4);
            chart.DataManipulator.IsStartFromFirst   = true;
            chart.DataSource = ActiveResult.Prices;
            chart.DataBind();
        }
Ejemplo n.º 2
0
 public void SendToChartQueue(AlgoResult result)
 {
     Console.WriteLine("Sending this to queue: " + result.Symbol + result.StartTime.ToShortDateString() +
                       result.StartTime.ToShortTimeString());
     synchronizationContext.Post(new SendOrPostCallback(res =>
     {
         Console.WriteLine("Queueing");
         ChartQueue.Enqueue((AlgoResult)res);
         queueLabel.Text = string.Format("{0} in Queue{1}", ChartQueue.Count, doneProc ? " (Done Processing)" : "");
         if (ActiveResult == null)
         {
             NextInQueue();
         }
     }), result);
 }