コード例 #1
0
 public EquityStats(double startingEquity, TransactionPairs daily, TransactionPairs weekly, TransactionPairs monthly, TransactionPairs yearly)
 {
     this.daily   = new TradeStats(startingEquity, daily);
     this.weekly  = new TradeStats(startingEquity, weekly);
     this.monthly = new TradeStats(startingEquity, monthly);
     this.yearly  = new TradeStats(startingEquity, yearly);
 }
コード例 #2
0
 public TradeStats(double startingEquity, TransactionPairs trades) : base(startingEquity, trades)
 {
     this.trades = trades;
     if (trades != null && trades.Count > 0)
     {
         calculate();
     }
 }
コード例 #3
0
ファイル: Performance.cs プロジェクト: prid77/TickZoomPublic
 public void OnInitialize()
 {
     comboTradesBinary      = new TransactionPairsBinary(model.Context.TradeData);
     comboTradesBinary.Name = "ComboTrades";
     profitLoss             = model.Data.SymbolInfo.ProfitLoss;
     comboTrades            = new TransactionPairs(GetCurrentPrice, profitLoss, comboTradesBinary);
     profitLoss.Symbol      = model.Data.SymbolInfo;
 }
コード例 #4
0
        public void CompareTradeCount()
        {
            TransactionPairs fourTicksRTs = fourTicksStrategy.Performance.ComboTrades;
            TransactionPairs fullTicksRTs = fullTicksStrategy.Performance.ComboTrades;

            Assert.AreEqual(fourTicksRTs.Count, fullTicksRTs.Count, "trade count");
            Assert.AreEqual(471, fullTicksRTs.Count, "trade count");
        }
コード例 #5
0
ファイル: BaseStats.cs プロジェクト: zoomcoder/TickZoomPublic
 public BaseStats(double startingEquity, TransactionPairs trades)
 {
     this.beginningBalance = startingEquity;
     this.trades           = trades;
     if (trades != null && trades.Count > 0)
     {
         calculate();
     }
 }
コード例 #6
0
 public void ProfitLossException()
 {
     pair = TransactionPairBinary.Create();
     using (BinaryStore tradeData = Factory.Engine.PageStore("TradeData")) {
         TransactionPairsBinary tradesBinary = new TransactionPairsBinary(tradeData);
         tradesBinary.Add(pair);
         TransactionPairs trades = new TransactionPairs(null, new ProfitLossCallback(), tradesBinary);
         double           pnl    = trades.CalcProfitLoss(0);
     }
 }
コード例 #7
0
        public void TradeTesting()
        {
            PerformanceInner      manager  = TradeTickProcessing(0, 0, 30000);
            TransactionPairBinary expected = TransactionPairBinary.Create();

            expected.Enter(1, 105.660, new TimeStamp(2005, 2, 8, 11, 57, 22, 429), emptyTime, 1, 0, 0);
            expected.Exit(105.670, new TimeStamp(2005, 2, 8, 11, 57, 51, 479), emptyTime, 1, 0, 0);
            TransactionPairs rts = manager.ComboTrades;

            Assert.AreEqual(-.034, Math.Round(rts.CalcProfitLoss(0), 3), "First Trade PnL");
        }
コード例 #8
0
        public void WeeklyTesting()
        {
            Performance      manager = TradeTickProcessing(0, 0, 30000);
            TransactionPairs weekly  = manager.Equity.Weekly;

            for (int i = 0; i < weekly.Count; i++)
            {
                log.Notice(i + ": " + weekly[i]);
            }
            Assert.AreEqual(6, weekly.Count, "Weekly Count");
            Assert.AreEqual(0.0, Math.Round(weekly.OpenProfitLoss, 3), "Final trade completion");
        }
コード例 #9
0
        public void ProfitLoss()
        {
            Constructor();
            double ProfitLoss = (pair.ExitPrice - pair.EntryPrice) * 1;

            using (BinaryStore tradeData = Factory.Engine.PageStore("TradeData")) {
                TransactionPairsBinary tradesBinary = new TransactionPairsBinary(tradeData);
                tradesBinary.Add(pair);
                TransactionPairs trades = new TransactionPairs(null, new ProfitLossCallback(), tradesBinary);
                Assert.AreEqual(113096, trades.CalcProfitLoss(0), "ProfitLoss");
            }
        }
