SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Dec 13, 2017 6:41 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Feb 12, 2015 11:36 am 
Offline

Joined: Thu Dec 29, 2011 5:59 am
Posts: 87
When I start my strategy I want to get some indicator value based on historical bars. I have no problem loading those historical bars via DataManager. But I couldn't get my indicator value. In my case it is the ATR value. I can only get the ATR value from onBar calling of calculateXYZ. Please advise.

public override void OnStrategyStart()
{
BarSeries oldbars = GetHistoricalBars(datetime1, datetime2, BarType.Time, 60);
foreach (Bar b in oldbars)
{ DataManager.Add(Instrument, b); //Add to database }
atr = new ATR(GetBars(BarType.Time,60), ATRperiod);
calculateXYZ();
}


public void calculateXYZ()
{
BarSeries oneMinBars = GetBars(BarType.Time,60);
if (atr.Count > 0)
{ do somthing.....}
}


public override void OnBar(Bar bar)
{
BarSeries oneMinBars = GetBars(BarType.Time,60);
calculateXYZ();
}


Top
 Profile  
 
PostPosted: Thu Feb 12, 2015 11:49 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6783
Hi,

have you looked at this FAQ?

viewtopic.php?f=64&t=6227

Regards,
Anton


Top
 Profile  
 
PostPosted: Thu Feb 12, 2015 12:34 pm 
Offline

Joined: Thu Dec 29, 2011 5:59 am
Posts: 87
thank you. It works.


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

All times are UTC + 3 hours


Who is online

Users browsing this forum: Google [Bot] and 3 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