I want to develop a system that consists of three functions:
1. Creation of Custom Indices - This will be done by using the Composite Indicator. Hence, we will have MuniBondsIndex, SeniorLoansIndex etc.
2. Tactical Asset allocation between the various indices above using ROC criteria - This will be the main routine.
3. Ranking the members of the Index so that the highest ranking members are chosen after the selection is made in No. 2 above.
For example, No. 2 selects MuniBondsIndex to be the selection for the month. No. 3 ranked all the muni ETFs and MUB was chosen.
I can do all of these three separately. I can easily combine No. 1 and 2... not a problem. But how can I go about making No. 2 choose from the highest ranker from 3?
yes, the No. 3 comes after No. 2 and it uses the selection that No. 2 made.
For example, we have MuniIndex, BankLoansIndex and TreasuriesIndex. There are five ETFs in each.
Then in No. 2, I use 6 month ROC to determine which index is has the highest momentum... say it is MuniIndex.
For No. 3, I have a separate QS system, that calculates the Sharpe Ratio, Momentum and Ulcer Index Performance of the five ETFs and calculates their composite rank of each of the three indices mentioned above. I now want to buy the No. 1 ranked ETF from the MuniIndex. I can't figure how I can integrate No. 2 and 3 together.
In No.3 and in your system you need to specify the ETFs for MuniIndex and make the calculation based on that.
If you want to automate this then you need a assign each ETF to the index it belongs to. You can for example, update the name3 or index field and put the composite it belongs to.
Once that done, you can use the "comp" function and use the "name3" value as filter or group.
Let me know if my understanding of your requirements is wrong.
Being a relative new user, I am not completely familiar with all the capabilities of the QS system. Is there an example where I can see what you are referring to? That way, I can be sure.
Please check the documentation in the "Composite Function" section.
The format is:
a = comp("formula", "calculation method", "group", "filter formula", "symbols filter");
If you put sector() for example in "group" then each sector will be ranked separately. This means there will be multiple stocks with the best rank (one for each sector).
Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.