For strategies that uses limit/stop orders and are run against a large dataset, more often than not, generate a lot of NSF positions. For these type of strategies I filter trade candidates by a set of ranking criteria in the pre-execute section, thereby eliminating or greatly reducing the NSF positions to avoid path dependence and overstating back-testing results. Is it possible to create a building block for this?
Rename
What kind of filter would a set of ranking critera imply, for example?
Say you have 20 signals, for a given time step, on a portfolio back test. The position sizing is equity percent of 10% and margin of 1 (no leverage). The signals are all limit/stop orders, and for examples sake, they all would get filled. So there is path dependence which orders get filled and which become NSF positions.
By filtering these signals down to 10 from 20 in the pre-execute method by some ranking method you eliminate the path dependence (i.e. no NSF positions) and need to run granular limit processing (which makes optimizing these strategies much easier).
It also lets you utilize capital more efficiently as you can limit the use of capital allocated to the strategy at a capped amount.
I would picture the building block have options for:
- number of candidates or formulaic options such as (total # candidates - # existing positions) * 2 (thought process is that many of orders don't get filled and I want to execute as many signals as possible without creating NSF positions)
- option to exclude existing position symbols
- Ranking criteria from which the highest values are selected
* Ideally a grid with each factor get normalized and has a weighting such as:
1) normalized( RSI(2) ) , weight (0.5)
2)normalized( HV(21,252), weight(0.5)
By filtering these signals down to 10 from 20 in the pre-execute method by some ranking method you eliminate the path dependence (i.e. no NSF positions) and need to run granular limit processing (which makes optimizing these strategies much easier).
It also lets you utilize capital more efficiently as you can limit the use of capital allocated to the strategy at a capped amount.
I would picture the building block have options for:
- number of candidates or formulaic options such as (total # candidates - # existing positions) * 2 (thought process is that many of orders don't get filled and I want to execute as many signals as possible without creating NSF positions)
- option to exclude existing position symbols
- Ranking criteria from which the highest values are selected
* Ideally a grid with each factor get normalized and has a weighting such as:
1) normalized( RSI(2) ) , weight (0.5)
2)normalized( HV(21,252), weight(0.5)
Let the votes fall where they may, but if I were you I'd just start writing my custom code for my very custom and specific requirements.
It doesn't hurt to ask right? I will probably just take a crack at writing my own building block. Is there a way to make it available to everyone if I take the time to write it?
Yes, there is a way - we could beef up the Wealth-Lab 8 Extension Demo project on GitHub with your Building Block:
https://github.com/LucidDion/WL8ExtensionDemos
Here's the API for creation of user-defined Blocks:
https://www.wealth-lab.com/Support/ExtensionApi/BuildingBlock
https://github.com/LucidDion/WL8ExtensionDemos
Here's the API for creation of user-defined Blocks:
https://www.wealth-lab.com/Support/ExtensionApi/BuildingBlock
But Building Blocks currently have no way to generate code in the PreExecute method so I don’t think it’s possible in this case.
I agree with Cone. Write your own code for a ranking, combine the criterias and let it end up in the Transaction weight condition that you can use within building blocks. If you want to trade your ideas. Otherwise (especially since you asked), you should make an extension as Eugene recommended with the restriction by Glitch.
Your Response
Post
Edit Post
Login is required