Ejemplo n.º 1
0
 public IntoGapStrategy(object entry, double stop, object target, StrategyStats stats, double minimumGapSize,
                        List <ITrade> trades, bool isFixedStop, bool isStopTrailed, double trialedStopSize) : base(entry, stop, target,
                                                                                                                   stats, trades, isFixedStop, minimumGapSize, isStopTrailed, trialedStopSize)
 {
     Name      = $"{IntoGapName} | {Name}";
     ShortName = $"{IntoGapName} | {ShortName}";
 }
        public StrategyResultsStatsViewModel(StrategyStats stats)
        {
            TradeCount           = $"{stats.TradeCount}";
            Wins                 = $"{stats.Wins}";
            Loses                = $"{stats.Loses}";
            LongestWinningStreak = $"{stats.LongestWinningStreak}";
            LongestLosingStreak  = $"{stats.LongestLosingStreak}";
            PointsProfit         = $"{stats.PointsTotal:N1}";
            CashProfit           = $"{stats.CashProfit:N1}";
            BiggestWin           = $"{stats.BiggestCashWin:N1}";

            AverageLoss = double.IsNaN(stats.AveragePointsLoss)
                ? "---"
                : $"{stats.AveragePointsLoss:N1}";

            AverageWin = double.IsNaN(stats.AverageCashWin)
                ? "---"
                : $"{stats.AverageCashWin:N1}";

            WinProbability = double.IsNaN(stats.WinProbability)
                ? "---"
                : $"{stats.WinProbability:P}";

            ProfitFactor = double.IsNaN(stats.ProfitFactor) ||
                           double.IsInfinity(stats.ProfitFactor)
                ? "---"
                : $"{stats.ProfitFactor:N1}";

            Expectancy = double.IsNaN(stats.Expectancy)
                ? "---"
                : $"{stats.Expectancy:N1}";
        }
Ejemplo n.º 3
0
 protected GapFillStrategy(object entry, double stop, object target, StrategyStats stats, List <ITrade> trades,
                           bool isFixedStop, double minimumGapSize, bool isStopTrailed, double trailedStopSize) :
     base(entry, stop, target, stats, trades, isStopTrailed, trailedStopSize)
 {
     MinimumGapSize = minimumGapSize;
     SetName(entry, stop, target, isFixedStop, isStopTrailed, trailedStopSize);
 }
Ejemplo n.º 4
0
 public StrategyResultsStatsViewModel(StrategyStats stats, IRunner runner, string name = "Strategy Statistics")
 {
     _accountStartSize = stats.StartBalance;
     _runner           = runner;
     Name = name;
     AssignData(stats);
     HasResults = true;
 }
Ejemplo n.º 5
0
        private void WriteReport(string name, StreamWriter writer)
        {
            fwriter = writer;
            StrategyStats stats = new StrategyStats(performance.ComboTrades);

            fwriter.WriteLine("<HTML>");
            fwriter.WriteLine("<HEAD>");
            WriteStyle();
            fwriter.WriteLine("</HEAD>");
            fwriter.WriteLine("<BODY>");
            fwriter.WriteLine("<H1>" + name + " Strategy Report</H1>");

            fwriter.WriteLine("<A href=\"Equity.html\">Equity Report</A><BR>");
            fwriter.WriteLine("<A href=\"Trades.html\">Trade List</A>");

            fwriter.WriteLine("</BODY>");
            fwriter.WriteLine("</HTML>");
        }
Ejemplo n.º 6
0
        private void WriteReport(string name, StreamWriter writer)
        {
            fwriter = writer;
            StrategyStats stats = new StrategyStats(performance.ComboTrades);

            fwriter.WriteLine("<HTML>");
            fwriter.WriteLine("<HEAD>");
            WriteStyle();
            fwriter.WriteLine("</HEAD>");
            fwriter.WriteLine("<BODY>");
            fwriter.WriteLine("<H1>" + name + " Strategy Report</H1>");

            fwriter.WriteLine("<BR>");

            WriteTrades(performance.ComboTrades, stats.ComboTrades, true);

            fwriter.WriteLine("</BODY>");
            fwriter.WriteLine("</HTML>");
        }
Ejemplo n.º 7
0
        //Structure represent the estimation criteria for the "strategy accuracry" on all stocks.
        private static StrategyStats EstimateStrategy(decimal[] list)
        {
            StrategyStats estData = new StrategyStats();

            for (int rowId = 0; rowId < list.Length; rowId++)
            {
                if (list[rowId] > 0)
                {
                    estData.winStockCount++;
                    if ((double)list[rowId] > estData.maxWinAmt)
                    {
                        estData.maxWinAmt = (double)list[rowId];
                    }
                    estData.totalWinAmt += (double)list[rowId];
                }
                if (list[rowId] < 0)
                {
                    estData.lossStockCount++;
                    if ((double)list[rowId] < estData.maxLossAmt)
                    {
                        estData.maxLossAmt = (double)list[rowId];
                    }
                    estData.totalLossAmt += (double)list[rowId];
                }
            }
            if (list.Length > 0)
            {
                estData.winStockPerc  = 100 * estData.winStockCount / (double)list.Length;
                estData.lossStockPerc = 100 * estData.lossStockCount / (double)list.Length;
            }
            if (estData.winStockCount > 0)
            {
                estData.avgWinAmt = estData.totalWinAmt / (double)estData.winStockCount;
            }
            if (estData.lossStockCount > 0)
            {
                estData.avgLossAmt = estData.totalLossAmt / (double)estData.lossStockCount;
            }
            return(estData);
        }
