コード例 #1
0
        public void LoadFromString(string saveStr)
        {
            string[] str = saveStr.Split('@');

            BotName              = str[0];
            PositionsCount       = Convert.ToInt32(str[1]);
            TotalProfit          = Convert.ToDecimal(str[2]);
            MaxDrowDawn          = Convert.ToDecimal(str[3]);
            AverageProfit        = Convert.ToDecimal(str[4]);
            AverageProfitPercent = Convert.ToDecimal(str[5]);
            ProfitFactor         = Convert.ToDecimal(str[6]);
            PayOffRatio          = Convert.ToDecimal(str[7]);
            Recovery             = Convert.ToDecimal(str[8]);
            TotalProfitPersent   = Convert.ToDecimal(str[9]);

            string [] param = str[10].Split('&');

            for (int i = 0; i < param.Length - 1; i++)
            {
                StrategyParameters.Add(param[i]);
            }

            string [] reportTabs = str[11].Split('&');

            for (int i = 0; i < reportTabs.Length - 1; i++)
            {
                OptimizerReportTab faze = new OptimizerReportTab();
                faze.LoadFromSaveString(reportTabs[i]);
                TabsReports.Add(faze);
            }
        }
コード例 #2
0
        private DataGridViewRow GetRowResult(OptimizerReportTab report)
        {
            DataGridViewRow row = new DataGridViewRow();

            row.Cells.Add(new DataGridViewTextBoxCell());
            row.Cells[0].Value = report.SecurityName;


            DataGridViewTextBoxCell cell2 = new DataGridViewTextBoxCell();

            row.Cells.Add(cell2);

            DataGridViewTextBoxCell cell3 = new DataGridViewTextBoxCell();

            cell3.Value = report.PositionsCount;
            row.Cells.Add(cell3);

            DataGridViewTextBoxCell cell4 = new DataGridViewTextBoxCell();

            cell4.Value = report.TotalProfit.ToStringWithNoEndZero();
            row.Cells.Add(cell4);

            DataGridViewTextBoxCell cell5 = new DataGridViewTextBoxCell();

            cell5.Value = report.MaxDrowDawn.ToStringWithNoEndZero();
            row.Cells.Add(cell5);

            DataGridViewTextBoxCell cell6 = new DataGridViewTextBoxCell();

            cell6.Value = report.AverageProfit.ToStringWithNoEndZero();
            row.Cells.Add(cell6);

            DataGridViewTextBoxCell cell7 = new DataGridViewTextBoxCell();

            cell7.Value = report.AverageProfitPercent.ToStringWithNoEndZero();
            row.Cells.Add(cell7);

            DataGridViewTextBoxCell cell8 = new DataGridViewTextBoxCell();

            cell8.Value = report.ProfitFactor.ToStringWithNoEndZero();
            row.Cells.Add(cell8);

            DataGridViewTextBoxCell cell9 = new DataGridViewTextBoxCell();

            cell9.Value = report.PayOffRatio.ToStringWithNoEndZero();
            row.Cells.Add(cell9);

            DataGridViewTextBoxCell cell10 = new DataGridViewTextBoxCell();

            cell10.Value = report.Recovery.ToStringWithNoEndZero();
            row.Cells.Add(cell10);

            row.Cells.Add(null);

            return(row);
        }
コード例 #3
0
ファイル: OptimizerReport.cs プロジェクト: w1r2p1/OsEngine-1
        public void LoadState(BotPanel bot)
        {
            BotName = bot.NameStrategyUniq;
            // фасуем отчёты по вкладкам

            List <Position> allPositionsForAllTabs = new List <Position>();

            for (int i = 0; i < bot.TabsSimple.Count; i++)
            {
                OptimizerReportTab tab       = new OptimizerReportTab();
                List <Position>    positions =
                    bot.TabsSimple[i].GetJournal().AllPosition.FindAll(
                        pos => pos.State != PositionStateType.OpeningFail);

                if (positions.Count == 0)
                {
                    continue;
                }

                allPositionsForAllTabs.AddRange(positions);

                Position[] posesArray = positions.ToArray();

                tab.SecurityName   = bot.TabsSimple[i].Securiti.Name;
                tab.PositionsCount = positions.Count;
                tab.TotalProfit    = PositionStaticticGenerator.GetAllProfitInPunkt(posesArray);
                tab.MaxDrowDawn    = PositionStaticticGenerator.GetMaxDownPersent(posesArray);

                tab.AverageProfit = tab.TotalProfit / (posesArray.Length + 1);

                tab.AverageProfitPercent = PositionStaticticGenerator.GetMidleProfitInPersent(posesArray);

                tab.ProfitFactor = PositionStaticticGenerator.GetProfitFactor(posesArray);
                tab.Recovery     = PositionStaticticGenerator.GetRecovery(posesArray);
                tab.PayOffRatio  = PositionStaticticGenerator.GetPayOffRatio(posesArray);
                tab.TabType      = bot.TabsSimple[i].GetType().Name;

                TabsReports.Add(tab);
            }

            if (TabsReports.Count == 0)
            {
                return;
            }

            // формируем общие данные по отчёту

            if (TabsReports.Count == 1)
            {
                PositionsCount       = TabsReports[0].PositionsCount;
                TotalProfit          = TabsReports[0].TotalProfit;
                MaxDrowDawn          = TabsReports[0].MaxDrowDawn;
                AverageProfit        = TabsReports[0].AverageProfit;
                AverageProfitPercent = TabsReports[0].AverageProfitPercent;

                ProfitFactor = TabsReports[0].ProfitFactor;
                Recovery     = TabsReports[0].Recovery;
                PayOffRatio  = TabsReports[0].PayOffRatio;
            }
            else
            {
                allPositionsForAllTabs = PositionStaticticGenerator.SortByTime(allPositionsForAllTabs);

                Position[] posesArray = allPositionsForAllTabs.ToArray();

                PositionsCount       = allPositionsForAllTabs.Count;
                TotalProfit          = PositionStaticticGenerator.GetAllProfitInPunkt(posesArray);
                MaxDrowDawn          = PositionStaticticGenerator.GetMaxDownPersent(posesArray);
                AverageProfit        = PositionStaticticGenerator.GetMidleProfitInPunkt(posesArray);
                AverageProfitPercent = PositionStaticticGenerator.GetMidleProfitInPersent(posesArray);
                ProfitFactor         = PositionStaticticGenerator.GetProfitFactor(posesArray);
                Recovery             = PositionStaticticGenerator.GetRecovery(posesArray);
                PayOffRatio          = PositionStaticticGenerator.GetPayOffRatio(posesArray);
            }
        }