SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Jul 23, 2018 4:46 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat May 19, 2018 9:02 am 
Offline

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

when I run this scenario in VS 2017:
Code:
public override void Run()
        {
            Initialize();
            StrategyManager.Mode = StrategyMode.Live;

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

            Instrument instrument1 = InstrumentManager.Instruments["ES M18"];
            strategy.AddInstrument(instrument1);

            strategy.ExecutionProvider = ProviderManager.GetExecutionProvider(ProviderId.IB);
            strategy.DataProvider = ProviderManager.GetDataProvider(ProviderId.IB);

            //strategy.ExecutionProvider.Connect();      
            StartStrategy();
        }

, I get this error System.NullReferenceException when VS starts StartStrategy. And it happens after the second time it debugs into MyStrategy in here:
Code:
      
public MyStrategy(Framework framework, string name)
            : base(framework, name)         { }
.
When I change StrategyManager.Mode = StrategyMode.Live; to StrategyManager.Mode = StrategyMode.Backtest or StrategyMode.Paper;
all runs fine.

Sure enough, if I run above code in OQ2014, all runs fine. Any idea?
Mike


Top
 Profile  
 
PostPosted: Mon May 21, 2018 10:06 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 430
Hello Mike,
first, Initialize(); should not be used in scenario when you add instruments programmatically.
next, can you provide error text and details(stack trace).


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 2 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