コード例 #10
0
        public void MonthlyTesting()
        {
            Performance      manager = TradeTickProcessing(0, 0, 80000);
            TransactionPairs monthly = manager.Equity.Monthly;

            for (int i = 0; i < monthly.Count; i++)
            {
                log.Notice(i + ": " + monthly[i]);
            }
            Assert.AreEqual(5, monthly.Count, "Monthly Count");
            Assert.AreEqual(0.0, Math.Round(monthly.OpenProfitLoss, 3), "Final trade completion");
        }
コード例 #11
0
        public void RoundTurn2()
        {
            TransactionPairs fourTicksRTs  = fourTicksStrategy.Performance.ComboTrades;
            TransactionPairs fullTicksRTs  = fullTicksStrategy.Performance.ComboTrades;
            int             i              = 2;
            TransactionPair fourRT         = fourTicksRTs[i];
            TransactionPair fullRT         = fullTicksRTs[i];
            double          fourEntryPrice = Math.Round(fourRT.EntryPrice, 2).Round();
            double          fullEntryPrice = Math.Round(fullRT.EntryPrice, 2).Round();

            Assert.AreEqual(fourEntryPrice, fullEntryPrice, "Entry Price for Trade #" + i);
            Assert.AreEqual(fourRT.ExitPrice, fullRT.ExitPrice, "Exit Price for Trade #" + i);
        }
コード例 #12
0
 public void WriteTrades(TransactionPairs transactionPairs, TradeStats stats, bool combo)
 {
     if (transactionPairs != null && transactionPairs.Count > 0)
     {
         int    year           = 0;
         double currentBalance = stats.BeginningBalance;
         double yearBalance    = stats.BeginningBalance;
         double ytdProfitLoss  = 0;
         WriteTradeHeader();
         List <string> tableData = new List <string>();
         for (int i = 0; i < transactionPairs.Count; i++)
         {
             if (transactionPairs[i].EntryTime.Year != year)
             {
                 tableData.Add(WriteTradeTitles(year, combo));
                 yearBalance  += ytdProfitLoss;
                 ytdProfitLoss = 0;
                 year          = transactionPairs[i].EntryTime.Year;
             }
             double profitLoss = transactionPairs.CalcProfitLoss(i);
             string tableRow   = "<tr>";
             tableRow += "<td class=\"leftcol\">" + i + "</td>";
             tableRow += "<td class=\"data\">" + transactionPairs[i].EntryTime + "</td>";
             tableRow += "<td class=\"data\">" + transactionPairs[i].ExitTime + "</td>";
             tableRow += "<td class=\"data\">" + transactionPairs[i].EntryPrice.ToString(",0.000") + "</td>";
             tableRow += "<td class=\"data\">" + transactionPairs[i].EntryBar + "</td>";
             tableRow += "<td class=\"data\">" + transactionPairs[i].ExitPrice.ToString(",0.000") + "</td>";
             tableRow += "<td class=\"data\">" + transactionPairs[i].ExitBar + "</td>";
             tableRow += "<td class=\"data\">" + ((transactionPairs[i].Direction > 0)?"Long":"Short") + " " + Math.Round(Math.Abs(transactionPairs[i].Direction), 2) + "</td>";
             tableRow += "<td class=\"data\">" + Math.Round(transactionPairs.CalcMaxAdverse(i), 2) + "</td>";
             tableRow += "<td class=\"data\">" + Math.Round(transactionPairs.CalcMaxFavorable(i), 2) + "</td>";
             tableRow += "<td class=\"data\">" + Math.Round(profitLoss, 2) + "</td>";
             double monthlyReturn = ((currentBalance + profitLoss) / currentBalance) - 1;
             tableRow      += "<td class=\"data\">" + Math.Round(monthlyReturn * 100, 2) + "%</td>";
             ytdProfitLoss += profitLoss;
             double ytdReturn = ((yearBalance + ytdProfitLoss) / yearBalance) - 1;
             tableRow       += "<td class=\"data\">" + Math.Round(ytdReturn * 100, 2) + "%</td>";
             currentBalance += profitLoss;
             tableRow       += "<td class=\"data\">" + Math.Round(currentBalance, 2) + "</td>";
             tableRow       += "</tr>";
             tableData.Add(tableRow);
         }
         tableData.Add(WriteTradeTitles(year, combo));
         for (int i = 0; i < tableData.Count; i++)
         {
             fwriter.WriteLine(tableData[i]);
         }
         WriteTradeFooter();
     }
 }
