The portfolio tool is one of the main features of QuantShare. It allows you to manage your trades and automatically create new orders based on an existing (already analyzed or backtested) trading system. Quantitative and mechanical traders usually create, optimize and backtest their trading systems and then use the portfolio tool to get buy, sell, short and cover orders to execute in their brokers platform. Example: Your trading system buys stocks when the S&P 500 is increasing and when a stock RSI (Relative Strength Index) crosses above the 70 level. The exit rule consists of a 20% trailing stop. The portfolio allows you to get the last stocks or securities that meet the strategy conditions. It also gives you sell orders each time a holding position drops more than 20% from its highest value (trailing stop). How to create a portfolio There are two main ways to create a portfolio. You can do it directly from the portfolio manager or you can create a trading system-based portfolio from the simulator manager. The first option consists of opening the portfolio manager by clicking on "Portfolio" in the main menu then on "Portfolio". In the new form, click on "New" to open the portfolio editor. There, you can define several options such as: - Capital: This is the initial equity - Number of positions: The maximum number of positions to allow in your portfolio - Strategy: You can associate a trading system to a portfolio by clicking on "Associate it with a strategy" then selecting an existing trading system. - Past Days: The number of days to look back for signals. Example: In your portfolio, you have specified a long-only strategy that analyzes two stocks: A: Buy signal occurred one day ago AA: Buy signal occurred today You want to get signals for today and you have the "Past Days" option set to zero. The portfolio will generate only one order to buy stock "AA". If you have specified a "Past Days" value of one or higher, then the portfolio would have generated two orders: one to buy stock "A" and another to buy stock "AA". The second option to create a portfolio would be to open the simulator manager, select a trading system then click "Create Portfolio" button (located at the bottom). Getting buy, sell, short and cover orders: how it works In the case of a strategy-based portfolio, you have to select your portfolio then click on the "Get Signals" button (Located under the "Pending Orders" tab). Once you click on that button, the portfolio will analyze your existing positions and pending orders and then pass them to the analyzer engine. This engine will read securities quotes, apply the trading system and get signals that occurred on the "Signal Date" (User defined). Based on the default or a custom ranking system (and other settings such as "Rejected Orders"), the first signals will be passed to you (Not all signals are returned because there is a limit that you have defined regarding the maximum number of positions in a portfolio). New signals will be converted to orders and displayed in the table under the "Pending Orders" tab. If you do not like an order or just want to ignore it, click on the remove icon "X" (last column). The order will be added to the "Rejected Orders" table. There, you can restore any order by clicking on the "+" icon (last column). After you reject one or some orders, you can get new ones by clicking on the "Get Signals" button again. To execute an order click on the "Action" button (Buy, sell, short or cover), specify the entry price, number of shares, total commissions then click on "Confirm". The new position will be added to the table under the "Positions" tab. It is also possible to update a position after the order is filled. To do this, click on the "I" icon in the "Positions" table, then update the number of shares, price and commission values of the entry, scale-in and scale-out transactions. You can modify stop settings and stop levels by selecting the "Stops" tab and updating the appropriate fields. Portfolio and money management scripts The portfolio engine supports trading system based on one or several money management scripts. Everything is automated and the portfolio engine will execute the appropriate money management events when you instruct it get new signals. There are however, few differences between how some events in the money management scripts are handled by the portfolio and simulator/backtester. Events: - OnClosePosition: There are no differences between the portfolio and simulator plug-ins in the execution of this event. - OnNewPosition: No differences exist between the portfolio and simulator plug-ins. - OnEndPeriod: There are no differences between the portfolio and simulator plug-ins. - OnEndSimulation: This event is never executed by the portfolio plug-in. - OnStartSimulation: This event is executed only the first time you rebalance a strategy (The first time you click on "Get Signals" button). When this event is executed, the money management inputs and variables are created and initialized. Here is how to modify these variables later: - Select a portfolio - Click on "Update" - Click on "Money Management Variables" link under "Strategy" panel - In the variables tab, click on a cell under the "Value" column to update it Note: To re-execute the "OnStartSimulation" event on the next rebalance, set the "IsFirstBar" field to "True". Money Management Categories Each time your money management script creates or updates a category, the portfolio engine is informed and the new category settings are displayed in the "Categories" tab. For more information regarding the advanced categories feature, please read the following article: How to combine long, short and custom portfolio strategies within a trading system Example: By default, in a long/short trading system, 50% of equity is assigned to "long" positions. If your money management script contains a rule that sets this percentage to 25% each time the equity drawdown, Sharpe or Sortino ratio drops below a specified threshold, then when this event occurs, the "Categories" tab will display "25" when you select the "long" category. The left list-box contains the different categories ("long" and "short" are the default categories). When you click on a category, its name, number of positions, percent to invest and available cash are displayed next to the list-box. Different actions you can take: - Adjust Cash: This button lets you to adjust automatically the available cash based on the portfolio value or equity and the percent of equity to invest in the selected category. Available cash is adjusted by default; however, this function can be useful if you make custom changes (executing manual orders for example). - Update: Allows you to save your changes. Example: After increasing or decreasing the maximum number of positions to assign to the selected category. - Delete: Deletes the selected category.
|