Ejemplo n.º 8
0
 public IntoGapStrategy(object entry, double stop, object target, StrategyStats stats, double minimumGapSize,
                        List <ITrade> trades, string title) : base(entry, stop, target, stats, trades, title)
 {
     MinimumGapSize = minimumGapSize;
 }
Ejemplo n.º 9
0
 public override void Constructor(TransactionPairs trades)
 {
     strategyStats = new StrategyStats(trades);
     equityStats   = new EquityStats(trades, trades, trades, trades);
     baseStats     = tradeStats = strategyStats.ComboTrades;
 }
Ejemplo n.º 10
0
        private void AssignData(StrategyStats stats)
        {
            _cashProfit          = stats.CashProfit;
            TradeCount           = $"{stats.TradeCount}";
            Wins                 = $"{stats.Wins}";
            Loses                = $"{stats.Loses}";
            LongestWinningStreak = $"{stats.LongestWinningStreak}";
            LongestLosingStreak  = $"{stats.LongestLosingStreak}";
            PointsProfit         = $"{stats.PointsTotal:N1}";
            CashProfit           = $"{stats.CashProfit:C}";
            BiggestCashWin       = $"{stats.BiggestCashWin:C}";
            BiggestPointsWin     = $"{stats.BiggestPointsWin:N1}";
            BiggestCashLoss      = $"{stats.BiggestCashLoss:C}";
            BiggestPointsLoss    = $"{stats.BiggestPointsLoss:N1}";

            AverageMaximumAdverseExcursion = double.IsNaN(stats.AverageMaximumAdverseExcursion)
                ? "---"
                : $"{stats.AverageMaximumAdverseExcursion:N1}";

            AverageMaximumFavourableExcursion = double.IsNaN(stats.AverageMaximumFavourableExcursion)
                ? "---"
                : $"{stats.AverageMaximumFavourableExcursion:N1}";

            AverageDrawdown = double.IsNaN(stats.AverageDrawdown)
                ? "---"
                : $"{stats.AverageDrawdown:P}";

            AverageRealisedProfitPercentage = double.IsNaN(stats.AverageRealisedProfitPercentage)
                ? "---"
                : $"{stats.AverageRealisedProfitPercentage:P}";

            AverageRiskRewardRatio = double.IsNaN(stats.AverageRiskRewardRatio)
                ? "---"
                : $"{stats.AverageRiskRewardRatio:N1}";

            AverageResultInR = double.IsNaN(stats.AverageResultInR)
                ? "---"
                : $"{stats.AverageResultInR:N1}";

            AverageWin = double.IsNaN(stats.AveragePointsWin) || double.IsNaN(stats.AverageCashWin)
                ? "---"
                : $"{stats.AveragePointsWin:N1} Points / {stats.AverageCashWin:C}";

            AverageLoss = double.IsNaN(stats.AveragePointsLoss) || double.IsNaN(stats.AverageCashLoss)
                ? "---"
                : $"{stats.AveragePointsLoss:N1} Points / {stats.AverageCashLoss:C}";

            AverageUnrealisedProfit = double.IsNaN(stats.AverageUnrealisedProfitPoints) ||
                                      double.IsNaN(stats.AverageUnrealisedProfitCash)
                ? "---"
                : $"{stats.AverageUnrealisedProfitPoints:N1} Points / {stats.AverageUnrealisedProfitCash:C}";

            WinProbability = double.IsNaN(stats.WinProbability)
                ? "---"
                : $"{stats.WinProbability:P}";

            ProfitFactor = double.IsNaN(stats.ProfitFactor) ||
                           double.IsInfinity(stats.ProfitFactor)
                ? "---"
                : $"{stats.ProfitFactor:N1}";

            Expectancy = double.IsNaN(stats.PointsExpectancy) || double.IsNaN(stats.CashExpectancy)
                ? "---"
                : $"{stats.PointsExpectancy:N1} Points / {stats.CashExpectancy:C}";

            var gain = stats.CashProfit / _accountStartSize;

            Gain = $"{gain:P}";
        }
Ejemplo n.º 11
0
 public StrategyResultsStatsViewModel(StrategyStats stats, string name = "Strategy Statistics")
 {
     _accountStartSize = stats.StartBalance;
     Name = name;
     AssignData(stats);
 }