コード例 #13
0
        public void DailyTesting()
        {
            Performance      manager = TradeTickProcessing(0, 0, 6000);
            TransactionPairs daily   = manager.Equity.Daily;

            if (debug)
            {
                for (int i = 0; i < daily.Count; i++)
                {
                    log.Debug(i + ": " + daily[i]);
                }
            }
            Assert.AreEqual(7, daily.Count, "Daily Count");
            Assert.AreEqual(0.0, Math.Round(daily.OpenProfitLoss, 3), "Final trade completion");
        }
コード例 #14
0
ファイル: Equity.cs プロジェクト: prid77/TickZoomPublic
        public void OnPostInitialize()
        {
            closedEquity       = startingEquity;
            daily              = new TransactionPairs(GetCurrentEquity, equityProfitLoss, dailyBinary);
            dailyBinary.Name   = "Daily";
            weeklyBinary       = new TransactionPairsBinary(model.Context.TradeData);
            weekly             = new TransactionPairs(GetCurrentEquity, equityProfitLoss, weeklyBinary);
            weeklyBinary.Name  = "Weekly";
            monthlyBinary      = new TransactionPairsBinary(model.Context.TradeData);
            monthly            = new TransactionPairs(GetCurrentEquity, equityProfitLoss, monthlyBinary);
            monthlyBinary.Name = "Monthly";
            yearlyBinary       = new TransactionPairsBinary(model.Context.TradeData);
            yearly             = new TransactionPairs(GetCurrentEquity, equityProfitLoss, yearlyBinary);
            yearlyBinary.Name  = "Yearly";

            if (graphEquity)
            {
                equity = new IndicatorCommon();
                equity.Drawing.IsVisible = true;
                equity.Drawing.PaneType  = PaneType.Secondary;
                equity.Drawing.GraphType = GraphType.FilledLine;
                equity.Drawing.Color     = Color.Green;
                equity.Drawing.GroupName = "SimpleEquity";
                equity.Name = "SimpleEquity";
                model.AddIndicator(equity);
            }

            if (enableYearlyStats)
            {
                model.RequestUpdate(Intervals.Year1);
            }
            if (enableMonthlyStats)
            {
                model.RequestUpdate(Intervals.Month1);
            }
            if (enableWeeklyStats)
            {
                model.RequestUpdate(Intervals.Week1);
            }
            if (enableDailyStats)
            {
                model.RequestUpdate(Intervals.Day1);
            }

            isInitialized = true;
        }
コード例 #15
0
        public void VerifyRoundTurn(int pairNum,
                                    string expectedEntryTime,
                                    double expectedEntryPrice,
                                    string expectedExitTime,
                                    double expectedExitPrice)
        {
            TransactionPairs transactionPairs = strategy.Performance.ComboTrades;

            Assert.Greater(transactionPairs.Count, pairNum);
            TransactionPair pair         = transactionPairs[pairNum];
            TimeStamp       expEntryTime = new TimeStamp(expectedEntryTime);

            Assert.AreEqual(expEntryTime, pair.EntryTime, "Pair " + pairNum + " Entry");
            Assert.AreEqual(expectedEntryPrice, pair.EntryPrice, "Pair " + pairNum + " Entry");

            Assert.AreEqual(new TimeStamp(expectedExitTime), pair.ExitTime, "Pair " + pairNum + " Exit");
            Assert.AreEqual(expectedExitPrice, pair.ExitPrice, "Pair " + pairNum + " Exit");

            double direction = pair.Direction;
        }
