Hello guys,
I don't know how difficult this would be, but I propose the following:
There is today in building blocks a way for you to assign weight to symbols according to the highest/lowest values of a given indicator.
The idea would be instead of giving weight, to restrict the trade signals to only N symbols (that would be N symbols with the highest/lowest values of the given indicator).
It would be something like using an adaptation of the code mentioned by Glitch in post #4 of this thread:
https://www.wealth-lab.com/Discussion/Number-of-stocks-with-the-lowest-highest-values-of-an-indicator-8097
The idea would not be to have a rotation strategy, but a strategy that could only be executed on the N symbols with the highest/lowest values of some indicator.
Would this be possible through Building Blocks?
I don't know how difficult this would be, but I propose the following:
There is today in building blocks a way for you to assign weight to symbols according to the highest/lowest values of a given indicator.
The idea would be instead of giving weight, to restrict the trade signals to only N symbols (that would be N symbols with the highest/lowest values of the given indicator).
It would be something like using an adaptation of the code mentioned by Glitch in post #4 of this thread:
https://www.wealth-lab.com/Discussion/Number-of-stocks-with-the-lowest-highest-values-of-an-indicator-8097
The idea would not be to have a rotation strategy, but a strategy that could only be executed on the N symbols with the highest/lowest values of some indicator.
Would this be possible through Building Blocks?
Rename
Let's change topic title to reflect the request better:
WAS:
"Restricting the strategy to the N highest/lowest of a given indicator through Building Blocks "
IS:
"Restricting a Blocks strategy to N symbols and highest/lowest Weight"
WAS:
"Restricting the strategy to the N highest/lowest of a given indicator through Building Blocks "
IS:
"Restricting a Blocks strategy to N symbols and highest/lowest Weight"
In Strategy Settings > Position Sizing, can you achieve what you're looking for by setting "Max Open Pos Per Symbol" to 1 and "Max Open Pos" to N?
Hi Eugene, thanks for answer.
I believe not, because in this case that you mentioned, WL will select the highest N values of entire strategy and entire DataSet.
What I am looking for is restricting the strategy to be applied only in the N symbols that have the highest/lowest "X" indicator value.
It's more about take a DataSet, apply the X indicator, then restricting the dataset to only the N symbols with highest/lowest values and only then apply the strategy in these N symbols.
Little bit hard to my as a foreign guy to explain haha
I believe not, because in this case that you mentioned, WL will select the highest N values of entire strategy and entire DataSet.
What I am looking for is restricting the strategy to be applied only in the N symbols that have the highest/lowest "X" indicator value.
It's more about take a DataSet, apply the X indicator, then restricting the dataset to only the N symbols with highest/lowest values and only then apply the strategy in these N symbols.
Little bit hard to my as a foreign guy to explain haha
I think you're explaining it ok, but I don't see the difference. Since every symbol's indicator value will change on every bar, the N symbols/instruments will change too.
How is that different than giving a greater weight (priority) to the symbols with the H/L indicator value? Maybe you could explain it using a real example.
How is that different than giving a greater weight (priority) to the symbols with the H/L indicator value? Maybe you could explain it using a real example.
Ok, let's try :)
I am posting 2 pictures. The first one is using the current system. The second one is using the proposed system.
Notice that in the current system, when the conditions are met, it chooses the 5 largest and enters the 5 positions.
In the proposed system, it first chooses the 5 largest (darkest row segregating), then it checks within these 5 if the conditions are true, entering only those that are.
I hope this made it a little clearer :)
I am posting 2 pictures. The first one is using the current system. The second one is using the proposed system.
Notice that in the current system, when the conditions are met, it chooses the 5 largest and enters the 5 positions.
In the proposed system, it first chooses the 5 largest (darkest row segregating), then it checks within these 5 if the conditions are true, entering only those that are.
I hope this made it a little clearer :)
That part is clear, thanks.
In the case of "Proposed N=5" and the AXP entry, what happens if there are already 5 Positions open? Does the strategy manage all the exits separately, or does the strategy close a Position to make room for AXP? ...a pseudo-rotation strategy.
In the case of "Proposed N=5" and the AXP entry, what happens if there are already 5 Positions open? Does the strategy manage all the exits separately, or does the strategy close a Position to make room for AXP? ...a pseudo-rotation strategy.
Ahh I get it now rs.
The strategy does not close positions to make room for others, it would not be a rotation strategy. We can consider a momentum strategy, for example, where we would trade only the N assets with, for example, higher RSI(20) if they meet the additional conditions.
Literally the part of the X indicator - RSI(20) - is just to segregate the assets for entry into a dataset and just allow the entry conditions to be applied only to the N symbols.
The strategy does not close positions to make room for others, it would not be a rotation strategy. We can consider a momentum strategy, for example, where we would trade only the N assets with, for example, higher RSI(20) if they meet the additional conditions.
Literally the part of the X indicator - RSI(20) - is just to segregate the assets for entry into a dataset and just allow the entry conditions to be applied only to the N symbols.
While nothing's impossible, this request goes beyond the current scope of block strategies since it requires a PreExecute method and a static list.
Are you interested in a C# Code solution or a block solution only? If you posted a basic strategy (C# code version), I could show you how to modify it pretty easily, I think.
Are you interested in a C# Code solution or a block solution only? If you posted a basic strategy (C# code version), I could show you how to modify it pretty easily, I think.
Thank you very much Cone for your assistance and willingness to help.
I have already used the example from the post mentioned above (the sample strategy) to run a simple system for test purposes in C#. I used the building blocks to generate the code and merged it with the refered code above. The problem is we won't have the agility of the building blocks to help build the systems, we will always need to work in C# adapt.
Anyway, thanks for the support, if I get stuck in any part of the code, I will ask for your help.
I have already used the example from the post mentioned above (the sample strategy) to run a simple system for test purposes in C#. I used the building blocks to generate the code and merged it with the refered code above. The problem is we won't have the agility of the building blocks to help build the systems, we will always need to work in C# adapt.
Anyway, thanks for the support, if I get stuck in any part of the code, I will ask for your help.
Your Response
Post
Edit Post
Login is required