SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Jan 21, 2018 12:13 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Thu Sep 21, 2017 1:51 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 208
Dear Team,

I got V 1.0.6439.22007

When I want to use your optimisation demo in SMA Crossover, I get the following error with your demo code:
Quote:
Conversion from OpenQuant.MyStrategy in SmartQuant.Strategy not possible.


the error happens with this line:
Quote:
Optimize(strategy, universe);

Any idea, why Optimize does not accept a MyStrategy class?
Code:
using System;
using SmartQuant;
using SmartQuant.Optimization;
using SmartQuant.Strategy_;
namespace OpenQuant
{
   public class Optimization : Scenario_
   {
      public Optimization(Framework framework)
         : base(framework)
      {
      }

        public override void Run()
        {
            OptimizationUniverse universe = new OptimizationUniverse();

            for (int length1 = 5; length1 < 25; length1++)
                for (int length2 = 26; length2 < 60; length2++)
                {
                    OptimizationParameterSet parameter = new OptimizationParameterSet();

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

                    universe.Add(parameter);
                }

            MyStrategy strategy = new MyStrategy(framework, "strategy LS");

            Instrument instrument1 = InstrumentManager.Instruments["AMD"];
            Instrument instrument2 = InstrumentManager.Instruments["IBM"];

            InstrumentList instruments = new InstrumentList();

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

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

            DataSimulator.BarFilter.Add(BarType.Time, 60);
            ExecutionSimulator.FillOnBar = true;

            //You can choose an optimization method from the "Optimizers" window
            //and observe the optimization results in the "Optimization Results" window.

            //Optimization can use either of two ways to declare parameters:

            //1. Optimization using [OptimizationParameter] atrributes from Strategy
            //Optimize(strategy);
            //Strategy t = new Strategy(this.framework, "test");
            //2. Optimization via OptimizationUniverse
            Optimize(strategy, universe);
            //Optimize()
        }
   }
}


Top
 Profile  
 
PostPosted: Mon Sep 25, 2017 6:51 pm 
Offline

Joined: Tue Oct 13, 2009 12:19 pm
Posts: 208
thx for the fix.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group