コード例 #16
0
 public void WriteDays(TransactionPairs trades, TradeStats stats)
 {
     if (trades.Count > 0)
     {
         int    year           = 0;
         double currentBalance = stats.BeginningBalance;
         double yearBalance    = stats.BeginningBalance;
         double ytdProfitLoss  = 0;
         WriteYearHeader();
         List <string> tableData = new List <string>();
         for (int i = 0; i < trades.Count; i++)
         {
             if (trades[i].EntryTime.Year != year)
             {
                 tableData.Add(WriteYearTitles(year));
                 yearBalance   = yearBalance + ytdProfitLoss;
                 ytdProfitLoss = 0;
                 year          = trades[i].EntryTime.Year;
             }
             double profitLoss = trades.CalcProfitLoss(i);
             string tableRow   = "<tr>";
             tableRow += "<td class=\"leftcol\">" + trades[i].EntryTime.Month + "/" + trades[i].EntryTime.Day + "/" + year + "</td>";
             tableRow += "<td class=\"data\">" + Math.Round(profitLoss, 2) + "</td>";
             double monthlyReturn = ((currentBalance + profitLoss) / currentBalance) - 1;
             tableRow      += "<td class=\"data\">" + Math.Round(monthlyReturn * 100, 2) + "%</td>";
             ytdProfitLoss += profitLoss;
             double ytdReturn = ((yearBalance + ytdProfitLoss) / yearBalance) - 1;
             tableRow       += "<td class=\"data\">" + Math.Round(ytdReturn * 100, 2) + "%</td>";
             currentBalance += profitLoss;
             tableRow       += "<td class=\"data\">" + Math.Round(currentBalance, 2) + "</td>";
             tableRow       += "</tr>";
             tableData.Add(tableRow);
         }
         tableData.Add(WriteYearTitles(year));
         for (int i = tableData.Count - 1; i >= 0; i--)
         {
             fwriter.WriteLine(tableData[i]);
         }
         WriteYearFooter();
     }
 }
コード例 #17
0
 public void CompareAllRoundTurns()
 {
     try {
         var result = true;
         TransactionPairs fourTicksRTs = fourTicksStrategy.Performance.ComboTrades;
         TransactionPairs fullTicksRTs = fullTicksStrategy.Performance.ComboTrades;
         for (int i = 0; i < fourTicksRTs.Count && i < fullTicksRTs.Count; i++)
         {
             TransactionPair fourRT         = fourTicksRTs[i];
             TransactionPair fullRT         = fullTicksRTs[i];
             double          fourEntryPrice = Math.Round(fourRT.EntryPrice, 2).Round();
             double          fullEntryPrice = Math.Round(fullRT.EntryPrice, 2).Round();
             if (fourEntryPrice != fullEntryPrice || fourRT.ExitPrice != fullRT.ExitPrice)
             {
                 log.Error("Expected " + fullRT + " but was " + fourRT);
                 result = false;
             }
         }
         Assert.IsTrue(result, "trade mismatches. See log file.");
     } catch {
         testFailed = true;
         throw;
     }
 }
コード例 #18
0
ファイル: BaseStats.cs プロジェクト: zoomcoder/TickZoomPublic
 public BaseStats(TransactionPairs trades) : this(6000, trades)
 {
 }
コード例 #19
0
 public TradeStats(TransactionPairs trades) : this(6000, trades)
 {
     this.trades = trades;
 }
コード例 #20
0
 public override void Constructor(TransactionPairs trades)
 {
     equityStats = new EquityStats(trades, trades, trades, trades);
     baseStats   = tradeStats = equityStats.Daily;
 }
コード例 #21
0
 public override void Constructor(TransactionPairs trades)
 {
     tradeStats      = new TradeStats(trades);
     tradeStats.Name = "Test Strategy";
     baseStats       = tradeStats;
 }
