Inheritance: FastQuant.InstrumentStrategy
Exemplo n.º 1
0
        public override void Run()
        {
            MulticoreOptimizer optimizer = new MulticoreOptimizer();

            OptimizationUniverse universe = new OptimizationUniverse();

            for (int length1 = 2; length1 < 14; length1++)
            {
                for (int length2 = length1 + 1; length2 < 28; length2++)
                {
                    OptimizationParameterSet parameter = new OptimizationParameterSet();

                    parameter.Add("Length1", length1);
                    parameter.Add("Length2", length2);
                    parameter.Add("Bar", (long)60);

                    universe.Add(parameter);
                }
            }

            strategy = new SMACrossover(framework, "strategy ");

            Instrument instrument1 = InstrumentManager.Instruments["AAPL"];
            Instrument instrument2 = InstrumentManager.Instruments["MSFT"];

            InstrumentList instruments = new InstrumentList();

            instruments.Add(instrument1);
            instruments.Add(instrument2);

            DataSimulator.DateTime1 = new DateTime(2013, 12, 01);
            DataSimulator.DateTime2 = new DateTime(2013, 12, 31);

            optimizer.Optimize(strategy, instruments, universe, 100);
        }
Exemplo n.º 2
0
        public override void Run()
        {
            MulticoreOptimizer optimizer = new MulticoreOptimizer();

            OptimizationUniverse universe = new OptimizationUniverse();

            for (int length1 = 2; length1 < 14; length1++)
                for (int length2 = length1 + 1; length2 < 28; length2++)
                {
                    OptimizationParameterSet parameter = new OptimizationParameterSet();

                    parameter.Add("Length1", length1);
                    parameter.Add("Length2", length2);
                    parameter.Add("Bar", (long)60);

                    universe.Add(parameter);
                }

            strategy = new SMACrossover(framework, "strategy ");

            Instrument instrument1 = InstrumentManager.Instruments["AAPL"];
            Instrument instrument2 = InstrumentManager.Instruments["MSFT"];

            InstrumentList instruments = new InstrumentList();

            instruments.Add(instrument1);
            instruments.Add(instrument2);

            DataSimulator.DateTime1 = new DateTime(2013, 12, 01);
            DataSimulator.DateTime2 = new DateTime(2013, 12, 31);

            optimizer.Optimize(strategy, instruments, universe, 100);
        }