SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Mon Jul 06, 2020 5:08 am

All times are UTC + 3 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Range Bar Bug?
PostPosted: Tue Oct 11, 2016 1:09 am 
Offline

Joined: Thu Sep 17, 2015 5:52 am
Posts: 133
Hi,

I ran a Range bar backtest and the resulting bars seem to only have a 2 tick range regardless of what I set the Range size to.

For instance, 1.jpg looks the same when I change the number 5 in the scenario file code below to a 10, 20, or any other number. (Note: the instrument I am backtesting has a 0.25 tick size, as shown in 2.jpg)
Code:
BarFactory.Add(instrument1, BarType.Range, 5);

Is this a bug or am I just not setting the Range size right?

Thanks


Attachments:
1.JPG
1.JPG [ 81.88 KiB | Viewed 2441 times ]
2.JPG
2.JPG [ 31.87 KiB | Viewed 2441 times ]
Top
 Profile  
 
 Post subject: Re: Range Bar Bug?
PostPosted: Tue Oct 11, 2016 10:13 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 569
Hello M101,
Probably the Range bars are working not as you are expecting.
There is condition for closing current range bar:
Code:
                if (tick.price > bar.high || tick.price < bar.low)
                    if (10000 * (bar.high - bar.low) >= barSize)
                    {
                        bar.dateTime = tick.dateTime;

                        EmitBar();
                    }


You can implement your own class derived from BarFactoryItem.


Top
 Profile  
 
 Post subject: Re: Range Bar Bug?
PostPosted: Tue Oct 11, 2016 11:04 pm 
Offline

Joined: Thu Sep 17, 2015 5:52 am
Posts: 133
Hi Skuvv,

I'm not sure I understand.

1. Are you saying the issue I'm having is a bug?
2. Where exactly would I place the code (shown again below) you posted? In the scenario file? In a strategy file similar to the MyEventFilter.cs file from OQ2014's "SMACrossoverWithEventFilter" example?

Code:
                if (tick.price > bar.high || tick.price < bar.low)
                    if (10000 * (bar.high - bar.low) >= barSize)
                    {
                        bar.dateTime = tick.dateTime;

                        EmitBar();
                    }


Thanks


Top
 Profile  
 
 Post subject: Re: Range Bar Bug?
PostPosted: Wed Oct 12, 2016 9:34 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 569
BarFactory works with BarFactoryItem,
so you can make new derived class:
Code:
YourClass : BarFactoryItem


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