# Portfolio Design

Advanced concepts in stock investment portfolio design.  Fundamentals, technical analysis and many other related topics are discussed.

# Preparing Piotroski For Optimization

I am going to attempt to optimize the Portfolio123 ranking system All Stars: Piotroski. The Portfolio123 implementation of Piotroski's screening factors is different than the original but provides a reasonable implementation.

## Limitation of Stock Factors/Functions

The ranking system consists of eight factors. This is important because the P123 Ranking System Optimizer can handle fifteen factors and not much more. If you try to optimize a ranking system with 20 factors, for example, the optimizer will give errors when you try to generate permutations. The ranking system is shown below.

## Performance Baseline

Before getting started with this exercise it is a good idea to measure the performance of the ranking system as is. To do this, you need to select the All Stars: Piotroski Ranking System (as shown above) and then select the performance link on the left side of the screen as shown below.

Once you arrive at the performance screen then the appropriate fields should be set up for the performance chart calculation.  In this case, the defaults are going to be used.  Click on the Run button to calculate the performance graph.

The ranking system performance is shown below.  With 20 ranking buckets, the highest ranking bucket Rank > 95, is the right-most bar on the chart and is 20% per annum calculated over the full data history starting in 1999.

Now that we know the baseline performance is, let's massage the ranking system into a form that is compatible with the optimizer.

## Node Limitations

The next limitation of note is that the ranking system optimizer cannot able to handle composite nodes nodes such as the fundamentals node along with the 7 factors within the node. The optimizer also can't handle conditional nodes.  All complex nodes, apart from stock factor and formula, have to be eliminated.  In this case, the process is not too painful and can be done using either the text editor or the procedure described below.

## Copying the Ranking System

All Stars: Piotroski is a P123 Ranking System and can't be edited directly.  Therefore an editable copy must be created.  This is done by clicking on Save As.  Change the name of the ranking system then click on Save.

## Eliminating the Composite Node

After the ranking system has been copied and renamed, the composite node can be deleted.  As mentioned before, this can be done by using the text editor (if you are a programmer).  Otherwise, select Fundamentals and then cut the sub-nodes as shown below.

Now paste the sub-nodes at the top level as shown below.

Now cut the Fundamentals node.

We are going to start optimizing with equal-weighted stock factors/formula. Select the top level node Stitts Piotroski, then select the Weights Tab, click on Distribute Evenly then Update. These actions are shown below.

Got all that?  Good.  Now save the ranking system.

Now lets check the performance of this new ranking system.  Use the same procedure as before.  Despite changing the node weights, the performance is pretty similar.  The top bucket is still 22% per annum.  (Click to enlarge).

The modification to the All Stars: Piotroski ranking system is now complete and we are ready to begin the optimization process.

Categories: