Esempio n. 1
0
        public void Optimize()
        {
            if (true)
            {
                IComponentBase ic;

                meta  = new ATSMetaStrategy("metagp");
                strat = new ATSStrategy("ATS", "Test ATS Strategy");

                //StrategyComponentManager.RegisterDefaultComponent(typeof(atscQT));
                //ic = StrategyComponentManager.GetComponent("{1bffce05-3830-484b-aabc-21297ab3fc2a}", this);
                //strat.SetComponent(ComponentType.ATSComponent, ic);

                StrategyComponentManager.RegisterDefaultComponent(typeof(atscPivot));
                ic = StrategyComponentManager.GetComponent("{55e7fcd2-3e34-4218-8d01-571c6c54fb4d}", this);
                strat.SetComponent(ComponentType.ATSComponent, ic);

                StrategyComponentManager.RegisterDefaultComponent(typeof(mktSingle));
                ic = StrategyComponentManager.GetComponent("{0c19f913-f3e5-4c53-9908-4b87403f0616}", this);
                strat.SetComponent(ComponentType.MarketManager, ic);

                //StrategyComponentManager.RegisterDefaultComponent(typeof(mktToTrade));
                //ic = StrategyComponentManager.GetComponent("{f6e7b160-1d92-4f46-af68-8d451783addc}", this);
                //strat.SetComponent(ComponentType.MarketManager, ic);

                meta.Add(strat);
                Console.WriteLine("meta.strategies.count {0}", meta.Strategies.Count);

                StrategyComponentManager.RegisterDefaultComponent(typeof(simQuotesAndTicks));
                ic = StrategyComponentManager.GetComponent("{52728743-527f-4e40-a128-dd37387e6304}", this);
                meta.SetComponent(ComponentType.SimulationManager, ic);

                meta.MetaStrategyMode = MetaStrategyMode.Simulation;
                meta.SimulationManager.Init();

                meta.OptimizationManager = new optimizer();
                //meta.Optimizer = new BruteForceTest(meta);
                meta.Optimizer     = new GPOptimizer(meta);
                meta.OptimizerType = EOptimizerType.GeneticAlgorithm;

                meta.Optimizer.UpdateCalled          += new EventHandler(Optimizer_UpdateCalled);
                meta.Optimizer.StepCalled            += new EventHandler(Optimizer_StepCalled);
                meta.Optimizer.ObjectiveCalled       += new EventHandler(Optimizer_ObjectiveCalled);
                meta.Optimizer.Inited                += new EventHandler(Optimizer_Inited);
                meta.Optimizer.BestObjectiveReceived += new EventHandler(Optimizer_BestObjectiveRecieved);
                meta.Optimizer.CircleCalled          += new EventHandler(Optimizer_CircleCalled);

                meta.GetOptimizationParameters();

                meta.Started += new EventHandler(meta_Started);
                meta.Stopped += new EventHandler(meta_Stopped);

                //meta.DesignMode = false;
                meta.Optimize();
            }
        }
Esempio n. 2
0
        protected override List <KeyValuePair <string, object> > GetItems()
        {
            List <KeyValuePair <string, object> > list = new List <KeyValuePair <string, object> >();

            foreach (ComponentRecord componentRecord in StrategyComponentManager.GetComponentList(this.componentType))
            {
                IComponentBase component = StrategyComponentManager.GetComponent(componentRecord.GUID, this.instance);
                list.Add(new KeyValuePair <string, object>(component.Name, component));
            }
            return(list);
        }