コード例 #1
0
        protected override void engine_Complete(RunWorkerCompletedEventArgs e)
        {
            //_resultsModel.Clear();
            var newResults = TradeResult.ResultsFromTradeList(_tradeList);

            _tradeList.Clear();
            var results          = Results.FetchResults(newResults, _rfr, _comm, engine_MessageUpdate);
            var darkLightResults = new DarkLightResults(results);

            _optimizationResults.Add(new PlottableValue <DarkLightResults> {
                X = xValue, Value = darkLightResults
            });

            _updatePlots();

            if (e.Error != null)
            {
                engine_MessageUpdate(e.Error.Message + e.Error.StackTrace);
                engine_StatusUpdate("Terminated because of an Exception.  See messages.");
            }
            else if (e.Cancelled)
            {
                engine_StatusUpdate("Canceled play.");
            }
            else
            {
                string playToString = _engineInfo.PlayToString;
                engine_StatusUpdate("Reached next " + playToString + " at time " + KadTime);
            }
        }
コード例 #2
0
        protected override void engine_Complete(RunWorkerCompletedEventArgs e)
        {
            string[] r = _messageBuilder.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            foreach (string l in r)
            {
                //_activityModel.Messages.Add(new ObservableMessage {Message = l});
                Messages.Add(new ObservableMessage {
                    Message = l
                });
            }
            IndicatorTable = _indicatorTable;
            TickTable      = _tickCollection;
            OrderTable     = _orderCollection;
            FillTable      = _fillCollection;
            PositionTable  = _positionCollection;

            Plots = new ObservableCollection <TimePlot>(_plotMap.Values);
            //_updatePlots();

            string responseName    = _engineInfo.ResponseName;
            string prettyTickFiles = _engineInfo.PrettyTickFiles;
            var    name            = responseName + "." + prettyTickFiles;
            var    resultInstance  = DarkLightResults.GetDarkLightResults(name, _tradeList, engine_MessageUpdate, 0.0001m, 0.0012m);

            ResultsList = new ObservableCollection <KeyValuePair <string, string> >(PlottingUtilities.GetFieldAndPropertyValueList(resultInstance));
            Results     = resultInstance;

            _activityModel.NumberTestsCompleted = _activityModel.NumberTestsCompleted + 1;
            if (e.Error != null)
            {
                engine_MessageUpdate(e.Error.Message + e.Error.StackTrace);
                engine_StatusUpdate("Terminated because of an Exception.  See messages.");
            }
            else if (e.Cancelled)
            {
                engine_StatusUpdate("Canceled play.");
            }
            else
            {
                string playToString = _engineInfo.PlayToString;
                engine_StatusUpdate("Reached next " + playToString + " at time " + KadTime);
            }
        }
コード例 #3
0
        public static DarkLightResults AddResults(DarkLightResults r1, DarkLightResults r2)
        {
            Results          results   = new Results();
            DarkLightResults dLResults = new DarkLightResults(results);

            dLResults.BuyLosers = r1.BuyLosers + r2.BuyLosers;
            dLResults.BuyPL     = r1.BuyPL + r2.BuyPL;
            dLResults.BuyWins   = r1.BuyWins + r2.BuyWins;
            //dLResults.Commissions = r1.Commissions    + r2.Commissions;
            dLResults.ComPerShare    = r1.ComPerShare + r2.ComPerShare;
            dLResults.ConsecLose     = r1.ConsecLose + r2.ConsecLose;
            dLResults.ConsecWin      = r1.ConsecWin + r2.ConsecWin;
            dLResults.DaysTraded     = r1.DaysTraded + r2.DaysTraded;
            dLResults.Flats          = r1.Flats + r2.Flats;
            dLResults.GrossPerDay    = r1.GrossPerDay + r2.GrossPerDay;
            dLResults.GrossPerSymbol = r1.GrossPerSymbol + r2.GrossPerSymbol;
            dLResults.GrossPL        = r1.GrossPL + r2.GrossPL;
            dLResults.Losers         = r1.Losers + r2.Losers;
            dLResults.MaxLoss        = Math.Max(r1.MaxLoss, r2.MaxLoss);
            dLResults.MaxOpenLoss    = Math.Max(r1.MaxOpenLoss, r2.MaxOpenLoss);
            dLResults.MaxOpenWin     = Math.Max(r1.MaxOpenWin, r2.MaxOpenWin);
            dLResults.MaxPL          = Math.Max(r1.MaxPL, r2.MaxPL);
            dLResults.MaxWin         = Math.Max(r1.MaxWin, r2.MaxWin);
            dLResults.MinPL          = Math.Min(r1.MinPL, r2.MinPL);
            //dLResults.NetPL = r1.NetPL + r2.NetPL;
            dLResults.NetProfitOrLoss = r1.NetProfitOrLoss + r2.NetProfitOrLoss;
            dLResults.NetPerShare     = r1.NetPerShare + r2.NetPerShare;
            dLResults.RoundLosers     = r1.RoundLosers + r2.RoundLosers;
            dLResults.RoundTurns      = r1.RoundTurns + r2.RoundTurns;
            dLResults.RoundWinners    = r1.RoundWinners + r2.RoundWinners;
            dLResults.SellLosers      = r1.SellLosers + r2.SellLosers;
            dLResults.SellPL          = r1.SellPL + r2.SellPL;
            dLResults.SellWins        = r1.SellWins + r2.SellWins;
            dLResults.SharesTraded    = r1.SharesTraded + r2.SharesTraded;
            dLResults.SymbolCount     = r1.SymbolCount + r2.SymbolCount;
            dLResults.Trades          = r1.Trades + r2.Trades;
            dLResults.Winners         = r1.Winners + r2.Winners;

            return(dLResults);
        }