SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Wed Sep 23, 2020 12:45 pm

All times are UTC + 3 hours

Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Sep 16, 2012 4:41 pm 

Joined: Tue Jun 09, 2009 5:07 pm
Posts: 10
Location: Belgium
Dear alexei,

The BarSeries.GetRange method does not return a filled barserie.

The below Script performs without errors but “range” is always empty. Eventhough the original BarSeries “bs” holds data within the specified range, the resulting barseries “range” is always empty.

Line of code : (BarSeries range = bs.GetRange(begin,end);)

I tested it in a script and in a trading strategy: both with the same results.

Can you please investigate and correct if needed?

System : Win7 (64) OQ 3.5.2 (64)


using System;
using System.IO;
using System.Drawing;

using OpenQuant.API;
using OpenQuant.API.Indicators;

public class MyScript : Script
   Instrument instrument    = InstrumentManager.Instruments["MSFT"];
   public DateTime begin    = new DateTime(2012,09,01,00,00,00);
   public DateTime end    = new DateTime(2012,09,13,10,59,59);
   public override void Run()
      foreach (BarSeriesInfo series in DataManager.GetBarSeriesInfoList(instrument))
         BarSeries bs = DataManager.GetHistoricalBars(instrument, series.BarType, series.BarSize);
         Console.WriteLine("Nbr bars in barserie : "+ bs.Count);
      //   foreach (Bar bar in bs) if( bar.DateTime> begin && bar.DateTime< end) Console.WriteLine("bar : " + bar);
         BarSeries range = bs.GetRange(begin,end);// range is always empty!!!!!

         Console.WriteLine("Nbr bars in range : "+ range.Count);

PostPosted: Thu Feb 06, 2014 9:51 pm 

Joined: Tue Oct 15, 2013 5:24 pm
Posts: 8
I've encountered that also.
Maybe you can try to create your range on your own. something like -

var rangeBars = new BarSeries();
for (int i = 0; i <= Bars.Count -1; i++)
if(Bars[i].DateTime >= begin && Bars[i].DateTime <= end)

PostPosted: Fri Feb 07, 2014 10:28 am 
Site Admin

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

We have already fixed it.
An update will be included into the next version of OQ.

SmartQuant Development Team

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