Пример #1
0
        public override void RunStrategy()
        {
            CleanupFiles();
            StartGUIThread();
            try {
                Starter starter = CreateStarterCallback();

                // 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\\DataCache";
                starter.ProjectProperties.Starter.SetSymbols(Symbols);
                starter.ProjectProperties.Starter.IntervalDefault = Intervals.Day1;
                starter.ProjectProperties.Engine.RealtimeOutput   = false;

                // Set up chart
                starter.CreateChartCallback = new CreateChartCallback(HistoricalCreateChart);
                starter.ShowChartCallback   = null;

                // Run the loader.
                ExampleDualSymbolLoader loader = new ExampleDualSymbolLoader();
                starter.Run(loader);

                ShowChartCallback showChartCallback = new ShowChartCallback(HistoricalShowChart);
                showChartCallback();

                // Get the stategy
                portfolio         = loader.TopModel as Portfolio;
                fullTicksStrategy = portfolio.Strategies[0] as ExampleOrderStrategy;
                fourTicksStrategy = portfolio.Strategies[1] as ExampleOrderStrategy;
            } catch (Exception ex) {
                log.Error("Setup error.", ex);
                throw;
            }
        }
Пример #2
0
        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 = CreateStarterCallback();

                // Set run properties as in the GUI.
                starter.ProjectProperties.Starter.StartTime = new TimeStamp(1800, 1, 1);
                starter.ProjectProperties.Starter.EndTime   = new TimeStamp("2010-02-24 12:58:00.000");
                starter.DataFolder = "Test\\DataCache";
                starter.ProjectProperties.Starter.SetSymbols(Symbols);
                starter.ProjectProperties.Starter.IntervalDefault = Intervals.Minute1;
                starter.CreateChartCallback = new CreateChartCallback(HistoricalCreateChart);
                starter.ShowChartCallback   = new ShowChartCallback(HistoricalShowChart);
                // Run the loader.
                TestLimitOrderLoader loader = new TestLimitOrderLoader();
                starter.Run(loader);

                // Get the stategy
                strategy = loader.TopModel as ExampleOrderStrategy;
                LoadTransactions();
                LoadTrades();
                LoadBarData();
                LoadStats();
            } catch (Exception ex) {
                log.Error("Setup error.", ex);
                throw;
            }
        }
        public override void OnLoad(ProjectProperties properties)
        {
            var strategy = new ExampleOrderStrategy();

            strategy.Multiplier = 10D;
            TopModel            = strategy;
        }
Пример #5
0
        public override void OnLoad(ProjectProperties properties)
        {
            properties.Engine.RealtimeOutput = false;
            Portfolio portfolio = CreatePortfolio("Portfolio", "EntirePortfolio");

            foreach (var symbol in properties.Starter.SymbolProperties)
            {
                string name = "ExampleOrderStrategy+" + symbol.Symbol;
                ExampleOrderStrategy strategy = (ExampleOrderStrategy)CreateStrategy("ExampleOrderStrategy", name);
                strategy.Multiplier    = 10D;
                strategy.SymbolDefault = symbol.Symbol;
                AddDependency(portfolio, strategy);
            }
            TopModel = portfolio;
        }
Пример #6
0
        public override void OnLoad(ProjectProperties properties)
        {
            var portfolio = new Portfolio();
            var fourTicks = new ExampleOrderStrategy()
            {
                Name = "FourTicksData"
            };

            fourTicks.SymbolDefault = properties.Starter.SymbolInfo[0].Symbol;
            var reversal = new ExampleReversalStrategy()
            {
                SymbolDefault = properties.Starter.SymbolInfo[0].Symbol
            };

            AddDependency(portfolio, fourTicks);
            AddDependency(portfolio, reversal);
            portfolio.Performance.GraphTrades = false;
            TopModel = portfolio;
        }