Click here to Login





                                                   Limit Sector weighting in Ranked Portfolio using Group/Filter function

  0

0
Kiran
2016-04-14 03:23:16


How do i use the Group parameter (or Filter parameter) in Comp to backtest a ranked system (of say 10 positions) to add a constraint where <4 positions are from 1 sector? Didn't find a blog explaining.
Any sample code you could provide is much appreciated..



QuantShare
2016-04-14 04:37:54

  0

Here is an example:

filter = comp(roc(10), "rank", industry()) <= 4;

For debugging, you can use the screener tool to display the "comp" result using "AddColumn" function
AddColumn("Rank Industry", filter);



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
    To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










    QuantShare

    Trading Items
    Sentiment Measure Using ETF Sector Correlations
    Stop Trading Based on Your Portfolio Equity Return
    Basic Portfolio Measures
    Correlation To Portfolio
    Sector Surfer AMM Model

    How-to Lessons
    How to quickly add several positions to your portfolio
    How to plot a stock using different periods in the same chart
    How to import trades into a portfolio
    How to calculate the average of a time series using the money man...
    How to get trading orders from a portfolio programmatically

    Related Forum Threads
    Can I update the sector and industry information in the stock dat...
    Backtest using AutoSR function
    Question on limit buys
    TimeframeApply function
    Calling a Function from another Function

    Blog Posts
    How to create market indicators using the composite function - Pa...
    How to create market indicators using the composite function - Pa...
    How to create market indicators using the composite function - Pa...
    True portfolio simulation applied to trading systems
    Forecast volatility using trading rules and neural networks









    QuantShare
    Product
    QuantShare
    Features
    Create an account
    Affiliate Program
    Support
    Contact Us
    Trading Forum
    How-to Lessons
    Manual
    Company
    About Us
    Privacy
    Terms of Use

    Copyright © 2025 QuantShare.com
    Social Media
    Follow us on Facebook
    Twitter Follow us on Twitter
    Google+
    Follow us on Google+
    RSS Trading Items



    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.