Click here to Login




How to dynamically change the number of positions in a portfolio?

Updated on 2011-03-19





Using the money management script you can dynamically adjust portfolio settings based on criteria such as annual return, return during the last 30 days, current drawdown, current Sharpe ratio...

In order to limit the maximum number of positions in a portfolio, you can use the function "Portfolio.UpdateCategorySettings".
This function can be accessed in all money management events (OnStartSimulation, OnClosePosition, OnNewPosition, OnEndPeriod and OnEndSimulation).

It has four parameters:
Category: The category that is affected by the change in the percentage of capital allocated and the maximum number of positions. Default categories are "Long" and "Short" (Advanced traders can create their own categories).
Percent to Invest: The percentage of capital to allocate to the above category.
Number of positions: The maximum number of positions to assign to the above category.
Tradubg Order: This is the order that will be used to scale-in and scale-out positions (Force the category to adjust quickly to the new settings). If a "null" is passed then the scale-in and scale-out operations will not be performed.

Example:
if(Portfolio.Drawdown < -20)
{
Portfolio.UpdateCategorySettings("long", 50, 3, null);
}










no comments (Log in)

Back







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 © 2012 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items