SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Thu Oct 22, 2020 6:40 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Tue Aug 09, 2016 2:57 am 
Offline

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

I'm able to use Middle priced bars during a traditional backtest, but can't get them to work during an Optimization.

For instance, you'll see in the attached Solution file's Scenario.cs file I used
Quote:
BarFactory.Add(instrument1, BarType.Time, barSize, BarInput.Middle);

which got middle bars to work in the traditional backtest. However you'll see in the Optimization.cs file that the similar BarInput.Middle code I added did not get middle bars to work.

Any idea what I did wrong in the Optimization.cs file (or any other according files)?

Thanks


Attachments:
SMACrossover (Midbar Optimization).zip [15.4 KiB]
Downloaded 233 times
Top
 Profile  
 
PostPosted: Tue Aug 09, 2016 1:54 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 578
You can add BarFactoryItem with any parameters directly in OptimizationParameterSet:
Code:
               OptimizationParameterSet parameter = new OptimizationParameterSet();

               parameter.Add("Length1", length1);
               parameter.Add("Length2", length2);
               //parameter.Add("Bar", (long)60);

               BarFactoryItem barFactoryItem1 = new BarFactoryItem(instrument1, BarType.Time, 60, BarInput.Middle);
               BarFactoryItem barFactoryItem2 = new BarFactoryItem(instrument2, BarType.Time, 60, BarInput.Middle);
               
               parameter.Add("any name1", barFactoryItem1);
               parameter.Add("any name2", barFactoryItem2);
               
               universe.Add(parameter);

Updated solution:
Attachment:
SMACrossover (Midbar Optimization).zip [16.4 KiB]
Downloaded 246 times


PS you should update OpenQuant2014


Top
 Profile  
 
PostPosted: Wed Aug 10, 2016 2:59 am 
Offline

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

Is the solution file you posted supposed to work as is with the latest version of OQ2014 (Version 1.0.6065.25132)?

I just tried it with that version of 0Q2014 and found the backtest results and optimization results to be inconsistent.


Top
 Profile  
 
PostPosted: Wed Aug 10, 2016 11:37 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 578
M101 wrote:
Thanks.

Is the solution file you posted supposed to work as is with the latest version of OQ2014 (Version 1.0.6065.25132)?

I just tried it with that version of 0Q2014 and found the backtest results and optimization results to be inconsistent.

I slightly modified a solution.
1)usage TimeBarFactoryItem instead BarFactoryItem
2)a filtering of initial data series for make sure that existing data series(eg other bar series) will not interfere.
Attachment:
SMACrossover (Midbar Optimization).zip [16.44 KiB]
Downloaded 268 times


Top
 Profile  
 
PostPosted: Thu Aug 11, 2016 1:48 am 
Offline

Joined: Thu Sep 17, 2015 5:52 am
Posts: 133
That Solution file in your last post gives consistent results between the backtest and optimization, which is great.

However it consumes a gigantic amount of memory when I broaden the optimization parameters. For instance, as a test in the Optimization.cs file I changed the 12 to a 60 and the 16 to an 80 (as shown below), which caused the my computer to use 28 gigs of Ram then freeze about 50% through the optimization.

Code:
//   for (int length1 = 10; length1 < 12; length1++)
//    for (int length2 = length1 + 1; length2 < 16; length2++)
   for (int length1 = 10; length1 < 60; length1++)
    for (int length2 = length1 + 1; length2 < 80; length2++)



Also, I tried using similar logic from your last post's Optimization.cs file on the SMAcrossover that came with OQ2014 Version 1.0.6065.25132 (see my new version attached) and the same issue with memory came up.


Is OQ2014 Version 1.0.6065.25132 the main release of your new Optimizer?
If not, I'll wait for a more official/permanent release of the new Optimizer before I continue trying to get this to work.


Attachments:
SMACrossover.zip [14.6 KiB]
Downloaded 248 times
Top
 Profile  
 
PostPosted: Fri Aug 12, 2016 1:45 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 578
We are working currently with memory leakage during optimization.


Top
 Profile  
 
PostPosted: Tue Aug 16, 2016 5:37 pm 
Offline

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

I just tried Optimizing Midbars in version 1.0.6072.27724 and am the memory issue is still coming up. However, the SMAcrossover solution that came with this version does not give me the memory issue.

Have you been able to Optimize Midbars is this version without the memory issue coming up?


Top
 Profile  
 
PostPosted: Wed Aug 17, 2016 10:16 am 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 578
Can you please send me your solution which causes leakage?


Top
 Profile  
 
PostPosted: Wed Aug 17, 2016 8:10 pm 
Offline

Joined: Thu Sep 17, 2015 5:52 am
Posts: 133
the leakage is caused by the solution file attached to post 4 of this thread when I change its parameters to 60 and 80 as explained in post 5 of this thread.

The leakage issue is also caused by the solution file attached to post 5 of this thread.


Top
 Profile  
 
PostPosted: Thu Aug 18, 2016 12:38 pm 
Offline

Joined: Wed May 05, 2010 9:49 pm
Posts: 578
M101 wrote:
the leakage is caused by the solution file attached to post 4 of this thread when I change its parameters to 60 and 80 as explained in post 5 of this thread.

The leakage issue is also caused by the solution file attached to post 5 of this thread.

Fixed, new setup file already available.


Top
 Profile  
 
PostPosted: Fri Aug 19, 2016 1:29 am 
Offline

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

The memory issue went away, however the solution file(s) posted in this thread no longer fully work with the new Optimizer due to all the new updates.

Is the new Optimizer still in Beta?
If not can you please post an updated version of the Midbar Optimization solution file example that will work with the current version (1.0.6074.22566) of OQ2014?

P.S.
The current version of OQ2014's SMAcrossover example has the symbols AAPL and MSFT in its Scenario.cs file(s) and the symbols AMD and IBM in its Optimization.cs files. I'm guessing this is a mistake?


Top
 Profile  
 
PostPosted: Sat Aug 20, 2016 10:45 am 
Offline

Joined: Tue Aug 05, 2003 3:43 pm
Posts: 6817
M101 wrote:
P.S.
The current version of OQ2014's SMAcrossover example has the symbols AAPL and MSFT in its Scenario.cs file(s) and the symbols AMD and IBM in its Optimization.cs files. I'm guessing this is a mistake?


There is no hidden meaning, the only reason is that AMD and IBM are better suitable for optimization demo and give a smoother objective curve during optimization, that's it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 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