SmartQuant Discussion

Automated Quantitative Strategy Development, SmartQuant Product Discussion and Technical Support Forums
It is currently Fri Apr 10, 2020 9:52 pm

All times are UTC + 3 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Registering parameters
PostPosted: Wed Sep 19, 2007 9:24 pm 
Offline

Joined: Mon Jul 28, 2003 7:54 pm
Posts: 35
Hi,

declaring parameters for a trading strategy by prefixing a field with the parameter() attribute is easy to use at the first glance.
In my opinion it undermines the modularity of complex trading systems. The only remaining way to structure a complex TS is subclassing. Though OO is a great thing, we also know that inheritance has to be used carefully and sparsely. In many situations aggregation is preferable to inheritance.
In this case that means it is better to build a TS from components and each component has to control the paramters it needs itself. MyStrategy only has to aggregate the components i.e. declaring the corresponding fields and calling "new" in OnStrategyStart().

A possible solution could be:
1. declaring an event e.g. RegisterParameters in Strategy.
2. The event is called in OQ Framework directly after compilation.
3. Components are created (new) and get MyStrategy as a parameter.
4. Each component subscribes to the event MyStrategy.RegisterParameters.
5. Each registered delegate calls the actual method to register each of its parameters
6. same for optimization parameters

Other benefits:
- default values for parameters could be read from a file
- it is possible switch from optimization mode to trading mode without modifying the code
- Registration scheme can coexist with present attribute scheme

I already use the event mechanism to register components for events like OnBar, OnBarOpen, etc. Works really fine!

just food for thought!

Regards,
Frank.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 21, 2007 9:20 pm 
Offline

Joined: Mon Jul 28, 2003 7:54 pm
Posts: 35
Hi again,

thought a little about it. An alternative to subclassing of course could be using a code generator. With a code generator it is no problem gathering all strategy parameters (and other code) from several modules that comprise a specific trading strategy. Setting specific parameter values or switching optimization parameters on and off could also be automated by an code generator. And most important C# already has many features that make it relatively easy to generate code for it.

Does anybody already have experience with code generation for C# and especially OQ?

Regards,
Frank.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 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:  
cron
Powered by phpBB® Forum Software © phpBB Group