public override void RunStrategy() { Assert.Ignore(); CleanupFiles(null, null); StartGUIThread(); try { Starter starter = new HistoricalStarter(); // Set run properties as in the GUI. starter.ProjectProperties.Starter.StartTime = new TimeStamp(1800, 1, 1); starter.ProjectProperties.Starter.EndTime = new TimeStamp(2010, 1, 1); starter.DataFolder = "Test"; starter.ProjectProperties.Starter.SetSymbols("USD/JPY"); starter.CreateChartCallback = new CreateChartCallback(HistoricalCreateChart); starter.ShowChartCallback = new ShowChartCallback(HistoricalShowChart); // Run the loader. ExampleCustomBarsLoader loader = new ExampleCustomBarsLoader(); starter.Run(loader); // Get the stategy strategy = loader.TopModel as ExampleReversalStrategy; LoadTransactions(); LoadTrades(); LoadBarData(); } catch (Exception ex) { log.Error("Setup error.", ex); throw; } }
public override void RunStrategy() { CleanupFiles(null, null); StartGUIThread(); try { Starter starter = new HistoricalStarter(); // Set run properties as in the GUI. starter.ProjectProperties.Starter.StartTime = new TimeStamp(1800, 1, 1); starter.ProjectProperties.Starter.EndTime = new TimeStamp(1990, 1, 1); starter.DataFolder = "Test"; starter.ProjectProperties.Starter.SetSymbols("Daily4Sim"); starter.ProjectProperties.Starter.IntervalDefault = Intervals.Day1; starter.CreateChartCallback = new CreateChartCallback(HistoricalCreateChart); starter.ShowChartCallback = new ShowChartCallback(HistoricalShowChart); // Run the loader. ExampleLimitOrderLoader loader = new ExampleLimitOrderLoader(); starter.Run(loader); // Get the stategy strategy = loader.TopModel as ExampleOrderStrategy; LoadTransactions(); LoadTrades(); LoadBarData(); } catch (Exception ex) { log.Error("Setup error.", ex); throw; } }
public override void RunStrategy() { CleanupFiles(); StartGUIThread(); try { Starter starter = new HistoricalStarter(); // Set run properties as in the GUI. starter.ProjectProperties.Starter.StartTime = new TimeStamp(1800, 1, 1); starter.ProjectProperties.Starter.EndTime = new TimeStamp(2010, 1, 1); starter.DataFolder = "Test\\DataCache"; starter.ProjectProperties.Starter.SetSymbols("USD/JPY"); starter.ProjectProperties.Starter.IntervalDefault = Intervals.Minute1; starter.CreateChartCallback = new CreateChartCallback(HistoricalCreateChart); starter.ShowChartCallback = new ShowChartCallback(HistoricalShowChart); // Run the loader. ExampleBreakoutStopsLoader loader = new ExampleBreakoutStopsLoader(); starter.Run(loader); // Get the stategy strategy = loader.TopModel as ExampleBreakoutStops; LoadTransactions(); LoadTrades(); LoadBarData(); } catch (Exception ex) { log.Error("Setup error.", ex); throw; } }
public override void RunStrategy() { Assert.Ignore(); CleanupFiles(); StartGUIThread(); Starter starter = new HistoricalStarter(); // Set run properties as in the GUI. starter.ProjectProperties.Starter.StartTime = new TimeStamp(2009, 8, 3); starter.ProjectProperties.Starter.EndTime = new TimeStamp(2009, 8, 4); starter.DataFolder = "Test\\DataCache"; starter.ProjectProperties.Starter.SetSymbols("TXF.Test"); starter.ProjectProperties.Starter.IntervalDefault = Intervals.Minute1; starter.CreateChartCallback = new CreateChartCallback(HistoricalCreateChart); starter.ShowChartCallback = new ShowChartCallback(HistoricalShowChart); // Run the loader. ExampleReversalLoader loader = new ExampleReversalLoader(); starter.Run(loader); // Get the stategy strategy = loader.TopModel as ExampleReversalStrategy; IList <DiagramAttribute> aspects = DiagramHelper.GetAspectsByCalls(); for (int i = 0; i < aspects.Count && i < 100; i++) { var aspect = aspects[i]; log.Notice(aspect.TypeName + "." + aspect.MethodSignature + ": " + aspect.CallCount); } }
public void Ticket123() { Starter starter = new HistoricalStarter(); starter.DataFolder = "Test"; starter.ProjectProperties.Starter.SetSymbols("spyTestBars"); Interval intervalDefault = Intervals.Minute1; starter.ProjectProperties.Starter.IntervalDefault = intervalDefault; // No charting setup for these tests. Running without charts. starter.CreateChartCallback = new CreateChartCallback(HistoricalCreateChart); starter.ShowChartCallback = new ShowChartCallback(HistoricalShowChart); ModelLoaderInterface loader = new MQ_BadFakeTickLoader(); starter.Run(loader); Portfolio portfolio = loader.TopModel as Portfolio; MQ_BadFakeTick_0 mq0 = (MQ_BadFakeTick_0)portfolio.Strategies[0]; MQ_BadFakeTick_1 mq1 = (MQ_BadFakeTick_1)portfolio.Strategies[1]; MQ_BadFakeTick_2 mq2 = (MQ_BadFakeTick_2)portfolio.Strategies[2]; double mq0Net = mq0.Performance.Equity.CurrentEquity - mq0.Performance.Equity.StartingEquity; double mq1Net = mq1.Performance.Equity.CurrentEquity - mq1.Performance.Equity.StartingEquity; double mq2Net = mq2.Performance.Equity.CurrentEquity - mq2.Performance.Equity.StartingEquity; double total = mq0Net + mq1Net + mq2Net; Assert.AreEqual(26.00, Math.Round(mq0.Performance.ComboTrades.CalcProfitLoss(0), 2)); Assert.AreEqual(-27.5, Math.Round(mq1.Performance.ComboTrades.CalcProfitLoss(0), 2)); Assert.AreEqual(-14.5, Math.Round(mq2.Performance.ComboTrades.CalcProfitLoss(0), 2)); Assert.AreEqual(-9.00, Math.Round(portfolio.Performance.ComboTrades.CalcProfitLoss(0), 2)); Assert.AreEqual(-16.00, Math.Round(portfolio.Performance.Equity.CurrentEquity - portfolio.Performance.Equity.StartingEquity, 2)); }
public void TestOneGeneticPass() { var starter = new HistoricalStarter(); starter.ProjectProperties.Starter.StartTime = (TimeStamp) new DateTime(2005,1,1); starter.ProjectProperties.Starter.EndTime = (TimeStamp) new DateTime(2006,2,1); starter.ProjectProperties.Starter.IntervalDefault = Intervals.Hour1; starter.DataFolder = "Test\\DataCache"; starter.ProjectProperties.Starter.SetSymbols("USD_JPY"); starter.Run(new GeneticLoader()); // Assert.IsTrue(FileCompare(storageFolder+@"\Statistics\optimizeResults.csv",@"..\..\Platform\TickZoomTesting\Startup\geneticResults.csv")); }
public void TickProcessing() { strategy = new RandomCommon(); strategy.IntervalDefault = Intervals.Day1; Starter starter = new HistoricalStarter(); starter.EndCount = 2048; starter.ProjectProperties.Starter.SetSymbols("USD_JPY_YEARS"); starter.DataFolder = "Test\\DataCache"; starter.Run(strategy); }
public void WeekProcessingSetup() { logic = new StrategySupportMock(); weeklogic = new StrategySupportMock(); Starter starter = new HistoricalStarter(); starter.ProjectProperties.Starter.SetSymbols("USD_JPY"); starter.ProjectProperties.Starter.SymbolInfo[0].SessionStart = new Elapsed(6, 20, 0); starter.ProjectProperties.Starter.SymbolInfo[0].SessionEnd = new Elapsed(15, 0, 0); starter.DataFolder = "Test\\DataCache"; starter.Run(weeklogic); }
public void TickProcessing() { strategy = new RandomCommon(); Starter starter = new HistoricalStarter(); starter.ProjectProperties.Starter.StartTime = new TimeStamp(2004, 1, 1, 0, 0, 0); starter.ProjectProperties.Starter.EndTime = new TimeStamp(2007, 1, 1, 0, 0, 0); starter.EndCount = 2049; starter.ProjectProperties.Starter.SetSymbols("USD_JPY_YEARS"); starter.DataFolder = "Test\\DataCache"; starter.Run(strategy); }
public void InitializeTick() { logic = new StrategySupportMock(); Starter starter = new HistoricalStarter(); starter.EndCount = 1; starter.ProjectProperties.Starter.SetSymbols(symbol); Elapsed start = new Elapsed(6, 0, 0); Elapsed end = new Elapsed(15, 0, 0); starter.DataFolder = "Test\\DataCache"; starter.Run(logic); }
public void TestHistorical() { Starter starter = new HistoricalStarter(); starter.ProjectProperties.Starter.StartTime = (TimeStamp) new DateTime(2005,1,1); starter.ProjectProperties.Starter.EndTime = (TimeStamp) new DateTime(2006,2,1); starter.DataFolder = "Test\\DataCache"; starter.ProjectProperties.Starter.SetSymbols("USD_JPY"); Interval intervalDefault = Intervals.Hour1; starter.ProjectProperties.Starter.IntervalDefault = intervalDefault; // No charting setup for these tests. Running without charts. ModelLoaderInterface loader = new OptimizeLoader(); starter.Run(loader); Portfolio strategy = loader.TopModel as Portfolio; Assert.AreEqual(39,strategy.Performance.ComboTrades.Count); }
public void DataSeriesSetup() { Strategy logic = new Strategy(); ExitStrategy exit = logic.ExitStrategy; Starter starter = new HistoricalStarter(); starter.EndCount = 1; starter.ProjectProperties.Starter.SetSymbols("USD_JPY_YEARS"); starter.ProjectProperties.Starter.IntervalDefault = Intervals.Hour1; starter.DataFolder = "Test"; starter.Run(logic); Assert.AreSame(logic.Hours, logic.Hours, "Exit Signal before entry"); Assert.AreSame(logic.Ticks, logic.Ticks, "Exit Signal before entry"); Assert.AreEqual(1, logic.Hours.Count, "Number of hour bars "); Assert.AreEqual(1, logic.Ticks.Count, "Number of tick bars "); }
public void RunStrategy() { Starter starter = new HistoricalStarter(); // Set run properties as in the GUI. starter.ProjectProperties.Starter.StartTime = new TimeStamp(1800, 1, 1); starter.ProjectProperties.Starter.EndTime = new TimeStamp(1990, 5, 28); starter.DataFolder = "Test\\DataCache"; starter.ProjectProperties.Starter.SetSymbols("FullTick"); starter.ProjectProperties.Starter.IntervalDefault = Intervals.Day1; // Run the loader. ExampleMultiStrategyLoader loader = new ExampleMultiStrategyLoader(); starter.Run(loader); // Get the stategy strategy = loader.TopModel as ExampleMultiStrategy; }
public PerformanceInner TradeTickProcessing(int stop, int target, int count) { // Creation. RandomCommon random = new RandomCommon(); PerformanceInner performance = new PerformanceInner(random); var symbol = Factory.Symbol.LookupSymbol("USD_JPY_YEARS"); ProfitLossDefault profitLossLogic = new ProfitLossDefault(symbol); profitLossLogic.Slippage = 0.0140; profitLossLogic.Commission = 0.010; random.Performance = performance; random.Performance.Equity.EnableMonthlyStats = true; random.Performance.Equity.EnableWeeklyStats = true; // Stops random.ExitStrategy.StopLoss = stop; Starter starter = new HistoricalStarter(); starter.StartCount = 0; starter.EndCount = starter.StartCount + count + 1; starter.ProjectProperties.Starter.SetSymbols("USD_JPY_YEARS"); starter.ProjectProperties.Starter.SymbolProperties[0].ProfitLoss = profitLossLogic; starter.DataFolder = "Test"; starter.Run(random); Assert.AreEqual(performance, random.Performance); Assert.AreEqual(performance.tradingSignalTest, random.Performance.Position); // Signal Times BEFORE applying stops or target // 0: 1: time: 2004-07-22 08:02:08.757 bid: 109440 ask: 109440 // 1: 0: time: 2004-07-22 08:17:22.292 bid: 109500 ask: 109500 // 2: 1: time: 2004-07-22 08:53:46.250 bid: 109500 ask: 109500 // 3: 0: time: 2004-07-22 09:13:55.649 bid: 109440 ask: 109440 // 4: 1: time: 2004-07-22 09:52:09.466 bid: 109510 ask: 109510 // 5: 0: time: 2004-07-22 10:15:41.148 bid: 109480 ask: 109480 // 6: 1: time: 2004-07-22 10:17:15.545 bid: 109460 ask: 109460 // 7: 0: time: 2004-07-22 10:25:51.115 bid: 109430 ask: 109430 // 8: -1: time: 2004-07-22 10:39:44.278 bid: 109300 ask: 109300 // 9: 0: time: 2004-07-22 10:50:38.874 bid: 109440 ask: 109440 // 10: -1: time: 2004-07-22 11:56:52.119 bid: 109650 ask: 109650 // 11: 0: time: 2004-07-22 12:00:06.510 bid: 109640 ask: 109640 // 12: -1: time: 2004-07-23 08:01:04.984 bid: 110140 ask: 110140 // 13: 0: time: 2004-07-23 08:59:47.208 bid: 110060 ask: 110060 // 14: 1: time: 2004-07-23 09:15:11.005 bid: 110040 ask: 110040 // 15: -1: time: 2004-07-23 09:27:48.083 bid: 110030 ask: 110030 // 16: 1: time: 2004-07-23 09:50:06.263 bid: 110040 ask: 110040 // 17: -1: time: 2004-07-23 10:06:45.265 bid: 110030 ask: 110030 // 18: 1: time: 2004-07-23 10:12:18.754 bid: 110010 ask: 110010 // 19: 0: time: 2004-07-23 10:13:04.936 bid: 109980 ask: 109980 // 20: -1: time: 2004-07-23 10:22:03.758 bid: 110030 ask: 110030 // 21: 1: time: 2004-07-23 10:27:12.674 bid: 110020 ask: 110020 // 22: 0: time: 2004-07-23 10:40:50.220 bid: 109990 ask: 109990 // 23: 1: time: 2004-07-23 10:46:57.644 bid: 109990 ask: 109990 // 24: -1: time: 2004-07-23 11:34:50.614 bid: 110060 ask: 110060 // 25: 1: time: 2004-07-23 11:40:56.003 bid: 109970 ask: 109970 // 26: -1: time: 2004-07-23 11:57:13.950 bid: 110050 ask: 110050 // 27: 1: time: 2004-07-23 11:59:46.275 bid: 110080 ask: 110080 // 28: 0: time: 2004-07-23 12:00:06.336 bid: 110100 ask: 110100 // 29: -1: time: 2004-07-27 08:14:04.988 bid: 109800 ask: 109800 // 30: 1: time: 2004-07-27 08:17:55.551 bid: 109820 ask: 109820 // 31: -1: time: 2004-07-27 08:30:10.289 bid: 109860 ask: 109860 // 32: 1: time: 2004-07-27 08:33:25.932 bid: 109930 ask: 109930 // 33: -1: time: 2004-07-27 08:48:41.252 bid: 109940 ask: 109940 // 34: 1: time: 2004-07-27 08:58:40.535 bid: 109960 ask: 109960 // 35: 0: time: 2004-07-27 09:19:58.806 bid: 110240 ask: 110240 // 36: -1: time: 2004-07-27 09:48:02.851 bid: 110310 ask: 110310 // 37: 1: time: 2004-07-27 09:53:33.746 bid: 110330 ask: 110330 // 38: -1: time: 2004-07-27 10:10:49.768 bid: 110600 ask: 110600 // 39: 0: time: 2004-07-27 10:23:21.270 bid: 110660 ask: 110660 // 40: -1: time: 2004-07-27 10:31:54.263 bid: 110700 ask: 110700 // 41: 1: time: 2004-07-27 10:36:49.036 bid: 110810 ask: 110810 // 42: -1: time: 2004-07-27 10:44:22.552 bid: 110850 ask: 110850 // 43: 1: time: 2004-07-27 11:16:57.432 bid: 110910 ask: 110910 // 44: -1: time: 2004-07-27 11:26:19.378 bid: 110930 ask: 110930 // 45: 1: time: 2004-07-27 11:38:49.009 bid: 110970 ask: 110970 // 46: 0: time: 2004-07-27 11:48:44.955 bid: 111040 ask: 111040 // 47: -1: time: 2004-07-28 08:01:47.851 bid: 111410 ask: 111410 // 48: 1: time: 2004-07-28 08:28:33.049 bid: 111610 ask: 111610 // 49: -1: time: 2004-07-28 08:29:08.191 bid: 111600 ask: 111600 // 50: 1: time: 2004-07-28 08:45:35.197 bid: 111200 ask: 111200 // 51: -1: time: 2004-07-28 08:49:55.338 bid: 111270 ask: 111270 // 52: 1: time: 2004-07-28 09:23:09.808 bid: 111350 ask: 111350 // 53: -1: time: 2004-07-28 09:41:02.790 bid: 111330 ask: 111330 // 54: 1: time: 2004-07-28 09:52:19.965 bid: 111460 ask: 111460 // 55: -1: time: 2004-07-28 11:05:27.532 bid: 111650 ask: 111650 // 56: 1: time: 2004-07-28 11:13:15.674 bid: 111870 ask: 111870 // 57: 0: time: 2004-07-28 12:00:00.645 bid: 111740 ask: 111740 // 58: -1: time: 2004-07-29 08:05:02.825 bid: 112200 ask: 112200 // 59: 0: time: 2004-07-29 08:17:55.727 bid: 112230 ask: 112230 // 60: -1: time: 2004-07-29 08:56:59.034 bid: 112110 ask: 112110 // 61: 0: time: 2004-07-29 08:57:16.116 bid: 112130 ask: 112130 // 62: 1: time: 2004-07-29 09:05:49.077 bid: 112210 ask: 112210 // 63: -1: time: 2004-07-29 09:19:57.343 bid: 112270 ask: 112270 // 64: 1: time: 2004-07-29 09:43:32.387 bid: 112220 ask: 112220 // 65: 0: time: 2004-07-29 09:46:14.921 bid: 112220 ask: 112220 // performance.TickConsoleWrite(); // // for( int i = 0; i< manager.Trades.Count; i++) { // TickConsole.WriteLine(i + ": " + manager.Trades[i]); // } // for( int i=0; i< random.Ticks.Count; i++) { // log.Info(random.Ticks[i]); // } return((PerformanceInner)random.Performance); }