SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Sep 23, 2019 2:25 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Jan 23, 2019 4:49 am 
Offline

Joined: Thu Dec 06, 2018 1:57 am
Posts: 28
I have taken the Bollinger band example strategy and edited it to make bars from BarInput.Middle. However, no bars are being produced by BarFactory. I've also tried using BarInput.Bid, BarInput.Ask and ClockType.Local but no bars produced. Here is my code. Any help?

namespace OpenQuant
{
public class Backtest : Scenario
{
private long barSize = 300;

public Backtest(Framework framework)
: base(framework)
{
}

public override void Run()
{
Instrument instrument1 = InstrumentManager.Instruments["AAPL"];
Instrument instrument2 = InstrumentManager.Instruments["MSFT"];

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

strategy.AddInstrument(instrument1);
//strategy.AddInstrument(instrument2);

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

BarFactory.Clear();
BarFactory.Add(instrument1, BarType.Time, barSize, BarInput.Middle, ClockType.Exchange, DataSimulator.Id);
//BarFactory.Add(instrument1, BarType.Time, barSize);
//BarFactory.Add(instrument2, BarType.Time, barSize);

StartStrategy();
}
}
}


Top
 Profile  
 
PostPosted: Wed Jan 23, 2019 9:56 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 497
Hello,
Try this line:
Code:
BarFactory.Add(instrument1, BarType.Time, barSize, BarInput.Middle);

instead of:
Code:
BarFactory.Add(instrument1, BarType.Time, barSize, BarInput.Middle, ClockType.Exchange, DataSimulator.Id);


Top
 Profile  
 
PostPosted: Fri Feb 01, 2019 5:29 am 
Offline

Joined: Thu Dec 06, 2018 1:57 am
Posts: 28
hmmm, this works but I can't seem to find this particular method signature in the class reference.


Top
 Profile  
 
PostPosted: Fri Feb 01, 2019 9:36 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 497
abasqd wrote:
hmmm, this works but I can't seem to find this particular method signature in the class reference.

It is same method.
ClockType.Exchange and DataSimulator.Id are optional parameters.


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

All times are UTC + 3 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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