コード例 #22
0
        public void Setup()
        {
            starter = new HistoricalStarter();
            random  = new RandomCommon();
            ProfitLossDefault profitLossLogic = new ProfitLossDefault();

            profitLossLogic.Slippage   = 0.0140;
            profitLossLogic.Commission = 0.010;
//			if( trace) log.Trace("RandomTest engine.Formula.Chain="+starter.Model.Chain.ToString());
            exits = random.ExitStrategy;

            exits.StopLoss     = 0.050;
            exits.TargetProfit = 0;

            starter.EndCount   = maxCount;
            starter.DataFolder = "Test\\DataCache";
            starter.ProjectProperties.Starter.SetSymbols("USD_JPY");
            starter.ProjectProperties.Starter.SymbolProperties[0].ProfitLoss = profitLossLogic;
            starter.Run(random);

            Constructor(random.Performance.ComboTrades);
            Assert.IsNotNull(baseStats, "MoneyManagerSupport constructor");
            Assert.Greater(random.Performance.ComboTrades.Count, 0, "Need some trades to do this.");

//			Uncomment this loop to log the trades and compare to below
//			as to what they're supposed to be.

            TransactionPairs trades = random.Performance.ComboTrades;

            if (log.IsDebugEnabled)
            {
                for (int i = 0; i < trades.Count; i++)
                {
                    log.Debug(i + ": " + trades[i]);
                }
            }

//			0: 1,105320,2005-05-02 07:03:15.780,105340,2005-05-02 07:17:13.252,-4
//			1: 1,105290,2005-05-02 07:54:03.050,105350,2005-05-02 08:14:14.963,36
//			2: 1,105360,2005-05-02 08:52:45.785,105310,2005-05-02 09:09:21.169,-74
//			3: 1,105290,2005-05-02 09:17:29.899,105240,2005-05-02 09:20:28.225,-74
//			4: -1,105150,2005-05-02 09:39:43.181,105100,2005-05-02 09:50:51.729,26
//			5: -1,105030,2005-05-02 10:56:39.451,105080,2005-05-02 11:03:35.995,-74
//			6: 1,105200,2005-05-03 08:15:15.668,105150,2005-05-03 08:27:06.849,-74
//			7: -1,105140,2005-05-03 08:28:17.901,105150,2005-05-03 08:50:41.761,-34
//			8: 1,105150,2005-05-03 08:50:41.761,105130,2005-05-03 09:06:53.403,-44
//			9: -1,105130,2005-05-03 09:06:53.403,105130,2005-05-03 09:13:21.062,-24
//			10: 1,105130,2005-05-03 09:13:21.062,105120,2005-05-03 09:13:23.069,-34
//			11: -1,105090,2005-05-03 09:22:26.334,105090,2005-05-03 09:27:19.877,-24
//			12: 1,105090,2005-05-03 09:27:19.877,105130,2005-05-03 09:41:10.694,16
//			13: 1,105170,2005-05-03 09:46:34.495,105120,2005-05-03 10:00:54.735,-74
//			14: -1,105030,2005-05-03 10:35:11.274,105080,2005-05-03 10:40:38.072,-74
//			15: 1,105080,2005-05-03 10:41:02.126,105030,2005-05-03 10:45:26.821,-74
//			16: -1,105020,2005-05-03 10:57:16.127,105020,2005-05-03 10:59:47.711,-24
//			17: 1,105020,2005-05-03 10:59:47.711,104560,2005-05-04 07:00:08.015,-484
//			18: -1,104580,2005-05-04 07:14:00.252,104550,2005-05-04 07:35:09.332,6
//			19: -1,104570,2005-05-04 07:36:17.436,104360,2005-05-04 08:37:57.786,186
//			20: 1,104350,2005-05-04 08:55:14.192,104380,2005-05-04 08:57:09.379,6
//			21: 1,104390,2005-05-04 08:58:04.483,104360,2005-05-04 09:14:58.643,-54
//			22: -1,104360,2005-05-04 09:14:58.643,104410,2005-05-04 10:04:56.162,-74
//			23: 1,104370,2005-05-04 10:05:56.490,104350,2005-05-04 10:09:10.388,-44
//			24: -1,104330,2005-05-04 10:16:46.307,104380,2005-05-04 10:19:28.029,-74
//			25: 1,104370,2005-05-04 10:39:09.740,104320,2005-05-04 11:31:52.298,-74
//			26: -1,104310,2005-05-05 07:15:37.270,104320,2005-05-05 07:17:28.372,-34
//			27: 1,104320,2005-05-05 07:17:28.372,104300,2005-05-05 07:30:10.182,-44
//			28: -1,104300,2005-05-05 07:30:10.182,104280,2005-05-05 07:33:38.448,-4
//			29: 1,104280,2005-05-05 07:33:38.448,104350,2005-05-05 07:49:07.816,46
//			30: -1,104350,2005-05-05 07:49:07.816,104380,2005-05-05 07:58:18.351,-54
//			31: 1,104380,2005-05-05 07:58:18.351,104400,2005-05-05 08:20:17.920,-4
//			32: -1,104440,2005-05-05 08:48:45.249,104480,2005-05-05 08:53:22.514,-64
//			33: 1,104480,2005-05-05 08:53:22.514,104430,2005-05-05 08:58:35.105,-74
//			34: -1,104390,2005-05-05 09:11:35.199,104310,2005-05-05 09:23:22.693,56
//			35: -1,104350,2005-05-05 09:31:55.188,104310,2005-05-05 09:36:50.454,16
//			36: 1,104310,2005-05-05 09:36:50.454,104260,2005-05-05 09:39:34.270,-74
//			37: -1,104330,2005-05-05 09:44:25.264,104380,2005-05-05 10:12:27.183,-74
//			38: 1,104380,2005-05-05 10:17:07.033,104400,2005-05-05 10:25:06.165,-4
//			39: -1,104400,2005-05-05 10:25:06.165,104380,2005-05-05 10:38:55.157,-4
//			40: 1,104380,2005-05-05 10:38:55.157,104400,2005-05-05 10:48:58.981,-4
//			41: -1,104650,2005-05-06 07:01:39.259,104570,2005-05-06 07:28:32.159,56
//			42: 1,104570,2005-05-06 07:28:32.159,104560,2005-05-06 07:29:17.237,-34
//			43: -1,104560,2005-05-06 07:29:17.237,104610,2005-05-06 07:37:44.939,-74
//			44: 1,104630,2005-05-06 07:45:41.450,104640,2005-05-06 07:50:24.819,-14
//			45: -1,104640,2005-05-06 07:50:24.819,104690,2005-05-06 08:20:10.236,-74
//			46: 1,104650,2005-05-06 08:23:44.508,104600,2005-05-06 08:25:20.657,-74
//			47: -1,104670,2005-05-06 08:41:00.760,104670,2005-05-06 08:52:22.779,-24
//			48: 1,104670,2005-05-06 08:52:22.779,104880,2005-05-06 10:05:32.889,186
//			49: -1,104880,2005-05-06 10:05:32.889,104930,2005-05-06 10:07:50.758,-74
//			50: 1,104880,2005-05-06 10:13:17.204,104830,2005-05-06 10:17:29.806,-74
//			51: -1,105340,2005-05-09 07:05:17.394,105330,2005-05-09 07:17:59.670,-14
//			52: -1,105440,2005-05-09 07:57:01.620,105430,2005-05-09 07:58:14.761,-14
//			53: 1,105500,2005-05-09 08:05:47.007,105550,2005-05-09 08:19:47.822,26
//			54: -1,105550,2005-05-09 08:19:47.822,105550,2005-05-09 08:44:05.031,-24
//			55: 1,105550,2005-05-09 08:44:05.031,105560,2005-05-09 08:46:13.252,-14
//			56: -1,105640,2005-05-09 09:40:07.041,105650,2005-05-09 09:42:20.374,-34
//			57: 1,105640,2005-05-09 09:51:28.282,105590,2005-05-09 10:23:27.903,-74
//			58: -1,105580,2005-05-09 10:31:25.122,105450,2005-05-09 10:50:01.571,106
//			59: 1,105500,2005-05-09 10:56:53.779,105450,2005-05-09 11:01:38.771,-74
//			60: -1,105740,2005-05-10 07:11:21.000,105790,2005-05-10 07:15:37.285,-74
//			61: 1,105800,2005-05-10 07:34:23.674,105780,2005-05-10 07:39:13.942,-44
//			62: -1,105750,2005-05-10 07:46:10.319,105680,2005-05-10 07:56:54.954,46
//			63: 1,105670,2005-05-10 08:00:31.695,105650,2005-05-10 08:21:01.701,-44
//			64: -1,105650,2005-05-10 08:21:01.701,105700,2005-05-10 08:24:49.989,-74
//			65: 1,105630,2005-05-10 09:05:32.461,105640,2005-05-10 09:08:21.796,-14
//			66: -1,105690,2005-05-10 09:36:12.151,105680,2005-05-10 09:36:14.159,-14
//			67: 1,105650,2005-05-10 09:40:32.881,105600,2005-05-10 10:20:21.059,-74
//			68: -1,105320,2005-05-11 07:08:37.727,105370,2005-05-11 07:18:52.385,-74
//			69: -1,105340,2005-05-11 07:42:10.367,105390,2005-05-11 08:00:00.540,-74
//			70: -1,105310,2005-05-11 08:55:55.425,105360,2005-05-11 09:04:32.125,-74
//			71: -1,105730,2005-05-11 10:30:08.455,105780,2005-05-11 10:39:14.956,-74
//			72: 1,105790,2005-05-11 10:54:20.286,105780,2005-05-11 10:55:14.459,-34
//			73: -1,106170,2005-05-12 07:42:12.249,106170,2005-05-12 07:43:54.354,-24
//			74: 1,106170,2005-05-12 07:43:54.354,106190,2005-05-12 07:54:52.477,-4
//			75: -1,106190,2005-05-12 07:54:52.477,106240,2005-05-12 08:05:43.074,-74
//			76: 1,106200,2005-05-12 08:58:00.634,106330,2005-05-12 09:25:46.966,106
//			77: -1,106350,2005-05-12 09:25:50.990,106400,2005-05-12 09:30:06.405,-74
//			78: 1,106560,2005-05-12 09:34:38.202,106510,2005-05-12 09:37:45.404,-74
//			79: -1,106540,2005-05-12 09:41:18.723,106590,2005-05-12 09:41:35.848,-74
//			80: 1,106810,2005-05-12 09:51:16.964,106760,2005-05-12 10:00:18.694,-74
//			81: 1,106760,2005-05-12 10:18:24.240,106710,2005-05-12 10:22:12.811,-74
//			82: -1,106710,2005-05-12 10:30:24.395,106660,2005-05-12 10:45:29.119,26
//			83: -1,107150,2005-05-13 07:04:27.764,107110,2005-05-13 07:29:20.582,16
//			84: -1,107140,2005-05-13 07:41:59.288,107130,2005-05-13 07:52:12.783,-14
//			85: -1,107160,2005-05-13 08:19:21.248,107170,2005-05-13 08:22:04.536,-34
//			86: -1,107190,2005-05-13 08:27:09.344,106990,2005-05-13 09:12:49.761,176
//			87: 1,107010,2005-05-13 09:13:18.828,107050,2005-05-13 09:42:06.278,16
//			88: 1,107060,2005-05-13 10:11:03.404,107010,2005-05-13 10:16:29.550,-74
//			89: -1,107000,2005-05-13 10:19:57.488,107000,2005-05-13 10:20:08.546,-24
//			90: 1,107030,2005-05-13 10:29:35.827,106980,2005-05-13 10:48:34.986,-74
//			91: -1,107600,2005-05-16 07:15:10.967,107610,2005-05-16 07:21:01.890,-34
//			92: 1,107610,2005-05-16 07:21:01.890,107650,2005-05-16 07:28:22.086,16
//			93: 1,107690,2005-05-16 07:44:35.337,107640,2005-05-16 08:24:16.973,-74
//			94: 1,107670,2005-05-16 08:43:05.620,107620,2005-05-16 08:48:17.126,-74
//			95: 1,107570,2005-05-16 08:58:13.199,107520,2005-05-16 09:04:11.077,-74
//			96: 1,107500,2005-05-16 09:40:47.135,107550,2005-05-16 09:47:59.110,26
//			97: -1,107550,2005-05-16 09:47:59.110,107580,2005-05-16 09:53:58.018,-54
//			98: -1,107360,2005-05-16 10:27:58.643,107260,2005-05-16 10:53:31.461,76
//			99: -1,107090,2005-05-17 07:12:45.688,107140,2005-05-17 07:40:22.556,-74
//			100: 1,107160,2005-05-17 07:43:11.816,107320,2005-05-17 08:01:22.581,136
//			101: 1,107290,2005-05-17 08:14:02.953,107290,2005-05-17 08:16:20.162,-24
//			102: 1,107220,2005-05-17 08:28:27.371,107280,2005-05-17 08:40:03.957,36
//			103: -1,107280,2005-05-17 08:40:03.957,107330,2005-05-17 08:40:53.166,-74
//			104: 1,107310,2005-05-17 08:58:08.957,107260,2005-05-17 09:08:43.168,-74
//			105: -1,107220,2005-05-17 09:09:25.268,107270,2005-05-17 09:17:34.236,-74
//			106: 1,107330,2005-05-17 09:46:01.885,107280,2005-05-17 09:54:44.600,-74
//			107: -1,107310,2005-05-17 10:05:58.137,107250,2005-05-17 10:30:07.419,36
//			108: 1,107420,2005-05-18 07:07:26.938,107420,2005-05-18 07:16:12.837,-24
//			109: -1,107420,2005-05-18 07:16:12.837,107470,2005-05-18 07:27:53.753,-74
        }
