SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Sun Apr 05, 2020 11:33 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri Jul 31, 2009 7:04 am 
Offline

Joined: Wed Jan 02, 2008 5:39 am
Posts: 23
Hello,

I am trying to build a 4-minute Bar Series for the trading day start from 9:30 AM to 4:00PM. There are 390 one-minute bars collected for a trading day. We can not have 4 minutes in every 4-minute bar.

Therefore , I want put the first 3 minutes as the first bar (from 9:30 AM to 9:33 AM) and the last 3 minutes as the last bar (from 3:58PM to 4:00PM) where all other time would be 4-minute bars (from 9:34AM to 3:47PM). How can I do this?

I tried the following and it did not work:
Code:
BarSeries min1Bars =DataManager.GetHistoricalBars(Instrument,BarType.Time, 60);
BarSeries min4Bars;
      if (((D.TimeOfDay>=sessionStart) && (D.TimeOfDay<=firstbarTime))||((D.TimeOfDay<=sessionEnd) && (D.TimeOfDay>lastbarTime)))
      {
         min4Bars = min1Bars.compress(3 * 60);
       }
      else
      {
         min4Bars = min1Bars.Compress(4 * 60);
      }
      foreach (Bar bar in min4Bars)
         DataManager.Add(Instrument, bar);



Thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 31, 2009 10:58 am 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
Hi,

If 1min bar series begins at 9:30, an internal bar compressor will always make first 4min bar from 9:28 to 9:32.
You need to compress bar series manually(via script), if you want to have another datetime range.

Regards,
Alex

_________________
SmartQuant Development Team


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 31, 2009 4:53 pm 
Offline

Joined: Wed Jan 02, 2008 5:39 am
Posts: 23
Hello Alex,

Thanks for your quick reply.

Can you please show me how to manually compress the first 3 1-minutes from 9:30 AM to 9:33AM? How should I compress the 1-minute bars from 9:34AM to 3:57PM into 4-minute Bar Series and compress the last 3 1-minute bars (from 3:58PM to 4:00PM)?

Sorry, I need more detailed on how to do this because I don't have much experience using OQ even though I have purchased OQ license for over a year.

Again, thank you very much,

Gundam


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 03, 2009 12:00 pm 
Offline
Site Admin

Joined: Thu Jul 17, 2003 10:39 am
Posts: 1478
Hi Gundam,

I think it is impossible, because you are not able to setup EndTime of the bar manually.
For example, you have open,high,low and close prices for the bar from 9:30 to 9:33.
Then, you call DataManager.Add(instrument, beginTime/*9:30*/, open, high, low, close, volume, barSize/*240 (4 min)*/);

The bar will be stored to the database, but the EndTime will be beginTime + barSize (9:34, not 9:33).

Regards,
Alex

_________________
SmartQuant Development Team


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 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:  
Powered by phpBB® Forum Software © phpBB Group