Пример #1
0
        protected override void Play(object sender, DoWorkEventArgs e)
        {
            _isbusy = true;
            _resultsdict.Clear();
            while (isNextAvail)
            {
                decimal value = NextParam;
                int     id    = _id;

                if (ChangeValue(ref _strategy, value))
                {
                    //OptimizerEngine ge = new OptimizerEngine(s, hsim);
                    //Thread.SpinWait(1000);
                    //debugControl1.GotDebug("Starting a Optimizer instance");
                    Debug("Started Optimizer Engine: " + id);
                    Go();

                    List <Trade>         trades = _simbroker.GetTradeList();
                    PerformanceEvaluator result = new PerformanceEvaluator();
                    //result.InitializePositions();
                    result.GenerateReports(trades);

                    decimal rv = 0;
                    GetResult(result, out rv);

                    _resultsdict.Add(value.ToString("N3") + " : " + rv.ToString("N3"), result);

                    Debug("optimize " + id + " finished.  Used: " + value + " -> " + OptimizeDecisionsName + ": " + rv + " trades: " + trades.Count + " SimsRemaining: " + OptimizeRemain);
                    progress(_id, OptimizeCount);
                }
                else
                {
                    Debug("Unable to start Optimizer engine: " + id + " with: " + value);
                }
            }
            Debug("All optimization runs complete, computing optimum...");
            // unbind
            UnbindEvents();
            _isbusy = false;
        }
Пример #2
0
 void _backtestengine_SendPlayCompleteEvent(int obj)
 {
     _performevaluator = new PerformanceEvaluator();
     //_performevaluator.InitializePositions();
     _performevaluator.GenerateReports(_tradelist);
     System.Windows.Application.Current.Dispatcher.Invoke(() =>
     {
         _performevaluator.FillGrid(_resultstable);
     });
 }
Пример #3
0
        protected override void Play(object sender, DoWorkEventArgs e)
        {
            _isbusy = true;
            _resultsdict.Clear();
            while (isNextAvail)
            {
                decimal value = NextParam;
                int id = _id;

                if (ChangeValue(ref _strategy, value))
                {
                    //OptimizerEngine ge = new OptimizerEngine(s, hsim);
                    //Thread.SpinWait(1000);
                    //debugControl1.GotDebug("Starting a Optimizer instance");
                    Debug("Started Optimizer Engine: " + id);
                    Go();

                    List<Trade> trades = _simbroker.GetTradeList();
                    PerformanceEvaluator result = new PerformanceEvaluator();
                    //result.InitializePositions();
                    result.GenerateReports(trades);

                    decimal rv = 0;
                    GetResult(result, out rv);

                    _resultsdict.Add(value.ToString("N3") + " : " + rv.ToString("N3"), result);

                    Debug("optimize " + id + " finished.  Used: " + value + " -> " + OptimizeDecisionsName + ": " + rv + " trades: " + trades.Count + " SimsRemaining: " + OptimizeRemain);
                    progress(_id, OptimizeCount);
                }
                else
                    Debug("Unable to start Optimizer engine: " + id + " with: " + value);

            }
            Debug("All optimization runs complete, computing optimum...");
            // unbind
            UnbindEvents();
            _isbusy = false;
        }
        private void GeneratePerformanceReport(int time)
        {
            _performevaluator = new PerformanceEvaluator();
            //_performevaluator.InitializePositions();
            _performevaluator.GenerateReports(_tradelist);

            System.Windows.Application.Current.Dispatcher.Invoke(() =>
            {
                _performevaluator.FillGrid(_resultstable);
                TabControlSelectedIndex = 3;
            });
        }