コード例 #23
0
        public void Trades()
        {
            TransactionPairs trades = baseStats.Trades;

            Assert.AreEqual(trades, baseStats.Trades, "Trades (list)");
        }
コード例 #24
0
 public virtual void Constructor(TransactionPairs trades)
 {
     baseStats = new BaseStats(trades);
 }
コード例 #25
0
 public StrategyStats(TransactionPairs combo)
 {
     this.comboTrades = new TradeStats(combo);
 }
コード例 #26
0
 public EquityStats(TransactionPairs daily, TransactionPairs weekly, TransactionPairs monthly, TransactionPairs yearly)
     : this(6000, daily, weekly, monthly, yearly)
 {
 }
コード例 #27
0
 public override void Constructor(TransactionPairs trades)
 {
     strategyStats = new StrategyStats(trades);
     equityStats   = new EquityStats(trades, trades, trades, trades);
     baseStats     = tradeStats = strategyStats.ComboTrades;
 }
コード例 #28
0
        public void WriteChart(string folder, string strategyName, string chartName, TradeStats stats, TransactionPairs daily)
        {
            if (daily.Count == 0)
            {
                return;
            }
            GraphPane myPane = new GraphPane(new RectangleF(0, 0, 640, 480),
                                             chartName, "Date", "Price");

            PointPairList ppl = new PointPairList();
            double        y   = stats.BeginningBalance;

            ppl.Add(daily[0].EntryTime.ToOADate(), y);
            for (int i = 0; i < daily.Count; i++)
            {
                y += daily.CalcProfitLoss(i);
                ppl.Add(daily[i].ExitTime.ToOADate(), y);
            }

            if (trace)
            {
                log.Trace("Chart start = " + ppl[0].Y + ", end = " + ppl[ppl.Count - 1].Y);
            }

            LineItem myCurve = myPane.AddCurve("Profit/Loss Equity Curve", ppl, Color.Blue, SymbolType.None);

            myCurve.Line.Fill = new Fill(Color.Blue);

            // pretty it up a little
            myPane.Chart.Fill                = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f);
            myPane.Fill                      = new Fill(Color.White);
            myPane.Border.IsVisible          = false;
            myPane.Title.FontSpec.Size       = 20.0f;
            myPane.XAxis.Type                = AxisType.DateAsOrdinal;
            myPane.XAxis.Title.FontSpec.Size = 14.0f;
            myPane.XAxis.Scale.FontSpec.Size = 14.0f;
            myPane.XAxis.Title.IsOmitMag     = true;

            myPane.YAxis.Title.FontSpec.Size = 14.0f;
            myPane.YAxis.Scale.FontSpec.Size = 14.0f;
//		    myPane.YAxis.Title.IsOmitMag = true;
            myPane.Legend.IsVisible = false;

            myPane.AxisChange();

            string pathName = folder + strategyName + @"\Images\" + chartName + ".gif";

            Directory.CreateDirectory(Path.GetDirectoryName(pathName));
            myPane.GetImage().Save(pathName, ImageFormat.Gif);
        }